wiki:SIP_Redirection

Version 1 (modified by bennylp, 11 years ago) (diff)

--

Processing Outgoing Call Redirection in PJSUA-LIB

This article describes SIP redirection support in PJSUA-LIB, that is implemented by ticket #456.

Outgoing Call Redirection and Multiple Targets

The redirection in this article is about following (or not) redirection response (SIP 3xx code) in outgoing call, and not about sending redirection/3xx response. Sending 3xx response in PJSUA-LIB is easy; just use pjsua_call_hangup() and give the new targets in Contact header in msg_data parameter.

The SIP redirection support in PJSUA-LIB is implemented as subset of generic multiple call targeting support. Multiple call targeting is a neat new feature in PJSUA-LIB that allows a single outgoing call to have multiple targets, which will be called sequentially until one of the target picks up the call. Some use cases of this feature are as follows.

Redirection

Redirection (by means of SIP 3xx response) is a natural use case of multiple call targeting. In this scenario, the original INVITE is rejected with redirection response (SIP 300-399 code) containing one or more targets (Contact header). Application then may instruct the call to follow the redirection, and the library will send a fresh INVITE request to the new target. This second INVITE may be redirected too, and once again application may instruct the call to follow the new target. And so on, the process continues until one of the target picks up the call, or all targets have been tried but none of them can accept the call, or the call has reached it's maximum number of targets allowed in a single call.

The process of retrying new targets will happen automatically without application having to make a new call (although it may do that if it wants to), and all invite requests belong to the same call id. That said, application still has the full control over accepting the redirection instruction. It may reject the redirection, it may accept it, it may accept only partial list of targets, and it may delay the acceptance if it wants to ask for user permission first.

Multiple Call Targeting

This is a neat feature of PJSUA-LIB, to give multiple targets to the outgoing call without having to receive 3xx response. Here is a sample use case.

Suppose you want to reach anybody in PJSIP, for example you have a show-stopper bug that needs to be fixed urgently. You do not care who should pick up the phone, all you care is that someone in PJSIP should answer your call (say, you are boiling mad that the application crashed, and you want somebody in PJSIP to hear about this). You know the SIP address of two persons in PJSIP, Perry and me.

So you dial Perry's URI, and also configure the (same) call with my URI as alternate target. If Perry picks up the phone, good, you can offload your rants to him. If he doesn't pick up the phone, the call will go to its alternate target, which is me (as long as Perry doesn't also redirect the call to his voice mail). Of course this is bad news for me, but you, the customer, is happy, and that's the main thing.