]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
set gateway name in params too
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 16 Oct 2009 19:51:32 +0000 (19:51 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 16 Oct 2009 19:51:32 +0000 (19:51 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15172 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index 58016e85bbddfe46e823b80f20f8bb067957c586..4d03bcda28e44ec242adf70ee44e352fd300d140 100644 (file)
@@ -1600,12 +1600,12 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
 
                        if (contact_params) {
                                if (*contact_params == ';') {
-                                       params = switch_core_sprintf(gateway->pool, "%s;transport=%s", contact_params, register_transport);
+                                       params = switch_core_sprintf(gateway->pool, "%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
                                } else {
-                                       params = switch_core_sprintf(gateway->pool, ";%s;transport=%s", contact_params, register_transport);
+                                       params = switch_core_sprintf(gateway->pool, ";%s;transport=%s;gw=%s", contact_params, register_transport, gateway->name);
                                }
                        } else {
-                               params = switch_core_sprintf(gateway->pool, ";transport=%s", register_transport);
+                               params = switch_core_sprintf(gateway->pool, ";transport=%s;gw=%s", register_transport, gateway->name);
                        }
 
                        if (!switch_strlen_zero(from_domain)) {
@@ -4823,6 +4823,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
        char *is_nat = NULL;
        char acl_token[512] = "";
        sofia_transport_t transport;
+       const char *gw_name = NULL;
 
        profile->ib_calls++;
 
@@ -5390,9 +5391,16 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
                free(tmp);
        }
 
+       
+       if (sip->sip_request->rq_url->url_params) {
+               gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw=");
+       }
 
        if (strstr(destination_number, "gw+")) {
-               const char *gw_name = destination_number + 3;
+               gw_name = destination_number + 3;
+       }
+
+       if (gw_name) {
                sofia_gateway_t *gateway;
                if (gw_name && (gateway = sofia_reg_find_gateway(gw_name))) {
                        context = switch_core_session_strdup(session, gateway->register_context);