[Freeswitch-svn] [commit] r2314 - freeswitch/trunk/src
Freeswitch SVN
anthm at freeswitch.org
Wed Aug 16 23:18:51 EDT 2006
Author: anthm
Date: Wed Aug 16 23:18:51 2006
New Revision: 2314
Modified:
freeswitch/trunk/src/switch_ivr.c
Log:
ok,
now in the key portion you can say 'exec' and in the file portion say '<application> <args>'
if the channel is not hungup when that application ends it's the winner so you can
run an ivr on the channels to determine who gets the call
<extension name="3002">
<condition field="destination_number" expression="^3002$">
<action application="set" data="call_timeout=60"/>
<action application="set" data="group_confirm_key=exec"/>
<action application="set" data="group_confirm_file=javascript test.js"/>
<action application="bridge" data="exosip/1000 at domain.com&exosip/1001 at mydomain.com"/>
</condition>
</extension>
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Wed Aug 16 23:18:51 2006
@@ -1154,6 +1154,41 @@
char buf[10] = "";
char *p, term;
+
+ if (!strcasecmp(collect->key, "exec")) {
+ char *data;
+ const switch_application_interface_t *application_interface;
+ char *app_name, *app_data;
+
+ if (!(data = collect->file)) {
+ goto wbreak;
+ }
+
+ app_name = data;
+
+ if ((app_data = strchr(app_name, ' '))) {
+ *app_data++ = '\0';
+ }
+
+ if ((application_interface = switch_loadable_module_get_application_interface(app_name)) == 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", app_name);
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ goto wbreak;
+ }
+
+ if (!application_interface->application_function) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", app_name);
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ goto wbreak;
+ }
+
+ application_interface->application_function(collect->session, app_data);
+ if (switch_channel_get_state(channel) < CS_HANGUP) {
+ switch_channel_set_flag(channel, CF_WINNER);
+ }
+ goto wbreak;
+ }
+
while(switch_channel_ready(channel)) {
memset(buf, 0, sizeof(buf));
More information about the Freeswitch-svn
mailing list