]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
ok,
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 Aug 2006 03:18:51 +0000 (03:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 17 Aug 2006 03:18:51 +0000 (03:18 +0000)
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@domain.com&exosip/1001@mydomain.com"/>
        </condition>
      </extension>

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2314 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr.c

index e114cbf7892e0f415e1de5a7e6d465dee57e10e0..1d4cbb32aa9d71ec8ac9bfe836e9676fd012bb14 100644 (file)
@@ -1154,6 +1154,41 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void
        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));