From 2ea31f5d95859d0dad34e56791e0d76f6eacd4b6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 27 Jun 2013 16:31:29 -0500 Subject: [PATCH] add preAnswer and ringReady too --- .../mod_httapi/docs/mod_httapi_doc.txt | 7 +++++++ src/mod/applications/mod_httapi/mod_httapi.c | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt b/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt index 399ea1a335..b313dc5e15 100644 --- a/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt +++ b/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt @@ -237,6 +237,13 @@ ATTRS: is-conference : true|false (set the conference flag for RFC4579 stuff. + + : Establish media on the call without answering. + + + : Indicate ringing to an unaswered channel. + + : Hangup the call diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 8b76f36101..52e4a21a6b 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -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);