Changeset 5323


Ignore:
Timestamp:
May 27, 2016 2:55:12 AM (8 years ago)
Author:
riza
Message:

Re #1923: Delay call-hangup triggered from simulated onIncomingCall() to avoid assertion.

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

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

    r5307 r5323  
    173173                pj_bool_t        hangup;  /**< Call is hangup?              */ 
    174174            } out_call; 
    175             struct { 
     175            struct {             
    176176                call_answer      answers;/**< A list of call answers.       */ 
     177                pj_bool_t        hangup;/**< Call is hangup?                */ 
    177178                pjsip_dialog    *replaced_dlg; /**< Replaced dialog.        */ 
    178179            } inc_call; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5317 r5323  
    16381638            /* onIncomingCall() may be simulated by onCreateMediaTransport() 
    16391639             * when media init is done synchrounously (see #1916). And if app 
    1640              * happens to answer the call from the callback, the answer should 
    1641              * have been delayed (see #1923), so let's process the answer now. 
     1640             * happens to answer/hangup the call from the callback, the  
     1641             * answer/hangup should have been delayed (see #1923),  
     1642             * so let's process the answer/hangup now. 
    16421643             */ 
    1643             if (call->med_ch_cb == NULL) 
     1644            if (call->async_call.call_var.inc_call.hangup) { 
     1645                pjsua_call_hangup(call_id, call->last_code, &call->last_text, 
     1646                                  NULL); 
     1647            } else if (call->med_ch_cb == NULL) { 
    16441648                process_pending_call_answer(call); 
     1649            } 
    16451650        } else { 
    16461651            pjsua_call_hangup(call_id, PJSIP_SC_TEMPORARILY_UNAVAILABLE, 
     
    23372342     * the call in the media transport creation callback instead. 
    23382343     */ 
    2339     if (call->med_ch_cb && !call->inv) { 
     2344    if ((call->med_ch_cb && !call->inv) || 
     2345        ((call->inv != NULL) && (call->inv->state == PJSIP_INV_STATE_NULL))) 
     2346    { 
    23402347        PJ_LOG(4,(THIS_FILE, "Pending call %d hangup upon completion " 
    23412348                             "of media transport", call_id)); 
    2342         call->async_call.call_var.out_call.hangup = PJ_TRUE; 
     2349 
     2350        if (call->inv->role == PJSIP_ROLE_UAS) 
     2351            call->async_call.call_var.inc_call.hangup = PJ_TRUE; 
     2352        else 
     2353            call->async_call.call_var.out_call.hangup = PJ_TRUE; 
     2354 
    23432355        if (code == 0) 
    23442356            call->last_code = PJSIP_SC_REQUEST_TERMINATED; 
Note: See TracChangeset for help on using the changeset viewer.