[asterisk-commits] mmichelson: trunk r237803 - in /trunk: CHANGES apps/app_dial.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 5 12:46:22 CST 2010


Author: mmichelson
Date: Tue Jan  5 12:46:19 2010
New Revision: 237803

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=237803
Log:
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.


Modified:
    trunk/CHANGES
    trunk/apps/app_dial.c

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=237803&r1=237802&r2=237803
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Tue Jan  5 12:46:19 2010
@@ -127,6 +127,10 @@
  * Page has a new option 'A(x)' which will playback an announcement simultaneously
    to all paged phones (and optionally excluding the caller's one using the new
    option 'n') before the call is bridged.
+ * The 'f' option to Dial has been augmented to take an optional argument. If no
+   argument is provided, the 'f' option works as it always has. If an argument is
+   provided, then the connected party information of all outgoing channels created
+   during the Dial will be set to the argument passed to the 'f' option.
 
 Dialplan Functions
 ------------------

Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=237803&r1=237802&r2=237803
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Jan  5 12:46:19 2010
@@ -132,10 +132,13 @@
 					<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 @@
 	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_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 @@
 	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 @@
 			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 @@
 	}
 	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 @@
 			}
 			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 @@
 			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);
 			}
 		}




More information about the asterisk-commits mailing list