Changeset 2371


Ignore:
Timestamp:
Nov 27, 2008 12:42:07 PM (15 years ago)
Author:
bennylp
Message:

More ticket #10: changed to signature of the redirection callbacks to make it more natural to use

Location:
pjproject/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r2370 r2371  
    23942394 * Redirection handler. 
    23952395 */ 
    2396 static void call_on_redirected(pjsua_call_id call_id, const pjsip_uri *target, 
    2397                                pjsip_redirect_op *cmd, const pjsip_event *e) 
    2398 { 
    2399     *cmd = app_config.redir_op; 
    2400  
     2396static pjsip_redirect_op call_on_redirected(pjsua_call_id call_id,  
     2397                                            const pjsip_uri *target, 
     2398                                            const pjsip_event *e) 
     2399{ 
    24012400    PJ_UNUSED_ARG(e); 
    24022401 
    2403     if (*cmd == PJSIP_REDIRECT_PENDING) { 
     2402    if (app_config.redir_op == PJSIP_REDIRECT_PENDING) { 
    24042403        char uristr[PJSIP_MAX_URL_SIZE]; 
    24052404        int len; 
     
    24162415                  call_id, len, uristr)); 
    24172416    } 
     2417 
     2418    return app_config.redir_op; 
    24182419} 
    24192420 
  • pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h

    r2370 r2371  
    231231     * @param inv       The invite session. 
    232232     * @param target    The current target to be tried. 
    233      * @param cmd       Action to be performed for the target. Set this 
     233     * @param e         The event that caused this callback to be called. 
     234     *                  This could be the receipt of 3xx response, or 
     235     *                  4xx/5xx response received for the INVITE sent to 
     236     *                  subsequent targets, or NULL if this callback is 
     237     *                  called from within #pjsip_inv_process_redirect() 
     238     *                  context. 
     239     * 
     240     * @return          Action to be performed for the target. Set this 
    234241     *                  parameter to one of the value below: 
    235242     *                  - PJSIP_REDIRECT_ACCEPT: immediately accept the 
    236      *                    redirection (default value). When set, the 
     243     *                    redirection to this target. When set, the 
    237244     *                    session will immediately resend INVITE request 
    238      *                    to the target. 
     245     *                    to the target after this callback returns. 
    239246     *                  - PJSIP_REDIRECT_REJECT: immediately reject this 
    240247     *                    target. The session will continue retrying with 
     
    252259     *                    to either accept or reject the redirection upon 
    253260     *                    getting user decision. 
    254      * @param e         The event that caused this callback to be called. 
    255      *                  This could be the receipt of 3xx response, or 
    256      *                  4xx/5xx response received for the INVITE sent to 
    257      *                  subsequent targets, or NULL if this callback is 
    258      *                  called from within #pjsip_inv_process_redirect() 
    259      *                  context. 
    260      */ 
    261     void (*on_redirected)(pjsip_inv_session *inv, const pjsip_uri *target, 
    262                           pjsip_redirect_op *cmd, const pjsip_event *e); 
     261     */ 
     262    pjsip_redirect_op (*on_redirected)(pjsip_inv_session *inv,  
     263                                       const pjsip_uri *target, 
     264                                       const pjsip_event *e); 
    263265 
    264266} pjsip_inv_callback; 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r2370 r2371  
    10801080     * @param call_id   The call ID. 
    10811081     * @param target    The current target to be tried. 
    1082      * @param cmd       Action to be performed for the target. Set this 
     1082     * @param e         The event that caused this callback to be called. 
     1083     *                  This could be the receipt of 3xx response, or 
     1084     *                  4xx/5xx response received for the INVITE sent to 
     1085     *                  subsequent targets, or NULL if this callback is 
     1086     *                  called from within #pjsua_call_process_redirect() 
     1087     *                  context. 
     1088     * 
     1089     * @return          Action to be performed for the target. Set this 
    10831090     *                  parameter to one of the value below: 
    10841091     *                  - PJSIP_REDIRECT_ACCEPT: immediately accept the 
     
    11011108     *                    to either accept or reject the redirection upon 
    11021109     *                    getting user decision. 
    1103      * @param e         The event that caused this callback to be called. 
    1104      *                  This could be the receipt of 3xx response, or 
    1105      *                  4xx/5xx response received for the INVITE sent to 
    1106      *                  subsequent targets, or NULL if this callback is 
    1107      *                  called from within #pjsua_call_process_redirect() 
    1108      *                  context. 
    1109      */ 
    1110     void (*on_call_redirected)(pjsua_call_id call_id, const pjsip_uri *target, 
    1111                                pjsip_redirect_op *cmd, const pjsip_event *e); 
     1110     */ 
     1111    pjsip_redirect_op (*on_call_redirected)(pjsua_call_id call_id,  
     1112                                            const pjsip_uri *target, 
     1113                                            const pjsip_event *e); 
    11121114 
    11131115} pjsua_callback; 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r2370 r2371  
    19381938                                 const pj_str_t *reason, pjsip_event *e) 
    19391939{ 
    1940     pjsip_redirect_op op = PJSIP_REDIRECT_ACCEPT; 
     1940    pjsip_redirect_op op; 
    19411941    pjsip_target *target; 
    19421942 
     
    19811981    pjsip_target_set_set_current(&inv->dlg->target_set, target); 
    19821982 
    1983     (*mod_inv.cb.on_redirected)(inv, target->uri, &op, e); 
     1983    op = (*mod_inv.cb.on_redirected)(inv, target->uri, e); 
    19841984 
    19851985 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r2370 r2371  
    6969 * Redirection handler. 
    7070 */ 
    71 static void pjsua_call_on_redirected(pjsip_inv_session *inv,  
    72                                      const pjsip_uri *target, 
    73                                      pjsip_redirect_op *cmd,  
    74                                      const pjsip_event *e); 
     71static pjsip_redirect_op pjsua_call_on_redirected(pjsip_inv_session *inv, 
     72                                                  const pjsip_uri *target, 
     73                                                  const pjsip_event *e); 
    7574 
    7675 
     
    38153814 
    38163815/* Redirection handler */ 
    3817 static void pjsua_call_on_redirected(pjsip_inv_session *inv,  
    3818                                      const pjsip_uri *target, 
    3819                                      pjsip_redirect_op *cmd,  
    3820                                      const pjsip_event *e) 
     3816static pjsip_redirect_op pjsua_call_on_redirected(pjsip_inv_session *inv, 
     3817                                                  const pjsip_uri *target, 
     3818                                                  const pjsip_event *e) 
    38213819{ 
    38223820    pjsua_call *call = (pjsua_call*) inv->dlg->mod_data[pjsua_var.mod.id]; 
     3821    pjsip_redirect_op op; 
    38233822 
    38243823    PJSUA_LOCK(); 
    38253824 
    38263825    if (pjsua_var.ua_cfg.cb.on_call_redirected) { 
    3827         (*pjsua_var.ua_cfg.cb.on_call_redirected)(call->index, target, cmd, e); 
     3826        op = (*pjsua_var.ua_cfg.cb.on_call_redirected)(call->index,  
     3827                                                         target, e); 
    38283828    } else { 
    38293829        PJ_LOG(4,(THIS_FILE, "Unhandled redirection for call %d " 
     
    38313831                  "call.", 
    38323832                  call->index)); 
    3833         *cmd = PJSIP_REDIRECT_STOP; 
     3833        op = PJSIP_REDIRECT_STOP; 
    38343834    } 
    38353835 
    38363836    PJSUA_UNLOCK(); 
    3837 } 
    3838  
     3837 
     3838    return op; 
     3839} 
     3840 
Note: See TracChangeset for help on using the changeset viewer.