[asterisk-dev] Using PreDial to modify destination number
Timo Teras
timo.teras at iki.fi
Fri Sep 7 10:30:41 CDT 2012
On Fri, 07 Sep 2012 09:58:37 -0500 (CDT) Richard Mudgett
<rmudgett at digium.com> wrote:
> > I just noticed the new cool PreDial feature in Asterisk 11 from
> > ASTERISK-19548.
> >
> > I was thinking if I could use it to do target number mangling on
> > per-target channel basis.
> >
> > The idea is that if I have multiple VoIP providers, one requires
> > national format destination number and others international format.
> > I could just in the sip.conf peer config block have something like
> > "setvar=number_format=national", and then use that channel variable
> > to
> > define how a PreDial on callee channel would mangle the destination
> > number.
> >
> > It would appear this is not (yet) possible. The question is if this
> > a good or bad idea?
>
> If I understand your idea, that is not valid. The dialed number is
> a parameter to the Dial() application and not handled by the channel
> itself. You have to do the target number mangling before the Dial().
> Predial is intended to setup the outgoing channel with channel
> variables and other channel parameters.
I see.
So basically the per-peer mangling needs to be done pre-hand in dial
plan. Dialplan programming wise this is slightly annoying, but of
course doable.
For my purposes I can likely use SIPPEER(<peer>,chanvar[number_format])
or similar. However this means the dialplan will have to be aware of
the target channel type, which could have been abstracted away if the
mangling was possible in PreDial.
- Timo
More information about the asterisk-dev
mailing list