]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5497 add sofia gateway parameter destination-prefix in case you need to send Invit...
authorstangor <stangor1@gmail.com>
Fri, 15 Aug 2014 00:28:14 +0000 (17:28 -0700)
committerstangor <stangor1@gmail.com>
Fri, 15 Aug 2014 00:28:14 +0000 (17:28 -0700)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 0dca2d700f598c3271462a629a006d4efedc325e..33f4e0f855a0b2934f07a4ad27e92f7de4a54726 100644 (file)
@@ -4319,9 +4319,9 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                }
 
                if (!strchr(dest, '@')) {
-                       tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, sofia_glue_strip_proto(gateway_ptr->register_proxy));
+                       tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s@%s", gateway_ptr->destination_prefix, dest, sofia_glue_strip_proto(gateway_ptr->register_proxy));
                } else {
-                       tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s", dest);
+                       tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s", gateway_ptr->destination_prefix, dest);
                }
 
                if ((host = switch_core_session_strdup(nsession, tech_pvt->dest))) {
index da9c2c412289154b1331d866f500b7ebd3c6001f..577ff07bbc8282f4f431412f3daef90a746b89b8 100644 (file)
@@ -478,6 +478,7 @@ struct sofia_gateway {
        char *register_context;
        char *expires_str;
        char *register_url;
+       char *destination_prefix;
        char *from_domain;
        sofia_transport_t register_transport;
        uint32_t freq;
index befca00ab1bc36fa6129f20c70f711af2f3a42da..79339e97812ff2f4528815480d7c5b099438d376 100644 (file)
@@ -3315,6 +3315,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                        gateway->ob_calls = 0;
                        gateway->ib_failed_calls = 0;
                        gateway->ob_failed_calls = 0;
+                       gateway->destination_prefix = "";
 
                        if ((x_params = switch_xml_child(gateway_tag, "variables"))) {
                                param = switch_xml_child(x_params, "variable");
@@ -3416,6 +3417,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
                                        outbound_proxy = val;
                                } else if (!strcmp(var, "distinct-to")) {
                                        distinct_to = switch_true(val);
+                               } else if (!strcmp(var, "destination-prefix")) {
+                                       if (!zstr(val)) {
+                                               gateway->destination_prefix = switch_core_strdup(gateway->pool, val);
+                                       }
                                } else if (!strcmp(var, "rfc-5626")) {
                                        rfc_5626 = switch_true(val);
                                } else if (!strcmp(var, "reg-id")) {