From e00144ac5bb469ca5a30df9bb2c93c8487a630d4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Jan 2012 15:00:26 -0600 Subject: [PATCH] add voicemail work tag --- src/mod/applications/mod_httapi/mod_httapi.c | 44 +++++++++++++++++++ .../mod_httapi/mod_httapi_doc.txt | 13 ++++++ 2 files changed, 57 insertions(+) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 8a668bbd80..98aba3ae03 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -238,6 +238,49 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t return SWITCH_STATUS_BREAK; } + +static switch_status_t parse_voicemail(const char *tag_name, client_t *client, switch_xml_t tag, const char *body) +{ + const char *check = switch_xml_attr(tag, "check"); + const char *auth = switch_xml_attr(tag, "auth-only"); + const char *profile = switch_xml_attr(tag, "profile"); + const char *domain = switch_xml_attr(tag, "domain"); + const char *id = switch_xml_attr(tag, "id"); + char *ddom = NULL; + char *str; + switch_status_t status; + + if (zstr(profile)) profile = "default"; + + if (zstr(domain)) { + if ((ddom = switch_core_get_variable_dup("domain"))) { + domain = ddom; + } + } + + if (switch_true(check)) { + check = "check"; + } else { + check = ""; + } + + if (switch_true(auth)) { + auth = "auth_only"; + } else { + auth = ""; + } + + str = switch_core_session_sprintf(client->session, "%s %s %s %s %s", check, auth, profile, domain, id); + + while(*str == ' ') str++; + + status = switch_core_session_execute_application(client->session, "voicemail", str); + + switch_safe_free(ddom); + + return status; +} + static switch_status_t parse_break(const char *tag_name, client_t *client, switch_xml_t tag, const char *body) { return SWITCH_STATUS_FALSE; @@ -2599,6 +2642,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_httapi_load) bind_parser("log", parse_log); bind_parser("continue", parse_continue); bind_parser("setVar", parse_get_var); + bind_parser("voicemail", parse_voicemail); if (do_config() != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; diff --git a/src/mod/applications/mod_httapi/mod_httapi_doc.txt b/src/mod/applications/mod_httapi/mod_httapi_doc.txt index cb5463dca4..92f24409a4 100644 --- a/src/mod/applications/mod_httapi/mod_httapi_doc.txt +++ b/src/mod/applications/mod_httapi/mod_httapi_doc.txt @@ -258,6 +258,19 @@ temp-action : Change url to submit to. just for the next loop. permanent : Add as a permanent param or just once. + + : Get a Channel variable (depends on permissions) + +ATTRS: +action : Change url to submit to. +temp-action : Change url to submit to. just for the next loop. +check : true to check (omit to leave) +auth-only : authenticate only and move on +profile : profile name to use (omit for "default") +domain : domain to use (omit for global domain variable) +id : id to use (omit to prompt for id) + +