[asterisk-commits] mmichelson: branch group/issue8824 r182642 - /team/group/issue8824/apps/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 17 13:50:43 CDT 2009
Author: mmichelson
Date: Tue Mar 17 13:50:40 2009
New Revision: 182642
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182642
Log:
Restore the 'o' option for Dial and revert the 'f' option to its previous use.
These changes were part of the original patch uploaded to issue 8824, but they
don't really have anything to do with remote called party identification, so
I am removing them. If such a change is desired, it should be dealt with in
a different bug report.
Modified:
team/group/issue8824/apps/app_dial.c
Modified: team/group/issue8824/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_dial.c?view=diff&rev=182642&r1=182641&r2=182642
==============================================================================
--- team/group/issue8824/apps/app_dial.c (original)
+++ team/group/issue8824/apps/app_dial.c Tue Mar 17 13:50:40 2009
@@ -122,10 +122,10 @@
operation will not be performed if the peer was parked</para>
</option>
<option name="f">
- <argument name="x" required="true">
- <para>The CallerID to force the outgoing channel to be set to</para>
- </argument>
- <para>Force the callerid of the <emphasis>calling</emphasis> channel to be set to <replaceable>x</replaceable></para>
+ <para>Force the callerid of the <emphasis>calling</emphasis> channel to be set as the
+ extension associated with the channel using a dialplan <literal>hint</literal>.
+ For example, some PSTNs do not allow CallerID to be set to anything
+ other than the number assigned to the caller.</para>
</option>
<option name="F" argsep="^">
<argument name="context" required="false" />
@@ -464,11 +464,11 @@
OPT_RESETCDR = (1 << 1),
OPT_DTMF_EXIT = (1 << 2),
OPT_SENDDTMF = (1 << 3),
- OPT_FORCE_CALLERID = (1 << 4),
+ OPT_FORCECLID = (1 << 4),
OPT_GO_ON = (1 << 5),
OPT_CALLEE_HANGUP = (1 << 6),
OPT_CALLER_HANGUP = (1 << 7),
- OPT_PEER_H = (1 << 8),
+ OPT_ORIGINAL_CLID = (1 << 8),
OPT_DURATION_LIMIT = (1 << 9),
OPT_MUSICBACK = (1 << 10),
OPT_CALLEE_MACRO = (1 << 11),
@@ -512,7 +512,6 @@
OPT_ARG_PRIVACY,
OPT_ARG_DURATION_STOP,
OPT_ARG_OPERMODE,
- OPT_ARG_FORCE_CALLERID,
/* note: this entry _MUST_ be the last one in the enum */
OPT_ARG_ARRAY_SIZE,
};
@@ -524,7 +523,7 @@
AST_APP_OPTION('d', OPT_DTMF_EXIT),
AST_APP_OPTION_ARG('D', OPT_SENDDTMF, OPT_ARG_SENDDTMF),
AST_APP_OPTION('e', OPT_PEER_H),
- AST_APP_OPTION_ARG('f', OPT_FORCE_CALLERID, OPT_ARG_FORCE_CALLERID),
+ AST_APP_OPTION('f', OPT_FORCECLID),
AST_APP_OPTION_ARG('F', OPT_CALLEE_GO_ON, OPT_ARG_CALLEE_GO_ON),
AST_APP_OPTION('g', OPT_GO_ON),
AST_APP_OPTION_ARG('G', OPT_GOTO, OPT_ARG_GOTO),
@@ -539,6 +538,7 @@
AST_APP_OPTION_ARG('M', OPT_CALLEE_MACRO, OPT_ARG_CALLEE_MACRO),
AST_APP_OPTION('n', OPT_SCREEN_NOINTRO),
AST_APP_OPTION('N', OPT_SCREEN_NOCALLERID),
+ AST_APP_OPTION('o', OPT_ORIGINAL_CLID),
AST_APP_OPTION_ARG('O', OPT_OPERMODE, OPT_ARG_OPERMODE),
AST_APP_OPTION('p', OPT_SCREENING),
AST_APP_OPTION_ARG('P', OPT_PRIVACY, OPT_ARG_PRIVACY),
@@ -660,6 +660,14 @@
}
}
return 0;
+}
+
+static const char *get_cid_name(char *name, int namelen, struct ast_channel *chan)
+{
+ const char *context = S_OR(chan->macrocontext, chan->context);
+ const char *exten = S_OR(chan->macroexten, chan->exten);
+
+ return ast_get_hint(NULL, 0, name, namelen, chan, context, exten) ? name : "";
}
static void senddialevent(struct ast_channel *src, struct ast_channel *dst, const char *dialstring)
@@ -745,7 +753,6 @@
} else {
ast_rtp_make_compatible(c, in, single);
- ast_string_field_set(c, accountcode, in->accountcode);
c->cdrflags = in->cdrflags;
ast_set_redirecting(c, apr);
@@ -753,7 +760,14 @@
c->cid.cid_tns = in->cid.cid_tns;
- ast_party_caller_copy(&c->cid, &in->cid);
+ if (ast_test_flag64(o, OPT_FORCECLID)) {
+ S_REPLACE(c->cid.cid_num, ast_strdupa(S_OR(in->macroexten, in->exten)));
+ S_REPLACE(c->cid.cid_name, NULL);
+ ast_string_field_set(c, accountcode, c->accountcode);
+ } else {
+ ast_party_caller_copy(&c->cid, &in->cid);
+ ast_string_field_set(c, accountcode, in->accountcode);
+ }
ast_party_connected_line_copy(&c->connected, apc);
S_REPLACE(in->cid.cid_rdnis, ast_strdup(c->cid.cid_rdnis));
@@ -770,6 +784,10 @@
num->nochan++;
} else {
senddialevent(in, c, stuff);
+ if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
+ char cidname[AST_MAX_EXTENSION] = "";
+ ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
+ }
/* Hangup the original channel now, in case we needed it */
ast_hangup(original);
}
@@ -1549,7 +1567,7 @@
struct cause_args num = { chan, 0, 0, 0 };
int cause;
char numsubst[256];
- char *cid_num = NULL, *cid_name = NULL;
+ char cidname[AST_MAX_EXTENSION] = "";
struct ast_bridge_config config = { { 0, } };
struct timeval calldurationlimit = { 0, };
@@ -1630,8 +1648,6 @@
goto done;
}
- if (ast_test_flag64(&opts, OPT_FORCE_CALLERID) && !ast_strlen_zero(opt_args[OPT_ARG_FORCE_CALLERID]))
- ast_callerid_parse(opt_args[OPT_ARG_FORCE_CALLERID], &cid_name, &cid_num);
if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr)
ast_cdr_reset(chan->cdr, NULL);
if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
@@ -1661,7 +1677,7 @@
outbound_group = ast_strdupa(outbound_group);
}
ast_channel_unlock(chan);
- ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE | OPT_FORCE_CALLERID);
+ ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE);
/* loop through the list of dial destinations */
rest = args.peers;
@@ -1690,7 +1706,7 @@
OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR |
OPT_CALLEE_PARK | OPT_CALLER_PARK |
OPT_CALLEE_MIXMONITOR | OPT_CALLER_MIXMONITOR |
- OPT_RINGBACK | OPT_MUSICBACK);
+ OPT_RINGBACK | OPT_MUSICBACK | OPT_FORCECLID);
ast_set2_flag64(tmp, args.url, DIAL_NOFORWARDHTML);
}
ast_copy_string(numsubst, number, sizeof(numsubst));
@@ -1800,18 +1816,8 @@
}
ast_set_flag64(tmp, DIAL_NOCONNECTEDLINE);
}
-
- if (ast_test_flag64(peerflags, OPT_FORCE_CALLERID)) {
- struct ast_party_connected_line connected;
-
- ast_party_connected_line_set_init(&connected, &tc->connected);
- connected.id.number = cid_num;
- connected.id.name = cid_name;
- connected.id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
- ast_set_connected_line(tc, &connected);
- } else {
- ast_copy_caller_to_connected(&tc->connected, &chan->cid);
- }
+
+ ast_copy_caller_to_connected(&tc->connected, &chan->cid);
S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
ast_party_redirecting_copy(&tc->redirecting, &chan->redirecting);
@@ -1867,6 +1873,9 @@
} else {
senddialevent(chan, tc, numsubst);
ast_verb(3, "Called %s\n", numsubst);
+ if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
+ ast_set_callerid(tc, S_OR(chan->macroexten, chan->exten), 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
More information about the asterisk-commits
mailing list