From a8751d15ce3d7fadf0964eee3c0e4aeae33f67ab Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Wed, 19 Jun 2013 08:53:17 -0400 Subject: [PATCH 1/3] mod_rayo: allow variables to be passed in dialstring --- src/mod/event_handlers/mod_rayo/mod_rayo.c | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index ad4e988105..31625241c1 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -1838,6 +1838,7 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void * iks *response = NULL; const char *dcp_jid = iks_find_attrib(iq, "from"); const char *dial_to = iks_find_attrib(dial, "to"); + char *dial_to_dup = NULL; const char *dial_from = iks_find_attrib(dial, "from"); const char *dial_timeout_ms = iks_find_attrib(dial, "timeout"); struct dial_gateway *gateway = NULL; @@ -1855,6 +1856,24 @@ static void *SWITCH_THREAD_FUNC rayo_dial_thread(switch_thread_t *thread, void * stream.write_function(&stream, "{origination_uuid=%s,rayo_dcp_jid=%s,rayo_call_jid=%s", rayo_call_get_uuid(call), dcp_jid, RAYO_JID(call)); + /* parse optional params from dialstring and append to */ + if (*dial_to == '{') { + switch_event_t *params = NULL; + dial_to_dup = strdup(dial_to); + switch_event_create_brackets(dial_to_dup, '{', '}', ',', ¶ms, (char **)&dial_to, SWITCH_FALSE); + if (params) { + switch_event_header_t *param; + for(param = params->headers; param; param = param->next) { + if (strchr(param->value, ',')) { + stream.write_function(&stream, ",%s=\\'%s\\'", param->name, param->value); + } else { + stream.write_function(&stream, ",%s=%s", param->name, param->value); + } + } + switch_event_destroy(¶ms); + } + } + /* set originate channel variables */ if (!zstr(dial_from)) { /* caller ID */ @@ -1976,6 +1995,7 @@ done: iks_delete(dial); switch_safe_free(stream.data); + switch_safe_free(dial_to_dup); return NULL; } @@ -1993,8 +2013,13 @@ static iks *on_rayo_dial(struct rayo_actor *client, struct rayo_actor *server, i switch_threadattr_t *thd_attr = NULL; iks *dial = iks_find(node, "dial"); iks *response = NULL; + const char *dial_to = iks_find_attrib(dial, "to"); - if (!zstr(iks_find_attrib(dial, "to"))) { + if (zstr(dial_to)) { + response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "missing dial to attribute"); + } else if (strchr(dial_to, ' ')) { + response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "malformed dial string"); + } else { iks *node_dup = iks_copy(node); iks_insert_attrib(node_dup, "from", RAYO_JID(rclient)); /* save DCP jid in case it isn't specified */ @@ -2003,8 +2028,6 @@ static iks *on_rayo_dial(struct rayo_actor *client, struct rayo_actor *server, i switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&thread, thd_attr, rayo_dial_thread, node_dup, RAYO_POOL(rclient)); - } else { - response = iks_new_error_detailed(node, STANZA_ERROR_BAD_REQUEST, "missing dial to attribute"); } return response; From b4ba31dad6e2d159fc4a2ebd9a9ebcd44fcd426c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 19 Jun 2013 10:44:31 -0500 Subject: [PATCH 2/3] more trivial compiler warnings for windows --- src/switch_ivr_async.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index a3cb808ec0..b945c542ab 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1056,7 +1056,7 @@ static switch_bool_t is_silence_frame(switch_frame_t *frame, int silence_thresho energy += abs(fdata[j]); j += codec_impl->number_of_channels; } - is_silence &= (uint32_t) (energy / (samples / divisor)) < silence_threshold; + is_silence &= (uint32_t) ((energy / (samples / divisor)) < silence_threshold); } return is_silence; @@ -1259,7 +1259,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s rh->silence_time = switch_micro_time_now(); } else { /* continuing silence */ - int duration_ms = (switch_micro_time_now() - rh->silence_time) / 1000; + int duration_ms = (int)((switch_micro_time_now() - rh->silence_time) / 1000); if (rh->silence_timeout_ms > 0 && duration_ms >= rh->silence_timeout_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Recording file %s timeout: %i >= %i\n", rh->file, duration_ms, rh->silence_timeout_ms); switch_core_media_bug_set_flag(bug, SMBF_PRUNE); From 59a082c091449142accc353879a7c161ea65cdc2 Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Wed, 19 Jun 2013 11:27:31 -0500 Subject: [PATCH 3/3] tweak rpm spec file --- freeswitch.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 4e77fc5e4a..0e638daf66 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1766,6 +1766,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/switch.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/syslog.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/timezones.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unimrcp.conf.xml @@ -2373,6 +2374,8 @@ fi # ###################################################################################################################### %changelog +* Thu June 19 2013 - krice@freeswitch.org +- tweak files included for vanilla configs * Thu Sep 19 2012 - krice@freeswitch.org - Add support for Spanish and Portugese say language modules * Thu Jan 26 2012 - krice@freeswitch.org