Merge pull request #1784 in FS/freeswitch from ~INFOMIND/freeswitch:feature/FS-11977-mod_signalwire-add-configuration-param-override-context to master

* commit '263a83bf7c54481a1da2f09ae27cd5ea3368db68':
  FS-11977 [mod_signalwire] add configuration param override-context
This commit is contained in:
Christopher Rienzo 2019-08-04 08:30:27 -05:00
commit 54d957f12d
2 changed files with 10 additions and 0 deletions

View File

@ -6,5 +6,7 @@
<!--param name="adoption-service" value="https://adopt.signalwire.com/adoption"/-->
<!--param name="stun-server" value="stun.freeswitch.org"/-->
<!-- <authentication></authentication> -->
<!-- override dialplan context for calls on connector -->
<!--<param name="override-context" value="signalwire"/>-->
</settings>
</configuration>

View File

@ -76,6 +76,7 @@ static struct {
char adoption_service[1024];
char stun_server[1024];
char adoption_token[64];
char override_context[64];
ks_size_t adoption_backoff;
ks_time_t adoption_next;
@ -657,6 +658,8 @@ static switch_status_t load_config()
switch_set_string(globals.stun_server, val);
} else if (!strcasecmp(var, "ssl-verify")) {
globals.ssl_verify = switch_true(val) ? 1 : 0;
} else if (!strcasecmp(var, "override-context") && !ks_zstr(val)) {
switch_set_string(globals.override_context, val);
}
}
if ((tmp = switch_xml_child(settings, "authentication"))) {
@ -749,6 +752,11 @@ SWITCH_STANDARD_DIALPLAN(dialplan_hunt)
}
}
if (globals.override_context[0] != '\0') {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Overriding dialplan context from %s to %s\n",caller_profile->context,globals.override_context);
caller_profile->context = globals.override_context;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Processing %s <%s>->%s in context %s\n",
caller_profile->caller_id_name, caller_profile->caller_id_number, caller_profile->destination_number, caller_profile->context);