aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-02 20:35:25 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-02 20:35:25 +0000
commit91a29e3b8abb81a1f669445bd211c4191d5850c3 (patch)
tree2d470130492c0a6a05afe1e6602a0750dc30d22f /apps/app_dial.c
parent530a1cef13f1d19c6e822d2cca136212fd3053c3 (diff)
Add new 'p' flag to Dial for preserve callerid (bug #3490)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4954 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rwxr-xr-xapps/app_dial.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 2e8264753..98522abab 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -71,6 +71,8 @@ static char *descrip =
" making/redirecting the outgoing call. For example, some PSTNs\n"
" don't allow callerids from other extensions then the ones\n"
" that are assigned to you.\n"
+" 'p' -- Preserve the incoming Caller*ID on the outbound leg of the call (old style\n"
+" asterisk behavior)\n"
" 'r' -- indicate ringing to the calling party, pass no audio until answered.\n"
" 'm[(class)]' -- provide hold music to the calling party until answered (optionally\n"
" with the specified class.\n"
@@ -145,6 +147,7 @@ static char *rdescrip =
#define DIAL_MONITOR_OUT (1 << 9)
#define DIAL_GO_ON (1 << 10)
#define DIAL_HALT_ON_DTMF (1 << 11)
+#define DIAL_PRESERVE_CALLERID (1 << 12)
struct localuser {
struct ast_channel *chan;
@@ -403,7 +406,8 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
numnochan++;
} else {
/* After calling, set callerid to extension */
- ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
+ if (!ast_test_flag(peerflags, DIAL_PRESERVE_CALLERID))
+ ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
}
}
/* Hangup the original channel now, in case we needed it */
@@ -890,6 +894,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_set2_flag(peerflags, strchr(transfer, 'W'), DIAL_MONITOR_OUT);
ast_set2_flag(peerflags, strchr(transfer, 'd'), DIAL_HALT_ON_DTMF);
ast_set2_flag(peerflags, strchr(transfer, 'g'), DIAL_GO_ON);
+ ast_set2_flag(peerflags, strchr(transfer, 'p'), DIAL_PRESERVE_CALLERID);
}
strncpy(numsubst, number, sizeof(numsubst)-1);
/* If we're dialing by extension, look at the extension to know what to dial */
@@ -1013,7 +1018,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
- ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
+ if (!ast_test_flag(peerflags, DIAL_PRESERVE_CALLERID))
+ ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
}
/* Put them in the list of outgoing thingies... We're ready now.
XXX If we're forcibly removed, these outgoing calls won't get