[asterisk-users] Outbound DID: in sip.conf or dialplan or db?

Roland asterisk at rolandow.com
Tue Mar 27 07:13:29 CDT 2012


Thank you for your answer.

First of all: I didn't name my sip accounts the same as my extension
numbers. So I cannot just Dial SIP/${EXTEN} in my case. Also this 100
number block is mapped to extensions for our primary location, but we will
be connection other locations where extension numbers are not mapped
directly to DID's. So for those locations, this technique will not work.

So I came up with this dialplan:

exten => _00Z.,1,NoOp(Call received from ${CALLERID(num)} context
${CONTEXT} to ${EXTEN:1})
  same => n,Set(CID=${DID_BYSIP(SIP/${CALLERID(num)},${CONTEXT})})
  same => n,GotoIf(${CID}?setCid:setDef)
  same => n(setDef),Set(CALLERID(num)=31229253131)
  same => n,Goto(setRoute)
  same => n(setCid),Set(CALLERID(num)=${CID})
  same => n(setRoute),GotoIf($[${CALLERID(num)}=31852013900]?otconnect:voys)
  same => n(otconnect),Set(OUT=999210485)
  same => n,Goto(dodial)
  same => n(voys),Set(OUT=143810001)
  same => n(dodial),Dial(SIP/${EXTEN:1}@${OUT})
  same => n,Hangup()

This seems to work. The only thing that worries me, is that
${CALLERID(num)} can easily be overwritten. On the other hand the
configuration is in my hands, so I guess I just have to be carefull, and
not mess around with callerid(num) too much.



On Tue, Mar 27, 2012 at 11:51 AM, A J Stiles
<asterisk_list at earthshod.co.uk>wrote:

> On Tuesday 27 March 2012, Roland wrote:
> > I am setting up my dialplan with quite some outbound numbers. We have a
> > block of 100 DID's, for which some of them will go direct to specific
> > phones. I am struggling how to solve this, so I am searching for a little
> > advice. These are my concerns.
> >
> > I could set the DID in the sip.conf using something like:
> >
> > callerid="137-Roland" <31229253137>
> >
> > 137 would be my extention number here.
> > .....
> > Any suggestions would  be appreciated! Am I missing any options here?
>
> Assuming there is a reasonable mapping from "outside" numbers to "inside"
> numbers  (your example shows the external number as being 31229253
> followed by
> the internal number; note also you can do simple integer maths within a
> dialplan, as unlike some languages + hasn't been appropriated for string
> concatenation),  it shouldn't be that difficult.
>
> If an internal extension wants to call an internal extension, its caller ID
> ought already to be set to its "inside" extension number in sip.conf.  If
> it
> wants to call an external number, then it needs to set its caller ID to the
> appropriate inbound number.  If it's as simple as adding a prefix, then you
> need something in your dialplan like:
>
> [management]
> ; 3 digits is internal
> exten => XXX,1,Dial(SIP/${EXTEN},90)
> exten => XXX,2,Hangup()
> ; 5 digits or more must be external -- ident as own DDI number
> exten => XXXX.,1,Set(CallerID(num)=${DDIPREFIX}${callerID(num)})
> exten => XXXX.,2,Dial(${POTS}/${EXTEN},90)
> exten => XXXX.,3,Hangup()
>
> Now, chances are, not every internal phone will want to ident as a unique
> external number -- perhaps you want all the phones in one office to ident
> as a
> single number, and all ring together  (using something like
> Dial(TECH/ext&TECH/ext&TECH/ext ..... )  when called from outside. In this
> case, you just need to configure all these phones into their own context in
> your sip.conf and something like this in your dialplan:
>
> [sales-office]
> ; 3 digits is internal
> exten => XXX,1,Dial(SIP/${EXTEN},90)
> exten => XXX,2,Hangup()
> ; 5 digits or more must be external -- one ident for whole office
> exten => XXXX.,1,Set(CallerID(num)=${SALESOFFICE})
> exten => XXXX.,2,Dial(${POTS}/${EXTEN},90)
> exten => XXXX.,3,Hangup()
>
>
> --
> AJS
>
> Answers come *after* questions.
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120327/c083f437/attachment.htm>


More information about the asterisk-users mailing list