]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add ctrix's patch
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 5 Jun 2008 20:45:03 +0000 (20:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 5 Jun 2008 20:45:03 +0000 (20:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8774 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/switch_channel.c

index bfe5adde70aec109d6b65d8f697691ac110638b6..baa8271b2f1d931c7c975012148497f657af356d 100644 (file)
@@ -102,6 +102,7 @@ SWITCH_BEGIN_EXTERN_C
 #define SWITCH_URL_SEPARATOR "://"
 #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
 #define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
+#define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring"
 #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout"
 #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
 #define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
index c670e7b9d3af400d3522fabfc3391dd2b61539e5..5a469b867065e96e557e6fa93ab68343cfdc1c36 100644 (file)
@@ -1369,6 +1369,9 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
 
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_channel_t *channel, const char *file, const char *func, int line)
 {
+       const char *var;
+       char *app;
+
        if (!switch_channel_test_flag(channel, CF_RING_READY)) {
                switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
                switch_channel_set_flag(channel, CF_RING_READY);
@@ -1377,6 +1380,18 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_ch
                        channel->caller_profile->times->progress = switch_timestamp_now();
                        switch_mutex_unlock(channel->profile_mutex);
                }
+
+               var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE);
+               if (var) {
+                       char *arg = NULL;
+                       app = switch_core_session_strdup(channel->session, var);
+                       if ((arg = strchr(app, ' '))) {
+                               *arg++ = '\0';
+                       }
+                       switch_core_session_execute_application(channel->session, app, arg);
+               }
+
+
                return SWITCH_STATUS_SUCCESS;
        }