From 41c1c1cb75ff3eda08e85cbcab9153af2bb64d2c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 27 Jun 2013 16:25:59 -0500 Subject: [PATCH] add answer work tag to httapi --- .../mod_httapi/docs/mod_httapi_doc.txt | 6 ++++++ src/mod/applications/mod_httapi/mod_httapi.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) 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 f659db39af..399ea1a335 100644 --- a/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt +++ b/src/mod/applications/mod_httapi/docs/mod_httapi_doc.txt @@ -230,6 +230,12 @@ action : Change url to submit to. temp-action : Change url to submit to. just for the next loop. + + : Answer the call + +ATTRS: +is-conference : true|false (set the conference flag for RFC4579 stuff. + : Hangup the call diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 005f66bdbd..8b76f36101 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -877,6 +877,19 @@ static switch_status_t parse_hangup(const char *tag_name, client_t *client, swit return SWITCH_STATUS_FALSE; } +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); + } + + switch_channel_answer(client->channel); + + return SWITCH_STATUS_FALSE; +} + static switch_status_t parse_record_call(const char *tag_name, client_t *client, switch_xml_t tag, const char *body) { const char *limit_ = switch_xml_attr(tag, "limit"); @@ -2997,6 +3010,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) bind_parser("sms", parse_sms); bind_parser("dial", parse_dial); bind_parser("pause", parse_playback); + bind_parser("answer", parse_answer); bind_parser("hangup", parse_hangup); bind_parser("record", parse_record); bind_parser("recordCall", parse_record_call);