diff --git a/CHANGES b/CHANGES index ed7797be312b2b34babffe09eff0bfa89229552f..334632a8fe976ddc59f7fe6fe905e60e2d875fb7 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 043f1a1c654f580f3919c973fe267874e815ea9c..ac95b516fa41e4a7af106ecf8d5fae39a4ff4a65 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -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);