summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2010-07-23 19:53:03 +0000
committerRichard Mudgett <rmudgett@digium.com>2010-07-23 19:53:03 +0000
commitd7ca69ceeac04c8a350c33e59c951a08affaaf1f (patch)
tree382cfb5ebaf3f3c2519677b2f76f268855748dda /channels/chan_dahdi.c
parentc61b87c5f6cf0aec17975c23be2ce440af209e36 (diff)
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: https://origsvn.digium.com/svn/asterisk/trunk@279156 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c41
1 files 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 {