move code from uuid_kill into core
This commit is contained in:
parent
babe955160
commit
3c9551ee90
|
@ -934,6 +934,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *se
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_create_message_reply(switch_event_t **reply, switch_event_t *message, const char *new_proto);
|
||||
SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name, const char *domain_name);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
|
|
@ -2128,7 +2128,6 @@ SWITCH_STANDARD_API(reload_xml_function)
|
|||
#define KILL_SYNTAX "<uuid> [cause]"
|
||||
SWITCH_STANDARD_API(kill_function)
|
||||
{
|
||||
switch_core_session_t *ksession = NULL;
|
||||
char *mycmd = NULL, *kcause = NULL;
|
||||
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
|
||||
|
||||
|
@ -2139,17 +2138,14 @@ SWITCH_STANDARD_API(kill_function)
|
|||
|
||||
if ((kcause = strchr(mycmd, ' '))) {
|
||||
*kcause++ = '\0';
|
||||
}
|
||||
|
||||
if (zstr(mycmd) || !(ksession = switch_core_session_locate(mycmd))) {
|
||||
stream->write_function(stream, "-ERR No Such Channel!\n");
|
||||
} else {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(ksession);
|
||||
if (!zstr(kcause)) {
|
||||
cause = switch_channel_str2cause(kcause);
|
||||
}
|
||||
switch_channel_hangup(channel, cause);
|
||||
switch_core_session_rwunlock(ksession);
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_ivr_kill_uuid(mycmd, cause) != SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "-ERR No Such Channel!\n");
|
||||
} else {
|
||||
stream->write_function(stream, "+OK\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -3201,6 +3201,20 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
|
|||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause)
|
||||
{
|
||||
switch_core_session_t *session;
|
||||
|
||||
if (zstr(uuid) || !(session = switch_core_session_locate(uuid))) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_channel_hangup(channel, cause);
|
||||
switch_core_session_rwunlock(session);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
|
|
Loading…
Reference in New Issue