add preAnswer and ringReady too

This commit is contained in:
Anthony Minessale 2013-06-27 16:31:29 -05:00
parent 41c1c1cb75
commit 2ea31f5d95
2 changed files with 21 additions and 5 deletions

View File

@ -237,6 +237,13 @@ ATTRS:
is-conference : true|false (set the conference flag for RFC4579 stuff.
<preAnswer>
: Establish media on the call without answering.
<ringReady>
: Indicate ringing to an unaswered channel.
<hangup cause action>
: Hangup the call

View File

@ -879,14 +879,21 @@ static switch_status_t parse_hangup(const char *tag_name, client_t *client, swit
static switch_status_t parse_answer(const char *tag_name, client_t *client, switch_xml_t tag, const char *body)
{
const char *conf = switch_xml_attr(tag, "is-conference");
if (conf && switch_true(conf)) {
switch_channel_set_flag(client->channel, CF_CONFERENCE);
if (!strcasecmp(tag_name, "answer")) {
const char *conf = switch_xml_attr(tag, "is-conference");
if (conf && switch_true(conf)) {
switch_channel_set_flag(client->channel, CF_CONFERENCE);
}
switch_channel_answer(client->channel);
} else if (!strcasecmp(tag_name, "preAnswer")) {
switch_channel_pre_answer(client->channel);
} else if (!strcasecmp(tag_name, "ringReady")) {
switch_channel_ring_ready(client->channel);
}
switch_channel_answer(client->channel);
return SWITCH_STATUS_FALSE;
}
@ -3011,6 +3018,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load)
bind_parser("dial", parse_dial);
bind_parser("pause", parse_playback);
bind_parser("answer", parse_answer);
bind_parser("preAnswer", parse_answer);
bind_parser("ringReady", parse_answer);
bind_parser("hangup", parse_hangup);
bind_parser("record", parse_record);
bind_parser("recordCall", parse_record_call);