]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add uuid_early_ok
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Aug 2012 21:51:06 +0000 (16:51 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Aug 2012 21:51:06 +0000 (16:51 -0500)
src/include/switch_types.h
src/mod/applications/mod_commands/mod_commands.c
src/switch_ivr_originate.c

index 690f9f5bde1cc7cc636a73fba47e42a8dcd55e13..5c6ec620b6d953d5dd359fa4ad0369982c480e1e 100644 (file)
@@ -1242,6 +1242,7 @@ typedef enum {
        CF_TRACKED,
        CF_TRACKABLE,
        CF_NO_CDR,
+       CF_EARLY_OK,
        /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
        /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
        CF_FLAG_MAX
index d199899e9e481c0004164dfc82f449f6b38807a1..c0dc16a7deaf197ca145910b6236efc31aebb3a6 100644 (file)
@@ -2738,6 +2738,21 @@ SWITCH_STANDARD_API(uuid_media_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(uuid_early_ok_function)
+{
+       char *uuid = (char *) cmd;
+       switch_core_session_t *xsession;
+
+       if (uuid && (xsession = switch_core_session_locate(uuid))) {
+               switch_channel_t *channel = switch_core_session_get_channel(xsession);
+               switch_channel_set_flag(channel, CF_EARLY_OK);
+               switch_core_session_rwunlock(xsession);
+       } else {
+               stream->write_function(stream, "-ERROR\n");
+       }
+
+       return SWITCH_STATUS_SUCCESS;
+}
 
 SWITCH_STANDARD_API(uuid_pre_answer_function)
 {
@@ -5603,6 +5618,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>");
        SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>");
        SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param|attr] <name>");
+       SWITCH_ADD_API(commands_api_interface, "uuid_early_ok", "stop ignoring early media", uuid_early_ok_function, "<uuid>");
        SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user> <domain>");
        SWITCH_ADD_API(commands_api_interface, "uuid_answer", "answer", uuid_answer_function, "<uuid>");
        SWITCH_ADD_API(commands_api_interface, "uuid_audio", "uuid_audio", session_audio_function, AUDIO_SYNTAX);
@@ -5757,6 +5773,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
        switch_console_set_complete("add uuid_dump ::console::list_uuid");
        switch_console_set_complete("add uuid_answer ::console::list_uuid");
        switch_console_set_complete("add uuid_pre_answer ::console::list_uuid");
+       switch_console_set_complete("add uuid_early_ok ::console::list_uuid");
        switch_console_set_complete("add uuid_exists ::console::list_uuid");
        switch_console_set_complete("add uuid_fileman ::console::list_uuid");
        switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid");
index b9975ee6de0db8c2d7e07a369682dc587d75c6f4..52e83f388d6219deb4bead6d6f03466f14286d5f 100644 (file)
@@ -694,6 +694,10 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat
                        }
                }
 
+               if (!oglobals->early_ok && switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_OK)) {
+                       oglobals->early_ok = 1;
+               }
+
                state = switch_channel_get_state(originate_status[i].peer_channel);
                if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) ||
                        switch_channel_test_flag(originate_status[i].peer_channel, CF_REDIRECT) ||