add uuid_early_ok

This commit is contained in:
Anthony Minessale 2012-08-30 16:51:06 -05:00 committed by Ken Rice
parent 62ce2970c5
commit d31a738bc5
3 changed files with 22 additions and 0 deletions

View File

@ -1242,6 +1242,7 @@ typedef enum {
CF_TRACKED, CF_TRACKED,
CF_TRACKABLE, CF_TRACKABLE,
CF_NO_CDR, CF_NO_CDR,
CF_EARLY_OK,
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* 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() */ /* 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 CF_FLAG_MAX

View File

@ -2738,6 +2738,21 @@ SWITCH_STANDARD_API(uuid_media_function)
return SWITCH_STATUS_SUCCESS; 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) 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_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, "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, "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, "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_answer", "answer", uuid_answer_function, "<uuid>");
SWITCH_ADD_API(commands_api_interface, "uuid_audio", "uuid_audio", session_audio_function, AUDIO_SYNTAX); 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_dump ::console::list_uuid");
switch_console_set_complete("add uuid_answer ::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_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_exists ::console::list_uuid");
switch_console_set_complete("add uuid_fileman ::console::list_uuid"); switch_console_set_complete("add uuid_fileman ::console::list_uuid");
switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid");

View 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); 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) || 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) || switch_channel_test_flag(originate_status[i].peer_channel, CF_REDIRECT) ||