I have FPBX installed, got 26 x 24 port Cisco VG224 analogue gateways attached, pjsip trunks to each gateway, inbound route for each gateway from PSTN, outbound route to PSTN, and all lines are working fine for PSTN in/out calls.
What I can’t get to work is internal calls from a device on one gateway to a device on another gateway. The log messages look like this:
Debug: Found PJSIP Destination PJSIP/12503")
NoOp(“PJSIP/VG26-FPBXtrunk-0000254d”, “Returned from dial-one with nothing to call and DIALSTATUS: CHANUNAVAIL”)
When placing an internal-internal call I also see this message which isn’t present for any other type of call:
WARNING[C-000018f5] chan_sip.c: This function can only be used on SIP channels.
The trunks have 2 dialled number manipulations set:
(prepend) (prefix +4415245) (number 125X) - without this the PSTN calls inbound fail.
(prepend) (prefix) (number 125X) - added this in vain hope that internal-internal calls needed it.
There are 2 internal routes pointing to each trunk
VG01-inwards: DID _+441524512X -----> VG01-FPBXTrunk
VG01-internal-inwards: DID _125X ------>VG01-FPBXTrunk
I added an outbound route to see if that would help, but it didn’t:
VG01-internal-calls: Dial Pattern 125X -------VG01-FPBXTrunk
The SIP response received on the analogue gateway is:
SIP/2.0 503 Service Unavailable
Via: SIP/2.0/UDP 10.31.189.215:5060;rport=61401;received=10.31.189.215;branch=z9hG4bK821CB9
Call-ID: [email protected]
From: “FreePBX_11101” sip:[email protected];tag=6D0DEC48-23BD
To: sip:[email protected];tag=be5e2a1a-51be-4f84-95c6-02b777c347d2
CSeq: 101 INVITE
To my eye the bits of config above say that FPBX knows what to do with 12503, but I’m clearly wrong in that. Can anyone propose what I’m missing here, and why internal-internal calls don’t work across these gateways? It’s not congestion because PSTN calls work fine.
It appears that the call is being routed to extension 12503, not to any trunk, and that extension doesn’t exist or is otherwise unavailable.
OMG that’s it!!
I created all the extensions early on in this rollout, thinking FPBX controlled the device extensions like Call Manager does. But that’s not the case, is it? FPBX just wants routes to where these analogue devices extensions live - the gateways.
I just deleted ext 12503, and would you believe it, the phone rings! Now I just need to determine what bit of the config I noted above earlier I don’t need, guessing it’s the outbound route. Then need to delete all the extensions from the extensions module that live on the gateways, and only have extensions in FPBX that live on the VoIP phones that I’ll be bringing over at some point.
Slow learner here.
Thanks for the nudge David. I may have to see what other light you can shed on things when I get stuck again.
Turns out I need the Outbound Route - VG01-internal-calls: Dial Pattern 125X -------VG01-FPBXTrunk
And it’s the Inbound Route that I don’t need - VG01-internal-inwards: DID _125X ------>VG01-FPBXTrunk.
I might get the hang of this one day.
Asterisk uses ‘contexts’ to control dialplan flow. FreePBX has many pre-defined asterisk contexts, but the ones we’re most interested in are
from-trunk. Any SIP INVITE that makes it’s way to the from-internal context (where the local extensions live) will ultimately be processed with an outbound route, provided there are no internal destinations that will match the dial string. Any SIP INVITE that hits the from-trunk context will be processed with an inbound route. Your trunk definitions include a context which controls what part of the system processes inbound calls on those trunks.
Thanks Lorne, that makes sense then.
My SIP gateways to the PSTN are context from-trunk in FPBX, and the FXS gateways (which are SIP trunked to FPBX) are context from-internal.
Perhaps I’ve got that all wrong though, and the SIP gateways should be from-pstn, and the FXS gateways should be from-trunk, and the VoIP phones that I’m yet to create will be from-internal.
I’ve not had much luck with a search for info about contexts, how they sequence things and how to use them. Is there some info you can point me towards please?
Thought I’d experiment by changing one of the FXS gateways to from-trunk (previously from-internal).
Had to create a new Outbound Route for the numbers on the gateway for inbound calls from the PSTN to work. No problem there.
But couldn’t figure out how to make outbound calls from phones on the gateway to work. Got the ‘ss-noservice’ message played back. Seems to indicate I can’t route a call from a trunk to a trunk via Outbound Routes.