Changeset 3841 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
- Timestamp:
- Oct 24, 2011 9:28:13 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk
- Property svn:mergeinfo changed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r3796 r3841 972 972 options |= PJSIP_INV_SUPPORT_100REL; 973 973 options |= PJSIP_INV_SUPPORT_TIMER; 974 if (pjsua_var.acc[acc_id].cfg.require_100rel )974 if (pjsua_var.acc[acc_id].cfg.require_100rel == PJSUA_100REL_MANDATORY) 975 975 options |= PJSIP_INV_REQUIRE_100REL; 976 976 if (pjsua_var.media_cfg.enable_ice) … … 1046 1046 { 1047 1047 options &= ~(PJSIP_INV_SUPPORT_TIMER); 1048 } 1049 1050 /* If 100rel is optional and UAC supports it, use it. */ 1051 if ((options & PJSIP_INV_REQUIRE_100REL)==0 && 1052 pjsua_var.acc[acc_id].cfg.require_100rel == PJSUA_100REL_OPTIONAL) 1053 { 1054 const pj_str_t token = { "100rel", 6}; 1055 pjsip_dialog_cap_status cap_status; 1056 1057 cap_status = pjsip_dlg_remote_has_cap(dlg, PJSIP_H_SUPPORTED, NULL, 1058 &token); 1059 if (cap_status == PJSIP_DIALOG_CAP_SUPPORTED) 1060 options |= PJSIP_INV_REQUIRE_100REL; 1048 1061 } 1049 1062 … … 1289 1302 1290 1303 pj_gettimeofday(&time_start); 1304 timeout.sec = 0; 1291 1305 timeout.msec = PJSUA_ACQUIRE_CALL_TIMEOUT; 1292 1306 pj_time_val_normalize(&timeout); … … 1357 1371 { 1358 1372 pjsua_call *call; 1359 pjsua_conf_port_id port_id; 1360 pjsip_dialog *dlg; 1361 pj_status_t status; 1373 pjsua_conf_port_id port_id = PJSUA_INVALID_ID; 1362 1374 1363 1375 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, 1364 1376 PJ_EINVAL); 1365 1377 1366 status = acquire_call("pjsua_call_get_conf_port()", call_id, &call, &dlg); 1367 if (status != PJ_SUCCESS) 1368 return PJSUA_INVALID_ID; 1369 1378 /* Use PJSUA_LOCK() instead of acquire_call(): 1379 * https://trac.pjsip.org/repos/ticket/1371 1380 */ 1381 PJSUA_LOCK(); 1382 1383 if (!pjsua_call_is_active(call_id)) 1384 goto on_return; 1385 1386 call = &pjsua_var.calls[call_id]; 1370 1387 port_id = call->media[call->audio_idx].strm.a.conf_slot; 1371 1388 1372 pjsip_dlg_dec_lock(dlg); 1389 on_return: 1390 PJSUA_UNLOCK(); 1373 1391 1374 1392 return port_id; … … 1384 1402 { 1385 1403 pjsua_call *call; 1386 pjsip_dialog *dlg;1387 1404 unsigned mi; 1388 pj_status_t status;1389 1405 1390 1406 PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls, … … 1393 1409 pj_bzero(info, sizeof(*info)); 1394 1410 1395 status = acquire_call("pjsua_call_get_info()", call_id, &call, &dlg); 1396 if (status != PJ_SUCCESS) { 1397 return status; 1411 /* Use PJSUA_LOCK() instead of acquire_call(): 1412 * https://trac.pjsip.org/repos/ticket/1371 1413 */ 1414 PJSUA_LOCK(); 1415 1416 call = &pjsua_var.calls[call_id]; 1417 1418 if (!call->inv) { 1419 PJSUA_UNLOCK(); 1420 return PJSIP_ESESSIONTERMINATED; 1398 1421 } 1399 1422 … … 1521 1544 } 1522 1545 1523 pjsip_dlg_dec_lock(dlg);1546 PJSUA_UNLOCK(); 1524 1547 1525 1548 return PJ_SUCCESS; … … 1962 1985 pjsua_process_msg_data( tdata, msg_data); 1963 1986 1987 /* Record the tx_data to keep track the operation */ 1988 call->hold_msg = (void*) tdata; 1989 1964 1990 /* Send the request */ 1965 1991 status = pjsip_inv_send_msg( call->inv, tdata); 1966 1992 if (status != PJ_SUCCESS) { 1967 1993 pjsua_perror(THIS_FILE, "Unable to send re-INVITE", status); 1994 call->hold_msg = NULL; 1968 1995 goto on_return; 1969 1996 } … … 2532 2559 pj_log_push_indent(); 2533 2560 2534 PJSUA_LOCK(); 2561 // This may deadlock, see https://trac.pjsip.org/repos/ticket/1305 2562 //PJSUA_LOCK(); 2535 2563 2536 2564 for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { … … 2539 2567 } 2540 2568 2541 PJSUA_UNLOCK();2569 //PJSUA_UNLOCK(); 2542 2570 pj_log_pop_indent(); 2543 2571 } … … 3972 4000 } 3973 4001 } 4002 } else if (tsx->role == PJSIP_ROLE_UAC && 4003 tsx->last_tx == (pjsip_tx_data*)call->hold_msg && 4004 tsx->state >= PJSIP_TSX_STATE_COMPLETED) 4005 { 4006 /* Monitor the status of call hold request */ 4007 call->hold_msg = NULL; 4008 if (tsx->status_code/100 != 2) { 4009 /* Outgoing call hold failed */ 4010 call->local_hold = PJ_FALSE; 4011 PJ_LOG(3,(THIS_FILE, "Error putting call %d on hold (reason=%d)", 4012 call->index, tsx->status_code)); 4013 } 3974 4014 } 3975 4015 3976 4016 on_return: 4017 3977 4018 PJSUA_UNLOCK(); 3978 4019 pj_log_pop_indent();
Note: See TracChangeset
for help on using the changeset viewer.