summaryrefslogtreecommitdiff
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2009-06-01 20:57:31 +0000
committerMark Michelson <mmichelson@digium.com>2009-06-01 20:57:31 +0000
commit298d745fb4cf56cfe76cf89d4d5ae4dcb134d2bd (patch)
tree22c7cb967cc375a45f8cabb0f6c6998b7b5f674a /apps/app_dial.c
parent0fb1700522fb5eac568c2144fb714cc3563b392f (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: https://origsvn.digium.com/svn/asterisk/trunk@198727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 249c0dcb8..92000abde 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -937,7 +937,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_verb(3, "%s answered %s\n", c->name, in->name);
if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
if (o->connected.id.number) {
- ast_channel_update_connected_line(in, &o->connected);
+ if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+ ast_channel_update_connected_line(in, &o->connected);
+ }
} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
ast_channel_lock(c);
ast_connected_line_copy_from_caller(&connected_caller, &c->cid);
@@ -987,7 +989,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_verb(3, "%s answered %s\n", c->name, in->name);
if (!single && !ast_test_flag64(peerflags, OPT_IGNORE_CONNECTEDLINE)) {
if (o->connected.id.number) {
- ast_channel_update_connected_line(in, &o->connected);
+ if (ast_channel_connected_line_macro(c, in, &o->connected, 1, 0)) {
+ ast_channel_update_connected_line(in, &o->connected);
+ }
} else if (!ast_test_flag64(o, DIAL_NOCONNECTEDLINE)) {
ast_channel_lock(c);
ast_connected_line_copy_from_caller(&connected_caller, &c->cid);
@@ -1076,8 +1080,9 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
ast_party_connected_line_set(&o->connected, &connected);
ast_party_connected_line_free(&connected);
} else {
- ast_verb(3, "%s connected line has changed, passing it to %s\n", c->name, in->name);
- ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+ if (ast_channel_connected_line_macro(c, in, f, 1, 1)) {
+ ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
+ }
}
break;
case AST_CONTROL_REDIRECTING:
@@ -1198,15 +1203,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
if (ast_write(outgoing->chan, f))
ast_log(LOG_WARNING, "Unable to forward voice or dtmf\n");
}
- if (single && (f->frametype == AST_FRAME_CONTROL) &&
- ((f->subclass == AST_CONTROL_HOLD) ||
- (f->subclass == AST_CONTROL_UNHOLD) ||
- (f->subclass == AST_CONTROL_VIDUPDATE) ||
- (f->subclass == AST_CONTROL_SRCUPDATE) ||
- (f->subclass == AST_CONTROL_CONNECTED_LINE) ||
- (f->subclass == AST_CONTROL_REDIRECTING))) {
- ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
- ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+ if (single && (f->frametype == AST_FRAME_CONTROL)) {
+ if ((f->subclass == AST_CONTROL_HOLD) ||
+ (f->subclass == AST_CONTROL_UNHOLD) ||
+ (f->subclass == AST_CONTROL_VIDUPDATE) ||
+ (f->subclass == AST_CONTROL_SRCUPDATE) ||
+ (f->subclass == AST_CONTROL_REDIRECTING)) {
+ ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
+ ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+ } else if (f->subclass == AST_CONTROL_CONNECTED_LINE) {
+ if (ast_channel_connected_line_macro(in, outgoing->chan, f, 0, 1)) {
+ ast_indicate_data(outgoing->chan, f->subclass, f->data.ptr, f->datalen);
+ }
+ }
}
ast_frfree(f);
}