Roland
2012-Mar-27 08:59 UTC
[asterisk-users] Outbound DID: in sip.conf or dialplan or db?
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. I think the downside of this is, that I should configure this for each SIP account. I could specify a default callerid, which our main DID, in a template, but then people will see this general ID when I call internal extentions as well. This way the receiver cannot see my extention number. Other solution would be to specify my DID in the dailplan. I tried this solution, which works: exten => _00Z.,1,NoOp(Call Received from ${CALLERID(num)} to ${EXTEN:1}) exten => _00Z./Jeroen_S,2,Set(CALLERID(num)=31229700210) exten => _00Z./Roland_odA,2,Set(CALLERID(num)=31852013900) exten => _00Z./Schoolshopper,2,Set(CALLERID(num)=31852013900) exten => _00Z.,2,Set(CALLERID(num)=31229700203) same => n,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}) Upside is that I can be more specific in routing. The same handset could have different DID's, but I think usually the DID is bound to a SIP account. So I would probably create a second SIP account if a user needs an extra DID anyways. The downside in my opinion is that my Dialplan will be filled with around 30 extra lines with account specific stuff. I would rather keep my dialplan code clean. Also when I would have more patterns that can be matched, I have to specify them for this pattern as well. That would already take around 60 lines of extra code. I have considered an AGI call to fetch the data from a database. But wouldn't this be a higher risk? When the database fails or is too slow, it will not work? I would rather use mysql than the asterisk db, because i can manage mysql easy with phpmyadmin. Any suggestions would be appreciated! Am I missing any options here? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120327/47f82412/attachment.htm>
A J Stiles
2012-Mar-27 09:51 UTC
[asterisk-users] Outbound DID: in sip.conf or dialplan or db?
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.
Lutgring, Sam
2012-Mar-27 11:51 UTC
[asterisk-users] Outbound DID: in sip.conf or dialplan or db?
I have done this successfully in 2 ways depending on your requirements. Usually, I just set the callerid number right in the SIP, this is the easiest and cleanest in my opinion. Worth mentioning that I always set the callerid in the SIP regardless, this way I know that internal calls, trunk calls, whatever are clean when it rings on any phone (including internal). In this case my DID number (block of 100) are easily mapped to my extensions (forward planning during setup) because the extension is the last 4 digits of the DID. This way in the default context I can say exten => _12345XX,1,Goto(default,${EXTEN:3},1) where the extension would be 45XX. The second way that I have done this is by using the Asterisk internal database (no API or outside DB to worry about). Then just simply do a DB lookup for the proper callerid before routing the call out. Where I have had to use this is when multiple phones are grouped (multiple groups) to share a DID number for their callerid. *********************************************** Sam Lutgring Director of Informational Technology Services Calhoun Intermediate school district lutgrins at calhounisd.org<mailto:lutgrins at calhounisd.org> www.calhounisd.org<http://www.calhounisd.org> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Roland Sent: Tuesday, March 27, 2012 4:59 AM To: asterisk-users at lists.digium.com Subject: [asterisk-users] Outbound DID: in sip.conf or dialplan or db? 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. I think the downside of this is, that I should configure this for each SIP account. I could specify a default callerid, which our main DID, in a template, but then people will see this general ID when I call internal extentions as well. This way the receiver cannot see my extention number. Other solution would be to specify my DID in the dailplan. I tried this solution, which works: exten => _00Z.,1,NoOp(Call Received from ${CALLERID(num)} to ${EXTEN:1}) exten => _00Z./Jeroen_S,2,Set(CALLERID(num)=31229700210) exten => _00Z./Roland_odA,2,Set(CALLERID(num)=31852013900) exten => _00Z./Schoolshopper,2,Set(CALLERID(num)=31852013900) exten => _00Z.,2,Set(CALLERID(num)=31229700203) same => n,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}) Upside is that I can be more specific in routing. The same handset could have different DID's, but I think usually the DID is bound to a SIP account. So I would probably create a second SIP account if a user needs an extra DID anyways. The downside in my opinion is that my Dialplan will be filled with around 30 extra lines with account specific stuff. I would rather keep my dialplan code clean. Also when I would have more patterns that can be matched, I have to specify them for this pattern as well. That would already take around 60 lines of extra code. I have considered an AGI call to fetch the data from a database. But wouldn't this be a higher risk? When the database fails or is too slow, it will not work? I would rather use mysql than the asterisk db, because i can manage mysql easy with phpmyadmin. Any suggestions would be appreciated! Am I missing any options here? ________________________________ This email is intended only for the use of the addressee(s) named herein. It may contain legally privileged and confidential information. If you are not the intended recipient, or an authorized representative of the intended recipient, you are hereby notified that any review, copying or distribution of this email and its attachments, if any, is strictly prohibited. If you have received this email in error, please immediately notify the sender by return email and delete this email from your system. Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120327/8a2af194/attachment.htm>