Changeset 5288 for pjproject


Ignore:
Timestamp:
May 10, 2016 2:58:41 PM (8 years ago)
Author:
riza
Message:

Fixed #1914: onCreateMediaTransport() callback might not be called on PJSUA2.

Location:
pjproject/trunk/pjsip
Files:
3 edited

Legend:

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

    r5273 r5288  
    190190    pj_bool_t            reinv_pending;/**< Pending until CONFIRMED state.  */ 
    191191    pj_bool_t            reinv_ice_sent;/**< Has reinvite for ICE upd sent? */ 
     192    pjsip_rx_data       *incoming_data;/**< Cloned incoming call rdata. 
     193                                            On pjsua2, when handling incoming  
     194                                            call, onCreateMediaTransport() will 
     195                                            not be called since the call isn't 
     196                                            created yet. This temporary  
     197                                            variable is used to handle such  
     198                                            case, see ticket #1916.         */ 
    192199}; 
    193200 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r5252 r5288  
    11011101    pjsip_inv_session *inv = NULL; 
    11021102    int acc_id; 
    1103     pjsua_call *call; 
     1103    pjsua_call *call = NULL; 
    11041104    int call_id = -1; 
    11051105    int sip_err_code = PJSIP_SC_INTERNAL_SERVER_ERROR; 
     
    12221222            goto on_return; 
    12231223        } 
     1224    } 
     1225 
     1226    if (!replaced_dlg) { 
     1227        /* Clone rdata. */ 
     1228        pjsip_rx_data_clone(rdata, 0, &call->incoming_data); 
    12241229    } 
    12251230 
     
    16371642    if (dlg) { 
    16381643        pjsip_dlg_dec_lock(dlg); 
     1644    } 
     1645 
     1646    if (call && call->incoming_data) { 
     1647        pjsip_rx_data_free_cloned(call->incoming_data); 
     1648        call->incoming_data = NULL; 
    16391649    } 
    16401650     
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5287 r5288  
    603603    } 
    604604 
     605    pjsua_call *call = &pjsua_var.calls[call_id]; 
     606    if (!call->incoming_data) { 
     607        /* This happens when the incoming call callback has been called from  
     608         * inside the on_create_media_transport() callback. So we simply  
     609         * return here to avoid calling the callback twice.  
     610         */ 
     611        return; 
     612    } 
     613 
    605614    /* call callback */ 
    606615    OnIncomingCallParam prm; 
     
    609618 
    610619    acc->onIncomingCall(prm); 
     620 
     621    /* Free cloned rdata. */ 
     622    pjsip_rx_data_free_cloned(call->incoming_data); 
     623    call->incoming_data = NULL; 
    611624 
    612625    /* disconnect if callback doesn't handle the call */ 
     
    12261239    Call *call = Call::lookup(call_id); 
    12271240    if (!call) { 
    1228         return base_tp; 
     1241        pjsua_call *in_call = &pjsua_var.calls[call_id]; 
     1242        if (in_call->incoming_data) { 
     1243            /* This can happen when there is an incoming call but the 
     1244             * on_incoming_call() callback hasn't been called. So we need to  
     1245             * call the callback here. 
     1246             */ 
     1247            on_incoming_call(in_call->acc_id, call_id, in_call->incoming_data); 
     1248 
     1249            /* New call should already be created by app. */ 
     1250            call = Call::lookup(call_id); 
     1251            if (!call) { 
     1252                return base_tp; 
     1253            } 
     1254        } else { 
     1255            return base_tp; 
     1256        } 
    12291257    } 
    12301258     
Note: See TracChangeset for help on using the changeset viewer.