- Timestamp:
- Jan 8, 2018 4:08:35 AM (7 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/swig/symbols.i
r5677 r5721 172 172 typedef enum pjsua_vid_req_keyframe_method {PJSUA_VID_REQ_KEYFRAME_SIP_INFO = 1, PJSUA_VID_REQ_KEYFRAME_RTCP_PLI = 2} pjsua_vid_req_keyframe_method; 173 173 174 typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, PJSUA_CALL_NO_SDP_OFFER = 8, PJSUA_CALL_REINIT_MEDIA = 16, PJSUA_CALL_UPDATE_VIA = 32 } pjsua_call_flag;174 typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, PJSUA_CALL_NO_SDP_OFFER = 8, PJSUA_CALL_REINIT_MEDIA = 16, PJSUA_CALL_UPDATE_VIA = 32, PJSUA_CALL_UPDATE_TARGET = 64} pjsua_call_flag; 175 175 176 176 typedef enum pjsua_create_media_transport_flag {PJSUA_MED_TP_CLOSE_MEMBER = 1} pjsua_create_media_transport_flag; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r5717 r5721 1985 1985 /** 1986 1986 * Optional remote target URI (i.e. Target header). If NULL, the target 1987 * will be set to the remote URI (To header). At the moment this field 1988 * is only used by #pjsua_call_make_call() and #pjsua_im_send(). 1987 * will be set to the remote URI (To header). This field is used by 1988 * pjsua_call_make_call(), pjsua_im_send(), pjsua_call_reinvite(), 1989 * pjsua_call_set_hold(), and pjsua_call_update(). 1989 1990 */ 1990 1991 pj_str_t target_uri; … … 4640 4641 * been updated (typically with re-registration). 4641 4642 */ 4642 PJSUA_CALL_UPDATE_VIA = 32 4643 PJSUA_CALL_UPDATE_VIA = 32, 4644 4645 /** 4646 * Update dialog target to URI specified in pjsua_msg_data.target_uri. 4647 * This flag is only valid for pjsua_call_set_hold(), 4648 * pjsua_call_reinvite(), and pjsua_call_update(). This flag can be 4649 * useful in IP address change scenario where IP version has been changed 4650 * and application needs to update target IP address. 4651 */ 4652 PJSUA_CALL_UPDATE_TARGET = 64 4643 4653 4644 4654 } pjsua_call_flag; -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r5710 r5721 664 664 } 665 665 } 666 667 668 static pj_status_t dlg_set_target(pjsip_dialog *dlg, const pj_str_t *target) 669 { 670 pjsip_uri *target_uri; 671 pj_str_t tmp; 672 pj_status_t status; 673 674 /* Parse target & verify */ 675 pj_strdup_with_null(dlg->pool, &tmp, target); 676 target_uri = pjsip_parse_uri(dlg->pool, tmp.ptr, tmp.slen, 0); 677 if (!target_uri) { 678 return PJSIP_EINVALIDURI; 679 } 680 if (!PJSIP_URI_SCHEME_IS_SIP(target_uri) && 681 !PJSIP_URI_SCHEME_IS_SIPS(target_uri)) 682 { 683 return PJSIP_EINVALIDSCHEME; 684 } 685 686 /* Add the new target */ 687 status = pjsip_target_set_add_uri(&dlg->target_set, dlg->pool, 688 target_uri, 0); 689 if (status != PJ_SUCCESS) 690 return status; 691 692 /* Set it as current target */ 693 status = pjsip_target_set_set_current(&dlg->target_set, 694 pjsip_target_set_get_next(&dlg->target_set)); 695 if (status != PJ_SUCCESS) 696 return status; 697 698 /* Update dialog target URI */ 699 dlg->target = target_uri; 700 701 return PJ_SUCCESS; 702 } 703 704 705 /* Get account contact for call and update dialog transport */ 706 void call_update_contact(pjsua_call *call, pj_str_t **new_contact) 707 { 708 pjsip_tpselector tp_sel; 709 pjsua_acc *acc = &pjsua_var.acc[call->acc_id]; 710 711 if (acc->cfg.force_contact.slen) 712 *new_contact = &acc->cfg.force_contact; 713 else if (acc->contact.slen) 714 *new_contact = &acc->contact; 715 716 /* When contact is changed, the account transport may have been 717 * changed too, so let's update the dialog's transport too. 718 */ 719 pjsua_init_tpselector(acc->cfg.transport_id, &tp_sel); 720 pjsip_dlg_set_transport(call->inv->dlg, &tp_sel); 721 } 722 723 666 724 667 725 /* … … 2512 2570 pjsua_acc_is_valid(call->acc_id)) 2513 2571 { 2514 new_contact = &pjsua_var.acc[call->acc_id].contact;2572 call_update_contact(call, &new_contact); 2515 2573 } 2516 2574 … … 2519 2577 { 2520 2578 dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]); 2579 } 2580 2581 if ((call->opt.flag & PJSUA_CALL_UPDATE_TARGET) && 2582 msg_data && msg_data->target_uri.slen) 2583 { 2584 status = dlg_set_target(dlg, &msg_data->target_uri); 2585 if (status != PJ_SUCCESS) { 2586 pjsua_perror(THIS_FILE, "Unable to set new target", status); 2587 goto on_return; 2588 } 2521 2589 } 2522 2590 … … 2639 2707 pjsua_acc_is_valid(call->acc_id)) 2640 2708 { 2641 new_contact = &pjsua_var.acc[call->acc_id].contact;2709 call_update_contact(call, &new_contact); 2642 2710 } 2643 2711 … … 2646 2714 { 2647 2715 dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]); 2716 } 2717 2718 if ((call->opt.flag & PJSUA_CALL_UPDATE_TARGET) && 2719 msg_data && msg_data->target_uri.slen) 2720 { 2721 status = dlg_set_target(dlg, &msg_data->target_uri); 2722 if (status != PJ_SUCCESS) { 2723 pjsua_perror(THIS_FILE, "Unable to set new target", status); 2724 goto on_return; 2725 } 2648 2726 } 2649 2727 … … 2757 2835 pjsua_acc_is_valid(call->acc_id)) 2758 2836 { 2759 new_contact = &pjsua_var.acc[call->acc_id].contact;2837 call_update_contact(call, &new_contact); 2760 2838 } 2761 2839 … … 2764 2842 { 2765 2843 dlg_set_via(call->inv->dlg, &pjsua_var.acc[call->acc_id]); 2844 } 2845 2846 if ((call->opt.flag & PJSUA_CALL_UPDATE_TARGET) && 2847 msg_data && msg_data->target_uri.slen) 2848 { 2849 status = dlg_set_target(dlg, &msg_data->target_uri); 2850 if (status != PJ_SUCCESS) { 2851 pjsua_perror(THIS_FILE, "Unable to set new target", status); 2852 goto on_return; 2853 } 2766 2854 } 2767 2855
Note: See TracChangeset
for help on using the changeset viewer.