aboutsummaryrefslogtreecommitdiffstats
path: root/main/app.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-01 20:57:31 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-01 20:57:31 +0000
commitce47d41510edcdf1f7d36852350df02afc5f6014 (patch)
tree22c7cb967cc375a45f8cabb0f6c6998b7b5f674a /main/app.c
parentd79b32623f5a7917a0e2feef2cc14ef894104431 (diff)
Add the ability to execute connected line interception macros.
When connected line updates are received or generated in the middle of an application call, it is now possible to execute a macro to manipulate the connected line data. This way, phone numbers may be manipulated to be more presentable to users, names may be changed for...whatever reason, or whatever else needs to be done may be. Review: https://reviewboard.asterisk.org/r/256 AST-165 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@198727 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r--main/app.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/main/app.c b/main/app.c
index 72af3e085..eacefabd0 100644
--- a/main/app.c
+++ b/main/app.c
@@ -203,6 +203,28 @@ int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int
return res;
}
+int ast_app_run_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const char * const macro_name, const char * const macro_args)
+{
+ struct ast_app *macro_app;
+ int res;
+ char buf[1024];
+
+ macro_app = pbx_findapp("Macro");
+ if (!macro_app) {
+ ast_log(LOG_WARNING, "Cannot run macro '%s' because the 'Macro' application in not available\n", macro_name);
+ return -1;
+ }
+ snprintf(buf, sizeof(buf), "%s%s%s", macro_name, ast_strlen_zero(macro_args) ? "" : ",", S_OR(macro_args, ""));
+ if (autoservice_chan) {
+ ast_autoservice_start(autoservice_chan);
+ }
+ res = pbx_exec(macro_chan, macro_app, buf);
+ if (autoservice_chan) {
+ ast_autoservice_stop(autoservice_chan);
+ }
+ return res;
+}
+
static int (*ast_has_voicemail_func)(const char *mailbox, const char *folder) = NULL;
static int (*ast_inboxcount_func)(const char *mailbox, int *newmsgs, int *oldmsgs) = NULL;
static int (*ast_inboxcount2_func)(const char *mailbox, int *urgentmsgs, int *newmsgs, int *oldmsgs) = NULL;