I am not sure of the best way to do this, so I thought I would query the list. I have about 100 internal extensions ranging from 2000 - 2100. Each internal extension has a external DID number. For example: 2001 5552871620. As you can see the internal externsion and DID don't match in any way. What would be the best way to set the DID for when a extension dials out on the PRI? In sip.conf I am using CallerID as their internal number. I thought of maybe adding a key for each extension to the astdb and have a Macro query the astdb. Any other ideas? Thanks. -- *** Forrest Beck IAXTEL: 17002871718 jonforrest.beck@gmail.com
On Thu, 19 Apr 2007, Forrest Beck said something to this effect:> I thought of maybe adding a key for each extension to the astdb and > have a Macro query the astdb. Any other ideas?That would work, and is certainly the easiest, since you can bulk-load the DID -> extension maps via external CLI commands with a simple script. You could also have Asterisk do MySQL dips for this information, if the desire is to administer it from a web-based front-end. Or if there is some sort of mathematical relationship between the extension and the DID range, the dialplan interpreter itself is capable of fairly sophisticated mathematical extrapolations. -- Alex -- Alex Balashov <sasha@presidium.org>
On 4/19/07, Forrest Beck <jonforrest.beck@gmail.com> wrote:> > > I thought of maybe adding a key for each extension to the astdb and > have a Macro query the astdb. Any other ideas?That's how we do it. We created a MySQL DB that maps DIDs to extensions, and a php script to write our configuration files for us (a file called did.conf, which is #include'd into extensions.conf), as well as push the DID into the Asterisk DB. Actually the DB holds all of the information for our phones, and all of the files we need are generated each night, including sip configs, provisioning files for our Polycoms, the dhcpd configurations to give "static" addresses, and a few other miscellaneous files. And it creates our phone list. The nice thing about building the DB yourself is that you can do anything you want with it. On one of our boxes, I went a step further and created individual outgoing contexts, one for each device. The context set the caller ID. But it was definite overkill; I haven't done that since. Thanks.> > -- > *** > Forrest Beck > IAXTEL: 17002871718 > jonforrest.beck@gmail.com > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > 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/20070419/907fb1be/attachment.htm
Thanks. I will just use the asterisk database. This brought up a new question though. This is what I am using to dial out. If a key for the phone exist in the db it will assign it the did specified. If not, just assign the main incoming operator number. I have a new family in the astdb named external_did. Some entries look like this: external_did/2503/9195551212 external_did/2505/9195551213 [macro-dialoutpstn] exten => s,1,Set(curextension=${CALLERID(num)}) exten => s,2,Set(dbdid="${DB(external_did/${curextension})}") exten => s,3,NoOp(${curextension}) exten => s,4,NoOp(${dbdid}) exten => s,4,GoToIf($["${dbdid}" = ""]?5:8) exten => s,5,Set(CALLERID(num)=9195559595) exten => s,6,Dial(SIP/mspri/${MACRO_EXTEN:1},300) exten => s,7,Hanup() exten => s,8,Set(CALLERID(num)=${DB(external_did/${curextension})}) exten => s,9,NoOp(${CALLERID(num)}) exten => s,10,Dial(SIP/mspri/${MACRO_EXTEN:1},300) exten => s,11,Hangup() This works just fine. Now what about my incoming calls. My incoming calls will be sent from the telco to asterisk as the seven digit number that was dialed. So if I have _X. in my context it will be processed as extension 9195551212. So is there a way to lookup in the asterisk database a value and return the key it belongs to? Because I already have the phone number in the asterisk database set to each extension. I know I could just create a new family and add the keys there, like so incoming_did/9195551212/2503 incoming_did/9195551213/2504 I was just looking to see if I could save myself a step. This may be where I will need to switch to MySQL. On 4/19/07, Alex Balashov <abalashov@evaristesys.com> wrote:> > On Thu, 19 Apr 2007, Forrest Beck said something to this effect: > > > I thought of maybe adding a key for each extension to the astdb and > > have a Macro query the astdb. Any other ideas? > > That would work, and is certainly the easiest, since you can bulk-load > the DID -> extension maps via external CLI commands with a simple script. > > You could also have Asterisk do MySQL dips for this information, if the > desire is to administer it from a web-based front-end. Or if there is > some sort of mathematical relationship between the extension and the DID > range, the dialplan interpreter itself is capable of fairly sophisticated > mathematical extrapolations. > > -- Alex > > -- > Alex Balashov <sasha@presidium.org> > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >-- *** Forrest Beck IAXTEL: 17002871718 jonforrest.beck@gmail.com