Changeset 4313 for pjproject/trunk
- Timestamp:
- Jan 4, 2013 7:37:27 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r4306 r4313 586 586 } 587 587 588 static void med_tp_nego_timer_cb(void *user_data) 589 { 590 pjsua_call *call; 591 unsigned med_idx = (unsigned)(((long)user_data) & 0xFFFF); 592 pjsua_call_media *call_med; 593 pjmedia_transport *tp; 594 pjmedia_transport_info tpinfo; 595 pjmedia_ice_transport_info *ii = NULL; 596 unsigned i; 597 pjsip_dialog *dlg = NULL; 598 599 if ((acquire_call("med_tp_nego_timer_cb", ((long)user_data) >> 16, 600 &call, &dlg) != PJ_SUCCESS) || 601 (med_idx >= call->med_cnt)) 602 { 603 /* Call have been terminated or media has been removed */ 604 return; 605 } 606 607 call_med = &call->media[med_idx]; 608 tp = call_med->tp; 609 610 if (!tp) 611 return; 612 613 /* Send UPDATE if default transport address is different than 614 * what was advertised (ticket #881) 615 */ 616 617 pjmedia_transport_info_init(&tpinfo); 618 pjmedia_transport_get_info(tp, &tpinfo); 619 for (i=0; i<tpinfo.specific_info_cnt; ++i) { 620 if (tpinfo.spc_info[i].type==PJMEDIA_TRANSPORT_TYPE_ICE) { 621 ii = (pjmedia_ice_transport_info*) 622 tpinfo.spc_info[i].buffer; 623 break; 624 } 625 } 626 627 if (ii && ii->role==PJ_ICE_SESS_ROLE_CONTROLLING && 628 pj_sockaddr_cmp(&tpinfo.sock_info.rtp_addr_name, 629 &call_med->rtp_addr)) 630 { 631 pj_bool_t use_update; 632 const pj_str_t STR_UPDATE = { "UPDATE", 6 }; 633 pjsip_dialog_cap_status support_update; 634 pjsip_dialog *dlg; 635 636 dlg = call_med->call->inv->dlg; 637 support_update = pjsip_dlg_remote_has_cap(dlg, PJSIP_H_ALLOW, 638 NULL, &STR_UPDATE); 639 use_update = (support_update == PJSIP_DIALOG_CAP_SUPPORTED); 640 641 PJ_LOG(4,(THIS_FILE, 642 "ICE default transport address has changed for " 643 "call %d, sending %s", 644 call_med->call->index, 645 (use_update ? "UPDATE" : "re-INVITE"))); 646 647 if (use_update) 648 pjsua_call_update(call_med->call->index, 0, NULL); 649 else 650 pjsua_call_reinvite(call_med->call->index, 0, NULL); 651 } 652 653 if (dlg) 654 pjsip_dlg_dec_lock(dlg); 655 } 656 657 588 658 /* This callback is called when ICE negotiation completes */ 589 659 static void on_ice_complete(pjmedia_transport *tp, … … 610 680 } 611 681 } else if (call_med->call) { 612 /* Send UPDATE if default transport address is different than 613 * what was advertised (ticket #881) 614 */ 615 pjmedia_transport_info tpinfo; 616 pjmedia_ice_transport_info *ii = NULL; 617 unsigned i; 618 619 pjmedia_transport_info_init(&tpinfo); 620 pjmedia_transport_get_info(tp, &tpinfo); 621 for (i=0; i<tpinfo.specific_info_cnt; ++i) { 622 if (tpinfo.spc_info[i].type==PJMEDIA_TRANSPORT_TYPE_ICE) { 623 ii = (pjmedia_ice_transport_info*) 624 tpinfo.spc_info[i].buffer; 625 break; 626 } 627 } 628 629 if (ii && ii->role==PJ_ICE_SESS_ROLE_CONTROLLING && 630 pj_sockaddr_cmp(&tpinfo.sock_info.rtp_addr_name, 631 &call_med->rtp_addr)) 632 { 633 pj_bool_t use_update; 634 const pj_str_t STR_UPDATE = { "UPDATE", 6 }; 635 pjsip_dialog_cap_status support_update; 636 pjsip_dialog *dlg; 637 638 dlg = call_med->call->inv->dlg; 639 support_update = pjsip_dlg_remote_has_cap(dlg, PJSIP_H_ALLOW, 640 NULL, &STR_UPDATE); 641 use_update = (support_update == PJSIP_DIALOG_CAP_SUPPORTED); 642 643 PJ_LOG(4,(THIS_FILE, 644 "ICE default transport address has changed for " 645 "call %d, sending %s", 646 call_med->call->index, 647 (use_update ? "UPDATE" : "re-INVITE"))); 648 649 if (use_update) 650 pjsua_call_update(call_med->call->index, 0, NULL); 651 else 652 pjsua_call_reinvite(call_med->call->index, 0, NULL); 653 } 654 } 682 void *data = (void*)(long)( (call_med->call->index<<16) | 683 (call_med->idx & 0xFFFF) ); 684 pjsua_schedule_timer2(&med_tp_nego_timer_cb, data, 1); 685 } 655 686 break; 656 687 case PJ_ICE_STRANS_OP_KEEP_ALIVE:
Note: See TracChangeset
for help on using the changeset viewer.