aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-05 18:46:19 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-05 18:46:19 +0000
commit9be5c3d206405f366055f12afa3a12b1485b7ca5 (patch)
tree5ce17784a80b1d5b2dbaa47871757a1c6e5699ff /apps/app_dial.c
parentcd9d47d26e243db7ff5c6b268c91b47d08c6bdeb (diff)
Add a missing part of the connected line work into trunk.
Part of the work done for connected line was to add an optional argument to the 'f' option to allow for the connected party information of the outgoing channel to be set to the argument provided. This was overlooked during the merge of the work to trunk and is being added back now. The CHANGES file has also been updated to note this change. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@237803 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index c24a56647..66e8bb865 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -132,10 +132,13 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>Execute the <literal>h</literal> extension for peer after the call ends</para>
</option>
<option name="f">
- <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>.
+ <argument name="x" required="false" />
+ <para>If <replaceable>x</replaceable> is not provided, 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>
+ other than the number assigned to the caller. If <replaceable>x</replaceable> is provided, though, then
+ this option behaves quite differently. Any outgoing channel created will have its connected party information
+ set to <replaceable>x</replaceable></para>
</option>
<option name="F" argsep="^">
<argument name="context" required="false" />
@@ -546,6 +549,7 @@ enum {
OPT_ARG_DURATION_STOP,
OPT_ARG_OPERMODE,
OPT_ARG_SCREEN_NOINTRO,
+ OPT_ARG_FORCECLID,
/* note: this entry _MUST_ be the last one in the enum */
OPT_ARG_ARRAY_SIZE,
};
@@ -558,7 +562,7 @@ AST_APP_OPTIONS(dial_exec_options, BEGIN_OPTIONS
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('f', OPT_FORCECLID),
+ AST_APP_OPTION_ARG('f', OPT_FORCECLID, OPT_ARG_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),
@@ -1623,7 +1627,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
struct cause_args num = { chan, 0, 0, 0 };
int cause;
char numsubst[256];
- char cidname[AST_MAX_EXTENSION] = "";
+ char *cid_num = NULL, *cid_name = NULL;
struct ast_bridge_config config = { { 0, } };
struct timeval calldurationlimit = { 0, };
@@ -1718,6 +1722,8 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
goto done;
}
+ if (ast_test_flag64(&opts, OPT_FORCECLID) && !ast_strlen_zero(opt_args[OPT_ARG_FORCECLID]))
+ ast_callerid_parse(opt_args[OPT_ARG_FORCECLID], &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]))
@@ -1748,7 +1754,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
}
ast_channel_unlock(chan);
ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE |
- OPT_CANCEL_TIMEOUT | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB);
+ OPT_CANCEL_TIMEOUT | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB | OPT_FORCECLID);
/* loop through the list of dial destinations */
rest = args.peers;
@@ -1894,8 +1900,18 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
}
ast_set_flag64(tmp, DIAL_NOCONNECTEDLINE);
}
-
- ast_connected_line_copy_from_caller(&tc->connected, &chan->cid);
+
+ if (ast_test_flag64(peerflags, OPT_FORCECLID) && !ast_strlen_zero(opt_args[OPT_ARG_FORCECLID])) {
+ struct ast_party_connected_line connected;
+
+ ast_party_connected_line_set_init(&connected, &tmp->chan->connected);
+ connected.id.number = cid_num;
+ connected.id.name = cid_name;
+ connected.id.number_presentation = AST_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN;
+ ast_channel_set_connected_line(tmp->chan, &connected);
+ } else {
+ ast_connected_line_copy_from_caller(&tmp->chan->connected, &chan->cid);
+ }
S_REPLACE(tc->cid.cid_rdnis, ast_strdup(chan->cid.cid_rdnis));
ast_party_redirecting_copy(&tc->redirecting, &chan->redirecting);
@@ -1958,6 +1974,7 @@ static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast
ast_verb(3, "Called %s\n", numsubst);
ast_channel_unlock(chan);
if (!ast_test_flag64(peerflags, OPT_ORIGINAL_CLID)) {
+ char cidname[AST_MAX_EXTENSION];
ast_set_callerid(tc, tmpexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
}
}