Changeset 4300 for pjproject


Ignore:
Timestamp:
Nov 26, 2012 2:04:17 AM (12 years ago)
Author:
ming
Message:

Fixes #1595: Allow call hangup immediately after outgoing call

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h

    r4219 r4300  
    171171            struct { 
    172172                pjsua_msg_data  *msg_data;/**< Headers for outgoing INVITE. */ 
     173                pj_bool_t        hangup;  /**< Call is hangup?              */ 
    173174            } out_call; 
    174175            struct { 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r4280 r4300  
    389389    } 
    390390 
    391     /* pjsua_media_channel_deinit() has been called. */ 
    392     if (call->async_call.med_ch_deinit) 
     391    /* pjsua_media_channel_deinit() has been called or 
     392     * call has been hung up. 
     393     */ 
     394    if (call->async_call.med_ch_deinit || 
     395        call->async_call.call_var.out_call.hangup) 
     396    { 
     397        PJ_LOG(4,(THIS_FILE, "Call has been hung up or media channel has " 
     398                             "been deinitialized")); 
    393399        goto on_error; 
     400    } 
    394401 
    395402    /* Create offer */ 
     
    488495 
    489496    /* Done. */ 
     497    call->med_ch_cb = NULL; 
    490498 
    491499    pjsip_dlg_dec_lock(dlg); 
     
    514522        pjsua_media_channel_deinit(call_id); 
    515523    } 
     524 
     525    call->med_ch_cb = NULL; 
     526 
     527    pjsua_check_snd_dev_idle(); 
    516528 
    517529    PJSUA_UNLOCK(); 
     
    21452157    if (status != PJ_SUCCESS) 
    21462158        goto on_return; 
     2159 
     2160    /* If media transport creation is not yet completed, we will hangup 
     2161     * the call in the media transport creation callback instead. 
     2162     */ 
     2163    if (call->med_ch_cb) { 
     2164        PJ_LOG(4,(THIS_FILE, "Pending call %d hangup upon completion " 
     2165                             "of media transport", call_id)); 
     2166        call->async_call.call_var.out_call.hangup = PJ_TRUE; 
     2167        if (code == 0) 
     2168            call->last_code = PJSIP_SC_REQUEST_TERMINATED; 
     2169        else 
     2170            call->last_code = code; 
     2171        if (reason) { 
     2172            pj_strncpy(&call->last_text, reason, 
     2173                       sizeof(call->last_text_buf_)); 
     2174        } 
     2175         
     2176        goto on_return; 
     2177    } 
    21472178 
    21482179    if (code==0) { 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_dump.c

    r4254 r4300  
    889889    int len; 
    890890    pjsip_inv_session *inv = pjsua_var.calls[call_id].inv; 
    891     pjsip_dialog *dlg = inv->dlg; 
     891    pjsip_dialog *dlg; 
    892892    char userinfo[128]; 
    893893 
    894894    /* Dump invite sesion info. */ 
    895895 
     896    dlg = (inv? inv->dlg: pjsua_var.calls[call_id].async_call.dlg); 
    896897    len = pjsip_hdr_print_on(dlg->remote.info, userinfo, sizeof(userinfo)); 
    897898    if (len < 0) 
     
    902903    len = pj_ansi_snprintf(buf, size, "%s[%s] %s", 
    903904                           title, 
    904                            pjsip_inv_state_name(inv->state), 
     905                           pjsip_inv_state_name(inv? inv->state: 
     906                                                PJSIP_INV_STATE_DISCONNECTED), 
    905907                           userinfo); 
    906908    if (len < 1 || len >= (int)size) { 
Note: See TracChangeset for help on using the changeset viewer.