[asterisk-users] Specifying DID for outbound calls

Joshua Colp jcolp at digium.com
Sun Dec 19 21:36:49 UTC 2010


----- Original Message -----
> On Sun, Dec 19, 2010 at 2:40 PM, Joshua Colp <jcolp at digium.com> wrote:
> > I'm surprised nobody has suggested using the setvar functionality.
> > It's extremely
> > useful for stuff like this and would allow you to keep all CallerID
> > information
> > with the actual configuration of the device.
> >
> > Using a configuration entry for sip.conf in another response as an
> > example:
> >
> > [101]
> > type=friend
> > username=101
> > secret=0000
> > mailbox=101
> > callerid="User One" <101>
> > host=dynamic
> > nat=yes
> > dtmfmode=rfc2833
> > canreinvite=no
> > reinvite=no
> > qualify=yes
> > setvar=EXTERNAL_CALLERID="User One" <3012323434>
> >
> > And then in extensions.conf:
> >
> > exten => _1NXXNXXXXXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
> > exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
> >
> > Of course you could add some sanity checking there to make sure that
> > ${EXTERNAL_CALLERID} contains a value and if not default to your
> > main DID.
> >
> > --
> > Joshua Colp
> > Digium, Inc. | Software Developer
> > 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
> > Check us out at: www.digium.com & www.asterisk.org
> 
> Joshua, that seems reasonable. I have two "best practice" questions
> before moving further if anyone would like to chime in.
> 
> First, when using multiple accounts from the same DID provider, is it
> ideal to use IP based routing using one context as I currently am or
> have a separate contexts for each account in the sip.conf?

That's really the only way to do it presently.

> Secondly, it never crossed my mind that the caller-ID was being set in
> the sip.conf and extensions.conf. I guess the extension.conf takes
> precedence. At this point is was not my intention to use the sip.conf
> and I can easily remove it and set the variable in the extension.conf.
> I am just not familiar with what is ideal.

The callerid option configures the CallerID that is set on the channel when a call
comes in from the device. Since there is no logic at that time you can't specify
multiple CallerID values.

The CALLERID dialplan function allows you to change the CallerID on the channel through
logic you have constructed. It does not care about the previous CallerID, it simply changes
it.

The suggestion I previously mentioned is a sort of mix of both, it allows you to set
a separate CallerID when dialing externally by utilizing the setvar option to make it
available in the dialplan and then the CALLERID dialplan function to actually change it.

Since the above logic would, presumably, only be executed when dialing externally you still
need the callerid option set for non-external calls.

-- 
Joshua Colp
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at:  www.digium.com  & www.asterisk.org



More information about the asterisk-users mailing list