Ignore:
Timestamp:
Sep 24, 2008 10:10:15 AM (16 years ago)
Author:
bennylp
Message:

Ticket #635: Disconnect the other call leg when multiple 2xx/OK responses to INVITE are received due to forking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r2301 r2315  
    29442944 
    29452945/* 
     2946 * Callback from UA layer when forked dialog response is received. 
     2947 */ 
     2948pjsip_dialog* on_dlg_forked(pjsip_dialog *dlg, pjsip_rx_data *res) 
     2949{ 
     2950    if (dlg->uac_has_2xx &&  
     2951        res->msg_info.cseq->method.id == PJSIP_INVITE_METHOD && 
     2952        pjsip_rdata_get_tsx(res) == NULL && 
     2953        res->msg_info.msg->line.status.code/100 == 2)  
     2954    { 
     2955        pjsip_dialog *forked_dlg; 
     2956        pjsip_tx_data *bye; 
     2957        pj_status_t status; 
     2958 
     2959        /* Create forked dialog */ 
     2960        status = pjsip_dlg_fork(dlg, res, &forked_dlg); 
     2961        if (status != PJ_SUCCESS) 
     2962            return NULL; 
     2963 
     2964        pjsip_dlg_inc_lock(forked_dlg); 
     2965 
     2966        /* Disconnect the call */ 
     2967        status = pjsip_dlg_create_request(forked_dlg, &pjsip_bye_method, 
     2968                                          -1, &bye); 
     2969        if (status == PJ_SUCCESS) { 
     2970            status = pjsip_dlg_send_request(forked_dlg, bye, -1, NULL); 
     2971        } 
     2972 
     2973        pjsip_dlg_dec_lock(forked_dlg); 
     2974 
     2975        if (status != PJ_SUCCESS) { 
     2976            return NULL; 
     2977        } 
     2978 
     2979        return forked_dlg; 
     2980 
     2981    } else { 
     2982        return dlg; 
     2983    } 
     2984} 
     2985 
     2986/* 
    29462987 * Disconnect call upon error. 
    29472988 */ 
Note: See TracChangeset for help on using the changeset viewer.