Ignore:
Timestamp:
Oct 17, 2018 4:38:39 AM (4 years ago)
Author:
nanang
Message:

Close #2158:

  • Added OnCallTransferRequestParam?.newCall to allow application to instantiate a new Call for the new outgoing call in transfer scenario.
  • Also added OnCallReplacedParam?.newCall mainly for informational purpose (that app should instantiate new Call for replace scenario).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5891 r5899  
    11921192    prm.statusCode = *code; 
    11931193    prm.opt.fromPj(*opt); 
     1194    prm.newCall = NULL; 
    11941195     
    11951196    call->onCallTransferRequest(prm); 
     
    11971198    *code = prm.statusCode; 
    11981199    *opt = prm.opt.toPj(); 
     1200    if (*code/100 <= 2) { 
     1201        if (prm.newCall) { 
     1202            /* We don't manage (e.g: create, delete) the call child, 
     1203             * so let's just override any existing child. 
     1204             */ 
     1205            call->child = prm.newCall; 
     1206            call->child->id = PJSUA_INVALID_ID; 
     1207        } else { 
     1208            PJ_LOG(4,(THIS_FILE, 
     1209                      "Warning: application reuses Call instance in " 
     1210                      "call transfer (call ID:%d)", call_id)); 
     1211        } 
     1212    } 
    11991213} 
    12001214 
     
    12551269    OnCallReplacedParam prm; 
    12561270    prm.newCallId = new_call_id; 
     1271    prm.newCall = NULL; 
    12571272     
    12581273    call->onCallReplaced(prm); 
     1274 
     1275    if (prm.newCall) { 
     1276        /* Sanity checks */ 
     1277        pj_assert(prm.newCall->id == new_call_id); 
     1278        pj_assert(prm.newCall->acc.getId() == call->acc.getId()); 
     1279        pj_assert(pjsua_call_get_user_data(new_call_id) == prm.newCall); 
     1280    } else { 
     1281        PJ_LOG(4,(THIS_FILE, 
     1282                  "Warning: application has not created new Call instance " 
     1283                  "for call replace (old call ID:%d, new call ID: %d)", 
     1284                  old_call_id, new_call_id)); 
     1285    } 
    12591286} 
    12601287 
Note: See TracChangeset for help on using the changeset viewer.