Inbound route for PRI ISDN

HI Folks,

I have a asterisk 1.2 with freepbx runnig with a PRI ISDN line (30 channel) and mISDN.
I would like to have only one inbound route for all my extension. I do not find no possibelity to do.

I just did the following in extensions_custom.conf where the carrier access code ist 12345

exten => _12345XXX,1,Noop(Add a 9 to the function CALLERID(num) to make it possible to do a callback)
exten => _12345XXX,2,Noop(Old orig. CALLERIDNUM ${CALLERID})
exten => _12345XXX,3,Set(CALLERID(num)=9${CALLERID})
exten => _12345XXX,4,Noop(New CALLERIDNUM ${CALLERID})
exten => _12345XXX,5,Goto(from-pstn,${EXTEN:5},1)
exten => _12345XXX,6,hangup

It works fine but I have no phonebook look up anymore.

Do anyone has an idea?

Thanks a lot

When you say “I have no phonebook look up anymore”, do you mean for inbound calls, or that your phonebook simply doesn’t work anymore, ie :you can’t access it ??
If this is because you’ve moved to a TExxx card from a TDM card (PRI from PSTN), it may well be that the caller id digits presented to the switch via PRI are different then when they came through PSTN.
You’ll simply need to see what digits the telco has addedd/dropped, and modify your phonebook accordingly.

Are all the numbers in your phonebook prefixed with 9? Since you added 9 to the caller id for ease of callback, the match won’t be made unless your phonebook entries match the modified caller id.

Hi @all,

I can access my phonebook. It work preaty good, when I confugure a inbound route.
But I have no inbound route configured anymore, because it was to much work configure a inbound route for each extension.
I found no solution to configure only one inbound route fpr my 90 extensions. I needed to configure one for each extension.
My phoneline providers sends me not just the extension but the hole number like 12345999 where 999 is the extension.

Can I configure only one inbound route for all my extensions? If I can, I can just activate a phonebook lookup with it.


Unless I’ve misunderstood your requirements, I think you’ll find an auto attendant will be most useful.
Basically setup an IVR, and have Enable Direct Dial ticked.
Record a message in System Recordings advising callers "if they know the extension, please dial it now, else please hold for an operator"
Set an option the IVR as 0 which terminates to Reception (for those impatient callers ;).

In General Settings, define your Operator Extension (usually Reception)

If you have a phonebook already setup in the PABX, you could also tick Enable Directory, so callers can pick which John Smith they want to talk to… you may need to change in Genereal Settings | Find users in the Company Directory by: to whether you want to list user by first or last names.

Much easier than configuring 90+ inbound routes based on trailing digits…


i thnik this is not really who e pbx is working. Why should I configure a IVR for normal incomming calls.
When I dial 12345999 as a customer I think I get the right prson on the other site without walking thrue a IVR.

I think the most important question is not to have a running phonebook but to configure one right inbound route for all DIDs.



Below is a merge of your custom context and a working DID route with CID lookup. You can see that it adds the standard blacklist and cidlookup features of a standard inbound route. It also sets the original CID number as the CID name if the number cannot be found in your phonebook. Most phones will present the CID name, but use the CID number for callbacks, so this allows your users to see the Phonebook name or the original CID number, but make callbacks with the 9+original CID number. It also sets variables normally set by FreePBX so that all the FreePBX features work as usual. If this custom dialplan code is helpful to you, please consider making a donation to the FreePBX project using the Donate button on the left.

exten => _12345XXX,1,Set(__FROM_DID=${EXTEN})
exten => _12345XXX,n,Gosub(app-blacklist-check,s,1)
exten => _12345XXX,n,Gosub(cidlookup,cidlookup_1,1)
exten => _12345XXX,n,ExecIf($[ "${CALLERID(name)}" = "" ] ,Set,CALLERID(name)=${CALLERID(num)})
exten => _12345XXX,n,Noop(Add a 9 to the function CALLERID(num) to make it possible to do a callback)
exten => _12345XXX,n,Noop(Old orig. CALLERIDNUM ${CALLERID})
exten => _12345XXX,n,Set(CALLERID(num)=9${CALLERID})
exten => _12345XXX,n,Noop(New CALLERIDNUM ${CALLERID})
exten => _12345XXX,n,SetCallerPres(allowed_not_screened)
exten => _12345XXX,n,Goto(from-did-direct,${EXTEN:5},1)
exten => _12345XXX,n,hangup


I have tuned your post e little bit so that only CALLERID(num) ist changed.

exten => _33022XXX,1,Set(__FROM_DID=${EXTEN})
exten => _33022XXX,n,GotoIf($["${CALLERID}" = “”]?yes:no)
exten => _33022XXX,n(no),Gosub(app-blacklist-check,s,1)
exten => _33022XXX,n,Gosub(cidlookup,cidlookup_3,1)
exten => _33022XXX,n,Noop(CALLERIDNUM ${CALLERID(num)})
exten => _33022XXX,n,Noop(CALLERIDNAME ${CALLERID(name)})
exten => _33022XXX,n,Noop(CALLERIDALL ${CALLERID(all)})
exten => _33022XXX,n,Noop(Add a 9 to CALLERID(num) to make it possible to press callback on the phone)
exten => _33022XXX,n,Set(CALLERID(num)=9${CALLERID(num)})
exten => _33022XXX,n,SetCallerPres(allowed_not_screened)
exten => _33022XXX,n,Goto(from-did-direct,${EXTEN:5},1)
exten => _33022XXX,n,hangup

The third line depends on the configuration made with the gui. cidlookup_3 is the third entry for a phonebook. My be it is cidlookup_1 in a normal installation.

I think it would be very helpfull for all the European people with ISDN E1 or even B1 ptp lines to be able to configure an inbound route like that with the gui.

Thank’s a lot for your help!!!


Thanks for posting your working code and explaining the logic behind your changes. I’m glad you got everything working on your system. To get this kind of configuration added to the GUI, please create a feature request. That will make sure this gets considered during the next development cycle.

If you haven’t made a feature request before, here are a few pointers. From the Development menu on the left side of this page, choose Bug Reports. Change the Type to Feature Requests and fill in the ticket with a description of the feature you would like to see. Adding a link to this forum topic would probably be helpful.

I have a similar problem in that our carrier sends DID calls as “s/yourip” which comes into our switch as “[Nov 21 17:41:55] VERBOSE[30955] logger.c: – Executing [[email protected]:2] Answer(“SIP/”, “”) in new stack”

Unfortunately this requires us to create one inbound route and one extension for every DID we purchase from the carrier. So if we have 1,000 DIDs which is 1,000 extensions on our trixbox, we would also need 1,000 inbound routes to answer the calls. Since all extensions behave the same it should be possible to define one single custom inbound route that looks at the incoming DID number and matches it with an existing extension number on our system. I am thinking of something similar to
exten => s,1,Dial(SIP/xxxx)
where xxxx is any DID number.

and I believe the above code could be adapted to my situation.


Hey dcitelecom:

I’m really confused as to what you’re asking. In every case I know of, unless you’re trying to match a CID or the ANY/ANY format, you have to have an inbound route for every extension.

The later versions of FreePBX allow you to define the DID when an extension is created, but that just creates the inbound route for that extension/DID relationship.

Of course, the inbound doesn’t have to point to a single physical extension, it may point to an IVR, a ring group, voicemail, etc.

Maybe I’m all wet, dense, or just senile… so maybe one of the contributors or developers can answer this better.


Unfortunately this requires us to create one inbound route and one extension for every DID
Not really, all you’ll need to do is specify the incoming DID, per extension in the Extensions page, under Add Inbound DID. Given you have to create the extensions anyway, it’s not really an onerous task.
If this is not apparent on your system, you may need to update to FreePBX 2.5

You’ll need to talk with your carrier or look at the logs to see how they pass the digits to your system, so you can match your number range with your extensions.


it works also very well with a sip trunk.
I have it runnung with the customers each with more then 100 extensions.



im newly to voip,freepbx.i want to used my 2 boxes as my trunk,i have read already from the forum that it is a telco technician somewhere in the Philippines .
we have so many branches,we used other telco faculities for making a call so we need to pay for that.for that reason i want to interconnect our voice call by using this boxes offcourse for lessen our expenses.
this is my sample setup:
1.i have pstn number 5855000,5855001,5855002 and many more (Meridian 1/PSTN) let says that this pstn is BRANCH A.
2.i have server box connected to MEridian 1/PSTN via digium T110P E1/r2
that box has sip numbers 5865000,5865002,5865003 and so on…let says that this box is BOX A.
3.i have also pstn in other area namely BRANCH B with the number of 8885000,8885001,8885002 and so on. BRANCH B i have box connected also via T110P/e1/R2 and let says that this box is BOX B.
BOX B has also a sip number which is 8895000,8895501,8895002 and so on

the situation is this.
i configure iax trunk in both of my boxes working okay.
a. if i used number 5865000 call to 8895000 and vice versa call is ok.(via iax trunk)
b. if i used number 5865000 call to 8885000 working ok.(pstn via pri via iax)
c. if i used number 8895000 call to 5855000 working ok.(pstn via pri via iax)
d. if i used number 5855000 call to 8885000 thats my problem call hang up.(pstn via pri to box via iax to box via pri to pstn)

please help me to find the solution for this problem and guide me step by step.
thanks in advance…


Please do not hijack a existing thread about something for something else.

If you would like help please repost this as a new thread so that it get’s maximum viewing by all. Otherwise you are restricting your available help to those that read this message about ISDN.

Hope you can help me or any body, i have problem with my Trixbox 2.0 FreePBX 2.2.0rc3 PRI line(19 lines). The problem encounter when the extension is create like 0501 the inbound route cannot set to any destination, but when there are no extension create, i can set to any destination like routing groups, IVR and any.

extension create 0501
7038550501 inbound route to routing groups set DID to 0501 = failed

no extension create
7038550501 inbound route to routing groups set DID to 0501 = no problem

thanks in advance