[asterisk-commits] tilghman: trunk r167791 - in /trunk: CHANGES channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 8 13:44:20 CST 2009


Author: tilghman
Date: Thu Jan  8 13:44:19 2009
New Revision: 167791

URL: http://svn.digium.com/view/asterisk?view=rev&rev=167791
Log:
Convert dialplan application DAHDISendCallreroutingFacility to use commas.
(closes issue #13836)
 Reported by: eliel
 Patches: 
       chan_dahdi.c.patch uploaded by eliel (license 64)

Modified:
    trunk/CHANGES
    trunk/channels/chan_dahdi.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=167791&r1=167790&r2=167791
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Jan  8 13:44:19 2009
@@ -76,6 +76,8 @@
 
 Applications
 ------------
+ * DAHDISendCallreroutingFacility parameters are now comma-separated,
+   instead of the old pipe.
  * Scheduled meetme conferences may now have their end times extended by
    using MeetMeAdmin.
  * app_authenticate now gives the ability to select a prompt other than

Modified: trunk/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=167791&r1=167790&r2=167791
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Jan  8 13:44:19 2009
@@ -118,7 +118,7 @@
 		<synopsis>
 			Send QSIG call rerouting facility over a PRI.
 		</synopsis>
-		<syntax argsep="|">
+		<syntax argsep=",">
 			<parameter name="destination" required="true">
 				<para>Destination number.</para>	
 			</parameter>
@@ -3014,11 +3014,13 @@
 {
 	/* Data will be our digit string */
 	struct dahdi_pvt *p;
-	char *parse, *tok, *tokb;
-	char *dest = NULL;
-	char *original = NULL;
-	char *reason = NULL;
+	char *parse;
 	int res = -1;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(destination);
+		AST_APP_ARG(original);
+		AST_APP_ARG(reason);
+	);
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_DEBUG, "No data sent to application!\n");
@@ -3032,28 +3034,22 @@
 		return -1;
 	}
 
-
 	parse = ast_strdupa(data);
-	tok = strtok_r(parse, "|", &tokb);
-
-	if (!tok) {
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if (ast_strlen_zero(args.destination)) {
 		ast_log(LOG_WARNING, "callrerouting facility requires at least destination number argument\n");
 		return -1;
 	}
-	dest = tok;	
-
-	tok = strtok_r(NULL, "|", &tokb);
-	if (!tok) {
+
+	if (ast_strlen_zero(args.original)) {
 		ast_log(LOG_WARNING, "Callrerouting Facility without original called number argument\n");
-	} else {
-		original = tok;
-	}
-
-	tok = strtok_r(NULL, "|", &tokb);
-	if (!tok) {
+		args.original = NULL;
+	}
+
+	if (ast_strlen_zero(args.reason)) {
 		ast_log(LOG_NOTICE, "Callrerouting Facility without diversion reason argument, defaulting to unknown\n");
-	} else {
-		reason = tok;
+		args.reason = NULL;
 	}
 
 	ast_mutex_lock(&p->lock);
@@ -3067,8 +3063,9 @@
 	switch (p->sig) {
 	case SIG_PRI:
 		if (!pri_grab(p, p->pri)) {
-			if (chan->_state == AST_STATE_RING)
-				res = pri_callrerouting_facility(p->pri->pri, p->call, dest, original, reason);
+			if (chan->_state == AST_STATE_RING) {
+				res = pri_callrerouting_facility(p->pri->pri, p->call, args.destination, args.original, args.reason);
+			}
 			pri_rel(p->pri);
 		} else {
 			ast_log(LOG_DEBUG, "Unable to grab pri to send callrerouting facility on span %d!\n", p->span);




More information about the asterisk-commits mailing list