From cfca36384febdb77c73d98b19494bc95adcc24ca Mon Sep 17 00:00:00 2001 From: rmudgett Date: Fri, 23 Jul 2010 19:53:03 +0000 Subject: [PATCH] Make "dahdi show channels" show an outgoing called number. The "dahdi show channels" extension column previously only showed the called number of an incoming call. It now shows the called number for an outgoing call as well. (closes issue #17653) Reported by: amazinzay Patches: issue17653_trunk.txt uploaded by rmudgett (license 664) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@279156 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_dahdi.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 0e64fac09..372af0fb9 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -5099,11 +5099,41 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout) { struct dahdi_pvt *p = ast->tech_pvt; int x, res, mysig; - char dest[256]; /* must be same length as p->dialdest */ + char *dest; + AST_DECLARE_APP_ARGS(args, + AST_APP_ARG(group); /* channel/group token */ + AST_APP_ARG(ext); /* extension token */ + //AST_APP_ARG(opts); /* options token */ + AST_APP_ARG(other); /* Any remining unused arguments */ + ); ast_mutex_lock(&p->lock); - ast_copy_string(dest, rdest, sizeof(dest)); ast_copy_string(p->dialdest, rdest, sizeof(p->dialdest)); + + /* Split the dialstring */ + dest = ast_strdupa(rdest); + AST_NONSTANDARD_APP_ARGS(args, dest, '/'); + if (!args.ext) { + args.ext = ""; + } + +#if defined(HAVE_PRI) + if (dahdi_sig_pri_lib_handles(p->sig)) { + char *subaddr; + + sig_pri_extract_called_num_subaddr(p->sig_pvt, rdest, p->exten, sizeof(p->exten)); + + /* Remove any subaddress for uniformity with incoming calls. */ + subaddr = strchr(p->exten, ':'); + if (subaddr) { + *subaddr = '\0'; + } + } else +#endif /* defined(HAVE_PRI) */ + { + ast_copy_string(p->exten, args.ext, sizeof(p->exten)); + } + if ((ast->_state == AST_STATE_BUSY)) { p->subs[SUB_REAL].needbusy = 1; ast_mutex_unlock(&p->lock); @@ -5183,12 +5213,7 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout) /* We'll get it in a moment -- but use dialdest to store pre-setup_ack digits */ p->dialdest[0] = '\0'; - c = strchr(dest, '/'); - if (c) { - c++; - } else { - c = ""; - } + c = args.ext; if (!p->hidecallerid) { l = ast->caller.id.number.valid ? ast->caller.id.number.str : NULL; } else {