Author: anthm Date: Wed Oct 17 23:04:48 2007 New Revision: 5959 Modified: freeswitch/trunk/conf/directory.xml freeswitch/trunk/conf/sofia.conf.xml freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Log: add contact-params Modified: freeswitch/trunk/conf/directory.xml ============================================================================== --- freeswitch/trunk/conf/directory.xml (original) +++ freeswitch/trunk/conf/directory.xml Wed Oct 17 23:04:48 2007 @@ -29,6 +29,8 @@ <!--<param name="retry_seconds" value="30"/>--> <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway --> <!--<param name="caller-id-in-from" value="false"/>--> + <!--extra sip params to send in the contact--> + <!--<param name="contact-params" value="tport=tcp"/>--> <!--</gateway>--> </gateways> <params> Modified: freeswitch/trunk/conf/sofia.conf.xml ============================================================================== --- freeswitch/trunk/conf/sofia.conf.xml (original) +++ freeswitch/trunk/conf/sofia.conf.xml Wed Oct 17 23:04:48 2007 @@ -32,6 +32,8 @@ <!--<param name="retry_seconds" value="30"/>--> <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway --> <!--<param name="caller-id-in-from" value="false"/>--> + <!--extra sip params to send in the contact--> + <!--<param name="contact-params" value="tport=tcp"/>--> <!--</gateway>--> </gateways> Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Wed Oct 17 23:04:48 2007 @@ -551,7 +551,9 @@ *expire_seconds = "3600", *retry_seconds = "30", *from_domain = "", - *register_proxy = NULL; + *register_proxy = NULL, + *contact_params = NULL, + *params = NULL; gateway->pool = profile->pool; gateway->profile = profile; @@ -589,6 +591,8 @@ from_domain = val; } else if (!strcmp(var, "register-proxy")) { register_proxy = val; + } else if (!strcmp(var, "contact-params")) { + contact_params = val; } } @@ -639,10 +643,21 @@ if (switch_true(caller_id_in_from)) { switch_set_flag(gateway, REG_FLAG_CALLERID); } + if (contact_params) { + if (*contact_params == ';') { + params = contact_params; + } else { + params = switch_core_sprintf(gateway->pool, ";%s", contact_params); + } + } else { + params = ""; + } + + gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", register_proxy); gateway->register_from = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, from_domain); - gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d", extension, - profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port); + gateway->register_contact = switch_core_sprintf(gateway->pool, "sip:%s@%s:%d%s", extension, + profile->extsipip ? profile->extsipip : profile->sipip, profile->sip_port, params); if (!strncasecmp(proxy, "sip:", 4)) {