[Asterisk-Users] setting the Call Forward Number in Zap?

Peter Svensson psvasterisk at psv.nu
Thu Dec 9 15:04:29 MST 2004


On Thu, 9 Dec 2004, Roy Sigurd Karlsbakk wrote:

> >> is this related to the REDGNO header in PRI?
> >
> > It seems to be. Libpri fills in the fields (redirectingnum,
> > redirectingplan, redirectingpres, redirectingreason) in the libpri call
> > structure when Q931_REDIRECTING_NUMBER (0x74) is received. Similarily, 
> > if
> > they are set on calling out that IE is sent.
> >
> > Those data fields seem to be handed to/from chan_zap.c via the rdnis
> > field.
> 
> How can I set this?

I think I wrote some hints so in an earlier email today. Anyway, if you 
look at app_dial.c, in the function dial_exec() you will find that it 
copies the rdnis field from the originating channel to all outgoing 
channels (there are several if you ring several destinations at once). 
At this point you can add an override via a variable in the dial plan:

char *out_rdnis;
....
out_rndis = pbx_builtin_getvar_helper(ast,"OUT_RDNIS");
if (out_rdnis) 
       tmp->chan->cid.cid_rdnis = strdup(out_rdnis);
else if (chan->cid.cid_rdnis) 
                 tmp->chan->cid.cid_rdnis = strdup(chan->cid.cid_rdnis);

This is untested. If it works it allows the variable "OUT_RDNIS" to set
the number set in the Redirecting number IE in the call setup. For your
needs a similar patch could be placed directly in chan_zap as well, near
the call to pri_sr_set_redirecting().

Note that chan_zap uses the prilocaldialplan for Type of number /
Numbering plan for the Redirecting number. You may have to override these
as well, but that requires a change to chan_zap.

> I just spoke to the telco
> There RDNIS number is never sent on incoming calls
> if (a) dials (b) and (b) is redirected to (c), then in my setup 
> asterisk would receive the call from (a) to (b), accepting it, and then 
> dial (c) with callerid/CALGPARNO (0x6c) set to (b), and RDNIS/REDGNO 
> (0x74) set to (a). This will, in turn, make the switch or something 
> somewhere in the net log the call with the correct callerid (b) for 
> billing etc, replacing this with the original callerid (a) and dial the 
> party (c).

Someone at the telco likes to use unintelligable acronyms. The IE 0x6c is 
"Calling party number" and 0x74 is "Redirecting number" in the q.931 
specification. 

Peter





More information about the asterisk-users mailing list