From a4505c6e1f42586bcfb2d6b10d9f4c3198d86e19 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 8 Jan 2009 19:44:19 +0000 Subject: Convert dialplan application DAHDISendCallreroutingFacility to use commas. (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 | 2 ++ channels/chan_dahdi.c | 35 ++++++++++++++++------------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index ed7797be3..334632a8f 100644 --- 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 diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 043f1a1c6..ac95b516f 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -118,7 +118,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") Send QSIG call rerouting facility over a PRI. - + Destination number. @@ -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); -- cgit v1.2.3