- Timestamp:
- Dec 28, 2016 3:40:07 AM (8 years ago)
- Location:
- pjproject/branches/projects/uwp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/uwp
- Property svn:mergeinfo changed
/pjproject/trunk (added) merged: 5209,5212-5234,5237-5253,5255,5257-5292,5294-5297,5299-5332,5334-5394,5396-5438,5440-5469,5471-5496,5498-5510
- Property svn:mergeinfo changed
-
pjproject/branches/projects/uwp/pjsip/src/pjsua2/endpoint.cpp
r5204 r5513 46 46 47 47 UaConfig::UaConfig() 48 : mainThreadOnly(false) 48 49 { 49 50 pjsua_config ua_cfg; … … 490 491 entry.level = level; 491 492 entry.msg = string(data, len); 492 entry.threadId = (long) pj_thread_this();493 entry.threadId = (long)(size_t)pj_thread_this(); 493 494 entry.threadName = string(pj_thread_get_name(pj_thread_this())); 494 495 … … 602 603 } 603 604 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 604 614 /* call callback */ 605 615 OnIncomingCallParam prm; … … 608 618 609 619 acc->onIncomingCall(prm); 620 621 /* Free cloned rdata. */ 622 pjsip_rx_data_free_cloned(call->incoming_data); 623 call->incoming_data = NULL; 610 624 611 625 /* disconnect if callback doesn't handle the call */ … … 816 830 } 817 831 832 void Endpoint::on_acc_find_for_incoming(const pjsip_rx_data *rdata, 833 pjsua_acc_id* acc_id) 834 { 835 OnSelectAccountParam prm; 836 837 pj_assert(rdata && acc_id); 838 prm.rdata.fromPj(*((pjsip_rx_data *)rdata)); 839 prm.accountIndex = *acc_id; 840 841 instance_->onSelectAccount(prm); 842 843 *acc_id = prm.accountIndex; 844 } 845 818 846 void Endpoint::on_buddy_state(pjsua_buddy_id buddy_id) 819 847 { … … 894 922 /* Check if application modifies the SDP */ 895 923 if (orig_sdp != prm.sdp.wholeSdp) { 896 pjmedia_sdp_parse(pool, (char*)prm.sdp.wholeSdp.c_str(), 897 prm.sdp.wholeSdp.size(), &sdp); 924 pjmedia_sdp_session *new_sdp; 925 pj_str_t dup_new_sdp; 926 pj_str_t new_sdp_str = {(char*)prm.sdp.wholeSdp.c_str(), 927 (pj_ssize_t)prm.sdp.wholeSdp.size()}; 928 929 pj_strdup(pool, &dup_new_sdp, &new_sdp_str); 930 pjmedia_sdp_parse(pool, dup_new_sdp.ptr, 931 dup_new_sdp.slen, &new_sdp); 932 pj_memcpy(sdp, new_sdp, sizeof(*sdp)); 898 933 } 899 934 } … … 1204 1239 Call *call = Call::lookup(call_id); 1205 1240 if (!call) { 1206 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 } 1207 1257 } 1208 1258 … … 1215 1265 1216 1266 return (pjmedia_transport *)prm.mediaTp; 1267 } 1268 1269 void Endpoint::on_create_media_transport_srtp(pjsua_call_id call_id, 1270 unsigned media_idx, 1271 pjmedia_srtp_setting *srtp_opt) 1272 { 1273 Call *call = Call::lookup(call_id); 1274 if (!call) { 1275 pjsua_call *in_call = &pjsua_var.calls[call_id]; 1276 if (in_call->incoming_data) { 1277 /* This can happen when there is an incoming call but the 1278 * on_incoming_call() callback hasn't been called. So we need to 1279 * call the callback here. 1280 */ 1281 on_incoming_call(in_call->acc_id, call_id, in_call->incoming_data); 1282 1283 /* New call should already be created by app. */ 1284 call = Call::lookup(call_id); 1285 if (!call) { 1286 return; 1287 } 1288 } else { 1289 return; 1290 } 1291 } 1292 1293 OnCreateMediaTransportSrtpParam prm; 1294 prm.mediaIdx = media_idx; 1295 prm.srtpUse = srtp_opt->use; 1296 for (unsigned i = 0; i < srtp_opt->crypto_count; i++) { 1297 SrtpCrypto crypto; 1298 1299 crypto.key = pj2Str(srtp_opt->crypto[i].key); 1300 crypto.name = pj2Str(srtp_opt->crypto[i].name); 1301 crypto.flags = srtp_opt->crypto[i].flags; 1302 prm.cryptos.push_back(crypto); 1303 } 1304 1305 call->onCreateMediaTransportSrtp(prm); 1306 1307 srtp_opt->use = prm.srtpUse; 1308 srtp_opt->crypto_count = prm.cryptos.size(); 1309 for (unsigned i = 0; i < srtp_opt->crypto_count; i++) { 1310 srtp_opt->crypto[i].key = str2Pj(prm.cryptos[i].key); 1311 srtp_opt->crypto[i].name = str2Pj(prm.cryptos[i].name); 1312 srtp_opt->crypto[i].flags = prm.cryptos[i].flags; 1313 } 1217 1314 } 1218 1315 … … 1278 1375 ua_cfg.cb.on_mwi_info = &Endpoint::on_mwi_info; 1279 1376 ua_cfg.cb.on_buddy_state = &Endpoint::on_buddy_state; 1377 ua_cfg.cb.on_acc_find_for_incoming = &Endpoint::on_acc_find_for_incoming; 1280 1378 1281 1379 /* Call callbacks */ … … 1511 1609 } 1512 1610 1611 void Endpoint::natUpdateStunServers(const StringVector &servers, 1612 bool wait) throw(Error) 1613 { 1614 pj_str_t srv[MAX_STUN_SERVERS]; 1615 unsigned i, count = 0; 1616 1617 for (i=0; i<servers.size() && i<MAX_STUN_SERVERS; ++i) { 1618 srv[count].ptr = (char*)servers[i].c_str(); 1619 srv[count].slen = servers[i].size(); 1620 ++count; 1621 } 1622 1623 PJSUA2_CHECK_EXPR(pjsua_update_stun_servers(count, srv, wait) ); 1624 } 1625 1513 1626 void Endpoint::natCheckStunServers(const StringVector &servers, 1514 1627 bool wait,
Note: See TracChangeset
for help on using the changeset viewer.