mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-31 07:34:19 +00:00
rearrange some things please see conf/freeswitch.xml as there is a significant change to the conf that will break your stuff
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1446 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
d314140374
commit
d53d9d3997
7 files changed
+130
-56
No files matched your search
@@ -127,7 +127,6 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_caller_extension_t *extension = NULL;
|
||||
switch_channel_t *channel;
|
||||
char *cf = "extensions.conf";
|
||||
char *exten_name = NULL;
|
||||
switch_xml_t cfg, xml, xcontext, xexten, xaction, xcond;
|
||||
char *context = NULL;
|
||||
@@ -145,10 +144,11 @@ static switch_caller_extension_t *dialplan_hunt(switch_core_session_t *session)
|
||||
caller_profile->destination_number);
|
||||
|
||||
snprintf(params, sizeof(params), "dest=%s", caller_profile->destination_number);
|
||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
|
||||
|
||||
if (switch_xml_locate("dialplan", NULL, NULL, NULL, &xml, &cfg, params) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of dialplan failed\n");
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(xcontext = switch_xml_find_child(cfg, "context", "name", context))) {
|
||||
|
||||
@@ -49,9 +49,11 @@ static struct {
|
||||
uint16_t port;
|
||||
uint8_t running;
|
||||
char *url;
|
||||
char *bindings;
|
||||
} globals;
|
||||
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_url, globals.url)
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_url, globals.url);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings);
|
||||
|
||||
struct config_data {
|
||||
char *name;
|
||||
@@ -79,8 +81,14 @@ static switch_xml_t xml_url_fetch(char *section,
|
||||
struct config_data config_data;
|
||||
switch_xml_t xml = NULL;
|
||||
|
||||
snprintf(url, sizeof(url), "%s?section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s\n",
|
||||
globals.url, section, tag_name, key_name, key_value, params ? "&" : "", params ? params : "");
|
||||
snprintf(url, sizeof(url), "%s?section=%s&tag_name=%s&key_name=%s&&key_value=%s%s%s\n",
|
||||
globals.url,
|
||||
section,
|
||||
tag_name ? tag_name : "",
|
||||
key_name ? key_name : "",
|
||||
key_value ? key_value : "",
|
||||
params ? "&" : "", params ? params : "");
|
||||
|
||||
srand((unsigned int)(time(NULL) + strlen(url)));
|
||||
snprintf(filename, sizeof(filename), "%s%04x.tmp", SWITCH_GLOBAL_dirs.temp_dir, (rand() & 0xffff));
|
||||
curl_handle = curl_easy_init();
|
||||
@@ -142,6 +150,8 @@ static switch_status_t do_config(void)
|
||||
char *val = (char *) switch_xml_attr(param, "value");
|
||||
|
||||
if (!strcasecmp(var, "gateway_url")) {
|
||||
char *bindings = (char *) switch_xml_attr(param, "bindings");
|
||||
set_global_bindings(bindings);
|
||||
set_global_url(val);
|
||||
} else if (!strcasecmp(var, "http_port")) {
|
||||
globals.port = (uint16_t)atoi(val);
|
||||
@@ -167,8 +177,8 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (do_config() == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Fetch Function [%s]\n", globals.url);
|
||||
switch_xml_bind_search_function(xml_url_fetch);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Fetch Function [%s] [%s]\n", globals.url, globals.bindings ? globals.bindings : "all");
|
||||
switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(globals.bindings));
|
||||
}
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
Reference in new issue
Block a user