Changeset 4229 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
- Timestamp:
- Aug 13, 2012 9:15:39 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r4186 r4229 865 865 } 866 866 867 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) 867 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) { 868 868 pjsip_dlg_set_via_sent_by(dlg, &acc->via_addr, acc->via_tp); 869 } else if (!pjsua_sip_acc_is_using_stun(acc_id)) { 870 /* Choose local interface to use in Via if acc is not using 871 * STUN. See https://trac.pjsip.org/repos/ticket/1412 872 */ 873 char target_buf[PJSIP_MAX_URL_SIZE]; 874 pj_str_t target; 875 pjsip_host_port via_addr; 876 const void *via_tp; 877 878 target.ptr = target_buf; 879 target.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, 880 dlg->target, 881 target_buf, sizeof(target_buf)); 882 if (target.slen < 0) target.slen = 0; 883 884 if (pjsua_acc_get_uac_addr(acc_id, dlg->pool, &target, 885 &via_addr, NULL, NULL, 886 &via_tp) == PJ_SUCCESS) 887 { 888 pjsip_dlg_set_via_sent_by(dlg, &via_addr, (void*)via_tp); 889 } 890 } 869 891 870 892 /* Set credentials and preference. */ … … 1237 1259 pjsip_publishc_set_via_sent_by(acc->publish_sess, &acc->via_addr, 1238 1260 acc->via_tp); 1261 } else if (!pjsua_sip_acc_is_using_stun(acc_id)) { 1262 /* Choose local interface to use in Via if acc is not using 1263 * STUN. See https://trac.pjsip.org/repos/ticket/1412 1264 */ 1265 pjsip_host_port via_addr; 1266 const void *via_tp; 1267 1268 if (pjsua_acc_get_uac_addr(acc_id, acc->pool, &acc_cfg->id, 1269 &via_addr, NULL, NULL, 1270 &via_tp) == PJ_SUCCESS) 1271 { 1272 pjsip_publishc_set_via_sent_by(acc->publish_sess, &via_addr, 1273 (void*)via_tp); 1274 } 1239 1275 } 1240 1276 … … 1790 1826 pjsip_dlg_inc_lock(buddy->dlg); 1791 1827 1792 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) 1828 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) { 1793 1829 pjsip_dlg_set_via_sent_by(buddy->dlg, &acc->via_addr, acc->via_tp); 1830 } else if (!pjsua_sip_acc_is_using_stun(acc_id)) { 1831 /* Choose local interface to use in Via if acc is not using 1832 * STUN. See https://trac.pjsip.org/repos/ticket/1412 1833 */ 1834 pjsip_host_port via_addr; 1835 const void *via_tp; 1836 1837 if (pjsua_acc_get_uac_addr(acc_id, buddy->dlg->pool, &buddy->uri, 1838 &via_addr, NULL, NULL, 1839 &via_tp) == PJ_SUCCESS) 1840 { 1841 pjsip_dlg_set_via_sent_by(buddy->dlg, &via_addr, (void*)via_tp); 1842 } 1843 } 1844 1794 1845 1795 1846 status = pjsip_pres_create_uac( buddy->dlg, &pres_callback, … … 2115 2166 pjsip_dlg_inc_lock(acc->mwi_dlg); 2116 2167 2117 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) 2168 if (acc->cfg.allow_via_rewrite && acc->via_addr.host.slen > 0) { 2118 2169 pjsip_dlg_set_via_sent_by(acc->mwi_dlg, &acc->via_addr, acc->via_tp); 2170 } else if (!pjsua_sip_acc_is_using_stun(acc_id)) { 2171 /* Choose local interface to use in Via if acc is not using 2172 * STUN. See https://trac.pjsip.org/repos/ticket/1412 2173 */ 2174 pjsip_host_port via_addr; 2175 const void *via_tp; 2176 2177 if (pjsua_acc_get_uac_addr(acc_id, acc->mwi_dlg->pool, &acc->cfg.id, 2178 &via_addr, NULL, NULL, 2179 &via_tp) == PJ_SUCCESS) 2180 { 2181 pjsip_dlg_set_via_sent_by(acc->mwi_dlg, &via_addr, 2182 (void*)via_tp); 2183 } 2184 } 2119 2185 2120 2186 /* Create UAC subscription */
Note: See TracChangeset
for help on using the changeset viewer.