Hi, all.
Bit of an asterisk n00b, so bear with me.
This may be a ‘by design’ issue.
Vanilla trixbox 2.3.0.2 install, with freePBX 2.3.0
No manual customisations, and only minimal GUI config.
3x SIP extensions 500,501,502 ( all can call each other ).
1x Motorolla Wildcard X100p cheapie FXO card, which auto-configured OK giving a ZAP trunk and a 9_outside route. Added anyDID/anyCID inbound route to extension 500, PSTN now correctly rings ext 500. All working OK so far.
Now, add IAX2trunk from remote site ( 2xx extensions ).
This all works ONLY if I place the calls from the trunk into [from-internal].
If I place them into [from-trunk], they all get caught by the default inbound route and ring extn500, regardless of the extn dialled.
This appears to be by-design.
Looking at the files, I can see what’s hapening ( I think. )
The incoming call from the trunk call takes the following path through the dial-plan if I drop it into the [from-internal] context:
[from-internal]
includes [from-internal-xfer]
includes [from-internal-additional]
includes [ext-local]
matches extension, and call is completed correctly.
However, if I drop it into [from-trunk], it does this:
[from-trunk]
includes [from-pstn]
includes several things:
[ext-did] --> contains inbound route and call is matched here.
[ext-did-catchall]
[from-did-direct]
includes [ext-local]
The call is being matched in [ext-did],and not dropping through to [from-did-direct], where it would work as it includes [ext-local]. Is the call got to [from-did-direct], it would work, I think.
Here’s the freePBX generated code in [ext-did] that’s trapping all trunk calls to all extensions:
[ext-did]
include => ext-did-custom
exten => fax,1,Goto(ext-fax,in_fax,1)
exten => s,1,Set(__FROM_DID=s)
exten => s,n,GotoIf($[ “${CALLERID(name)}” != “” ] ?cidok)
exten => s,n,Set(CALLERID(name)=${CALLERID(num)})
exten => s,n(cidok),Noop(CallerID is ${CALLERID(all)})
exten => s,n,Goto(from-did-direct,500,1)
I thought the ‘s’ extn was to match things line PSTN calls that did not specify an extension to call. Which it is doing, correctly. Why is also catching calls to nominated extensions and sending them to extn 500? Is this code meant to match everything, including all calls to specific extensions?
What is the best way to allow trunk calls to DID to my extensions?
I can think of a few possibilities.
-
Create inbound routes for each extension. Ugly. Then I need to maintain my extensions in 2 places: Extensions, and Inbound Routes. Also, may not work, as I notice that the GUI re-orders the inbound routes so that anyCID/anyDID route always goes to the top of the file, and will probably be matched first.
-
I could change the order of the #includes in [from-pstn] to put [from-did-direct] before [ext-did], so the call will be matched to my extensions before hitting this catch-all. This will probably break something else in freePBX.
-
There’s a DID field in the Extensions page, which I’m not using. If I place the extension’s own number in here, might it help? I’ve not looked to see what this actually does in the dialplan.
I’ll do some experimenting later, but a pointer to the cleanest method would be appreciated.
But I’m a n00b, and there is probably a blindingly obvious thing I’m doing wrong…
–
Ron