From 31a81a8b755a4512390e20c9011c96501ff4cc19 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 23 Oct 2007 03:00:15 +0000 Subject: [PATCH] make outbound invites put transport param in contact when it's tcp git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6025 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 55ac60d8da..adaa52a15e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -560,13 +560,29 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) url = tech_pvt->dest; } + if (switch_strlen_zero(tech_pvt->invite_contact)) { + tech_pvt->invite_contact = tech_pvt->profile->url; + } + + if (switch_stristr("port=tcp", url)) { + char *tmp; + + if (strchr(tech_pvt->invite_contact, ';')) { + tmp = switch_core_session_sprintf(session, "<%s&transport=tcp>", tech_pvt->invite_contact); + } else { + tmp = switch_core_session_sprintf(session, "<%s;transport=tcp>", tech_pvt->invite_contact); + } + assert(tmp); + tech_pvt->invite_contact = tmp; + } + + tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url), SIPTAG_TO_STR(tech_pvt->dest_to), TAG_IF(tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->gateway_from_str)), TAG_IF(!tech_pvt->gateway_from_str, SIPTAG_FROM_STR(tech_pvt->from_str)), - TAG_IF(tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->invite_contact)), - TAG_IF(!tech_pvt->invite_contact, SIPTAG_CONTACT_STR(tech_pvt->profile->url)), + SIPTAG_CONTACT_STR(tech_pvt->invite_contact), TAG_END()); switch_safe_free(d_url);