Changes between Version 7 and Version 8 of SIP_Redirection
- Timestamp:
- Nov 27, 2008 12:51:50 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
SIP_Redirection
v7 v8 25 25 26 26 {{{ 27 void (*on_redirected)(pjsip_inv_session *inv, const pjsip_uri *target, 28 pjsip_redirect_op *cmd, const pjsip_event *e); 27 pjsip_redirect_op (*on_redirected)(pjsip_inv_session *inv, 28 const pjsip_uri *target, 29 const pjsip_event *e); 29 30 }}} 30 31 31 32 Application '''MUST''' implement this callback if it wants the invite session to manage redirection. If this callback is not implemented, the invite session will be disconnected upon receipt of 3xx response. 32 33 33 If this callback is implemented, the default behavior (that is when the callback contains no function body) is to follow the redirection. 34 35 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: 34 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 callback will be called on these events: 36 35 - a 3xx response containing usable Contact header(s) is received 37 36 - 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. … … 45 44 The current target URI to which the INVITE will be sent to. 46 45 47 ''cmd'':: 48 Action to be performed. The default value is to accept the redirection. Application can change this to one of the following values: 46 ''e'':: 47 The event that triggers this callback to be called. This could be of type {{{PJSIP_EVENT_TSX_STATE}}} containing receipt of 3xx, 4xx, or 5xx response, or any other type depending on what is passed to {{{pjsip_inv_process_redirect()}}} below, or of type {{{PJSIP_EVENT_USER}}} if this callback is called by {{{pjsip_inv_process_redirect()}}} below and the event argument to that function is NULL, or NULL. 48 49 The return value specifies the action to be performed, and it must be set to one of the following: 49 50 - ''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. 50 51 - ''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). 51 52 - ''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). 52 53 - ''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. 53 54 ''e''::55 The event that triggers this callback to be called. This could be of type {{{PJSIP_EVENT_TSX_STATE}}} containing receipt of 3xx, 4xx, or 5xx response, or any other type depending on what is passed to {{{pjsip_inv_process_redirect()}}} below, or of type {{{PJSIP_EVENT_USER}}} if this callback is called by {{{pjsip_inv_process_redirect()}}} below and the event argument to that function is NULL, or NULL.56 54 57 55 … … 72 70 ==== Accept Redirection to This Target ==== 73 71 74 Set the ''cmd'' argument of the callback to ''PJSIP_REDIRECT_ACCEPT''to accept the redirection to this target. And INVITE session will be sent immediately to the target.72 Return ''PJSIP_REDIRECT_ACCEPT'' from the callback to accept the redirection to this target. And INVITE session will be sent immediately to the target. 75 73 76 74 ==== Reject Redirection to This Target ==== 77 75 78 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.76 Return ''PJSIP_REDIRECT_REJECT'' from the callback 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. 79 77 80 78 81 79 ==== Stop Redirection ==== 82 80 83 Set the ''cmd'' argument of the callback to ''PJSIP_REDIRECT_STOP''to stop the redirection process and disconnect the call immediately, regardless of whether there are more targets to try.81 Return ''PJSIP_REDIRECT_STOP'' from the callback to stop the redirection process and disconnect the call immediately, regardless of whether there are more targets to try. 84 82 85 83 ==== Defer the Decision ==== 86 84 87 Set the ''cmd'' argument of the callback to ''PJSIP_REDIRECT_PENDING''to tell the invite session that a decision cannot be made that this time (for example to ask for user approval), and the application will notify the invite session about the decision later.85 Return ''PJSIP_REDIRECT_PENDING'' from the callback to tell the invite session that a decision cannot be made that this time (for example to ask for user approval), and the application will notify the invite session about the decision later. 88 86 89 Once the application decides what to do with the redirection, it '''MUST''' call {{{pjsip_inv_process_redirect()}}} function to notify the session about this. It may accept or reject the target, or stop the redirection altogether by setting the appropriate value to the ''cmd'' argument. It must not set ''PJSIP_REDIRECT_PENDING'' to this argument.87 Once the application gets the user approval (or disapproval), it '''MUST''' call {{{pjsip_inv_process_redirect()}}} function to notify the session about the decision. It may accept or reject the target, or stop the redirection altogether by setting the appropriate value to the ''cmd'' argument. It must not set ''PJSIP_REDIRECT_PENDING'' to this argument. 90 88 91 89 Failure to call {{{pjsip_inv_process_redirect()}}} will cause the invite session to be kept alive indefinitely until the library is shutdown. … … 100 98 101 99 {{{ 102 void (*on_call_redirected)(pjsua_call_id call_id, const pjsip_uri *target, 103 pjsip_redirect_op *cmd, const pjsip_event *e); 100 pjsip_redirect_op (*on_call_redirected)(pjsua_call_id call_id, 101 const pjsip_uri *target, 102 const pjsip_event *e); 104 103 105 104 PJ_DECL(pj_status_t) pjsua_call_process_redirect(pjsua_call_id call_id,