Convert dialplan application DAHDISendCallreroutingFacility to use commas.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 8 Jan 2009 19:44:19 +0000 (19:44 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 8 Jan 2009 19:44:19 +0000 (19:44 +0000)
(closes issue #13836)
 Reported by: eliel
 Patches:
       chan_dahdi.c.patch uploaded by eliel (license 64)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@167791 65c4cc65-6c06-0410-ace0-fbb531ad65f3

CHANGES
channels/chan_dahdi.c

diff --git a/CHANGES b/CHANGES
index ed7797b..334632a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -76,6 +76,8 @@ Dialplan Functions
 
 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
index 043f1a1..ac95b51 100644 (file)
@@ -118,7 +118,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                <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 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void
 {
        /* 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 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void
                return -1;
        }
 
-
        parse = ast_strdupa(data);
-       tok = strtok_r(parse, "|", &tokb);
+       AST_STANDARD_APP_ARGS(args, parse);
 
-       if (!tok) {
+       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;
+               args.original = NULL;
        }
 
-       tok = strtok_r(NULL, "|", &tokb);
-       if (!tok) {
+       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 @@ static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void
        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);