Changes between Version 5 and Version 6 of SIP_Redirection
- Timestamp:
- Nov 27, 2008 12:20:30 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SIP_Redirection
v5 v6 8 8 9 9 The redirected call handling is implemented by ticket #10. The objective statements of this work are: 10 - must be implemented in PJSIP level rather than PJSUA-LIB level 10 - must be implemented in PJSIP level rather than PJSUA-LIB level, to allow the usage on non-PJSUA-LIB based applications. 11 11 - must allow application to accept or reject the redirection request on a per-target basis (by means of callback) 12 12 - must allow application to defer the decision to accept or reject the redirection request (for example, to ask for user confirmation to accept or reject the target) … … 29 29 If this callback is implemented, the default behavior (that is when the callback contains no function body) is to follow the redirection. 30 30 31 This callback is called when the invite session is being redirected to a new target. If there are multiple targets, then the callback will be called for each target. This function is called on these events:31 This callback is called when the invite session is being redirected to a new target. If there are multiple targets, then the callback will be called multiple times, once for each target. This function is called on these events: 32 32 - a 3xx response containing usable Contact header(s) is received 33 33 - a 4xx or 5xx response to subsequent INVITE request is received, and the invite session has at least one more valid target to try. This happens for example when multiple Contact headers (alternate targets) are received for the original INVITE, and 4xx/5xx response is received for the second INVITE (to the first alternate target). The callback then will be called before the invite session tries to send the third INVITE to the second alternate target. … … 42 42 43 43 ''cmd'':: 44 Tells the invite session about what to do with this redirection. The default value is to accept the redirection. Application can change this to the following validvalues:45 - ''PJSIP_REDIRECT_ACCEPT'': immediately accept the redirection (default value ). The session will immediately resend INVITE request to the target upon return of this callback.44 Action to be performed. The default value is to accept the redirection. Application can change this to one of the following values: 45 - ''PJSIP_REDIRECT_ACCEPT'': immediately accept the redirection (default value upon callback entry). The session will immediately resend INVITE request to the target upon return of this callback. 46 46 - ''PJSIP_REDIRECT_REJECT'': immediately reject this target. The session will continue retrying with next target if present (and it will call this callback again for the next target), or immediately disconnect the call if there is no more target to try (notifying the ''on_state_changed()'' callback as usual). 47 - ''PJSIP_REDIRECT_STOP'': stop the whole redirection process and immediately disconnect the call, regardless on whether there is other target to try or not .48 - ''PJSIP_REDIRECT_PENDING'': set to this value if no decision can be made immediately (for example to request confirmation from user). Application then MUST call ''pjsip_inv_process_redirect()'' (see below) to either accept or reject the redirection upon getting user decision.47 - ''PJSIP_REDIRECT_STOP'': stop the whole redirection process and immediately disconnect the call, regardless on whether there is other target to try or not (notifying the ''on_state_changed()'' callback as usual). 48 - ''PJSIP_REDIRECT_PENDING'': set to this value if no decision can be made immediately (for example to request user approval). Application then MUST call ''pjsip_inv_process_redirect()'' (see below) to either accept or reject the redirection upon getting user decision. 49 49 50 50 ''e'':: … … 72 72 ==== Reject Redirection to This Target ==== 73 73 74 Set the ''cmd'' argument of the callback to ''PJSIP_REDIRECT_REJECT'' to reject the redirection to this target. If there is another target to try, then the callback will be called again with this next target, otherwise the invite session will be disconnected immediately. 74 Set the ''cmd'' argument of the callback to ''PJSIP_REDIRECT_REJECT'' to reject the redirection to this target. If there is another target to try, then the callback will be called again with this next target, otherwise the invite session will be disconnected immediately. 75 75 76 76 77 ==== Stop Redirection ==== … … 86 87 Failure to call {{{pjsip_inv_process_redirect()}}} will cause the invite session to be kept alive indefinitely until the library is shutdown. 87 88 89 When the {{{pjsip_inv_process_redirect()}}} function is called for the next target in the context of this function (that is when this function is called with reject command and next target is selected, hence the callback is called), the event (''e'') argument passed to this function will be passed down to the callback. And similarly when the disconnect callback is called. If NULL is given to the event argument of this function, this function will create a {{{PJSIP_EVENT_USER}}} event with NULL values, to be passed to the callbacks. 90 91 Because of this, application MUST be prepared to handle these type of events in both the {{{on_redirected()}}} and {{{on_state_changed()}}} callbacks. Traditionally only {{{PJSIP_EVENT_TSX_STATE}}} event is passed to {{{on_state_changed()}}} callback. 88 92 89 93 === PJSUA-LIB ===