[Asterisk-Dev] no DNID copied when bridging channels ?

Luigi Rizzo rizzo at icir.org
Thu Nov 24 12:29:38 MST 2005


On Thu, Nov 24, 2005 at 11:16:17AM -0800, Luigi Rizzo wrote:
> i was trying to modify chan_oss to show the called extension,
> and expected to find it in cid.cid_dnid, but failed to see it.
> 
> Upon inspection (with the "show channel ..." CLI command) i
> notice that this information is present in the incoming
> channel, but not on the destination.
> E.g. below i receive a call through chan_sip from 050098xxxx to 050098yyyy,
> the incoming channel SIP/6969020704-cb3b gets bridged to OSS/dsp,
> and this is what i see:
> 
> 	CLI> show channel SIP/6969020704-cb3b
> 	 -- General --
> 		   Name: SIP/6969020704-cb3b
> 		   Type: SIP
> 	       UniqueID: 1132864876.0
> 	      Caller ID: 050098xxxx	<---- the caller id
> 	 Caller ID Name: 050098xxxx	<---- the caller id
> 	    DNID Digits: 050098yyyy	<---- the called extension
> 		  State: Up (6)
> 	...more stuff
> 
> 	CLI> show channel OSS/dsp
> 	 -- General --
> 		   Name: OSS/dsp
> 		   Type: Console
> 	       UniqueID: 1132864876.2
> 	      Caller ID: 050098yyyy	<--- the called extension
> 	 Caller ID Name: (N/A)
> 	    DNID Digits: (N/A)
> 		  State: Up (6)
> 	... more stuff
> 
> I am a bit confused whether cid_dnid should be set by
> the code in channel.c, pbx.c or apps/app_dial.c
> Any ideas ?

of course explaining a problem also helps identifying it...
so it appears that the patch (attached) simple addition to app_dial.c
solves the problem.
I am still unclear on why the name is missing because chan_oss.c
seems to see it ...

    static int oss_call(struct ast_channel *c, char *dest, int timeout)
    {
        struct chan_oss_pvt *o = c->tech_pvt;
        struct ast_frame f = { 0, };
 
        ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n",
                dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);

    ...

let me know if i should file a bug report, or perhaps someone can
just go ahead and commit it.

cheers
luigi
-------------- next part --------------
Index: apps/app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.188
diff -u -u -r1.188 app_dial.c
--- apps/app_dial.c	14 Nov 2005 10:24:59 -0000	1.188
+++ apps/app_dial.c	24 Nov 2005 19:26:28 -0000
@@ -1068,6 +1068,9 @@
 		if (tmp->chan->cid.cid_ani)
 			free(tmp->chan->cid.cid_ani);
 		tmp->chan->cid.cid_ani = NULL;
+		if (tmp->chan->cid.cid_dnid)
+			free(tmp->chan->cid.cid_dnid);
+		tmp->chan->cid.cid_dnid = NULL;
 
 		if (chan->cid.cid_num) 
 			tmp->chan->cid.cid_num = strdup(chan->cid.cid_num);
@@ -1075,7 +1078,9 @@
 			tmp->chan->cid.cid_name = strdup(chan->cid.cid_name);
 		if (chan->cid.cid_ani) 
 			tmp->chan->cid.cid_ani = strdup(chan->cid.cid_ani);
-		
+		if (chan->cid.cid_dnid)
+			tmp->chan->cid.cid_dnid = strdup(chan->cid.cid_dnid);
+
 		/* Copy language from incoming to outgoing */
 		ast_copy_string(tmp->chan->language, chan->language, sizeof(tmp->chan->language));
 		ast_copy_string(tmp->chan->accountcode, chan->accountcode, sizeof(tmp->chan->accountcode));


More information about the asterisk-dev mailing list