FreePBX + Digium gateway 2G402F?

So you have two PRIs to the pstn.
Let’s say you have those connecting to PRI port 1 and 2 on the gateway.

Is your goal then to route all calls common from your 6xxx freepbx extensions out through PRI port 1, and calls coming from 7xxx through PRI port 2?

Those gateways are running Asterisk and you are dealing with a dual nic Asterisk situation.
I am using Digium PRI gateways myself, albeit the smaller models with two PRI ports and no dual nic.

I think you can have that easier.
Just run one trunk between the gateway and Freepbx.
You can route via dialed number on the gateway.
You e.g. you can say if a call comes into the Digium and the dialed number matches a specific string, then send it out port 1 or 2.

If you absolutely must send all calls from your 6xxx freepbx extensions out through port 1 and 7xxx through port 2, I would have only one trunk on Freepbx, but two outbound routes.
Force 6xxx to use outbound route 1 and pretend a unique identifier, an extra digit string to the dialed number, e.g. 22, which you remove again on the gateway, but which allows your gateway to route calls starting with 22 out a specific port, whereas others will be sent out port 2.

I can show you how to configure routing rules on the gateway to make this work.

I am pretty confident that the solution I described above is gonna work for you, although there might also be an option to route the call on the gateway depending on which nic it came in on.

Post a screenshot of a routing rule on the gateway, so we can look at the options you have there.

1 Like

I created two sip endpoints in gateway:

then created the call routing rules
image

image

Please help

Create only one trunk and one endpoint on the gateway.
In FreePBX create another outbound route for all yor 6xxx extensions, with 6xxx in the CallerID field in the dial patterns tab, and 222 in the prepend field. Put that route on top of the order.


Have a second route to your gateway for all other calls, without the 222 and the CallerID field in the dial patterns tab empty.

Now on the Digium, do this in your Routing rule. Send call through the port you want your 6xxx to go out on.

Have a second routing rule without the 222 and route through the other port.

Thank Avayax, I will try and feedback

Thank all for help, I configured like Avayax’s guide and it works. Thank so much

Hi Avayax,

I configure following your guide, it worked, but one or two days, it will drop the calls. the error in FreePBX is "Got SIP response 603 “Declined” back from gateway.

I though because of DIGIUM device problem. I have changed another. but still same problem? did you have experience on this?

below is what i configured for Digium gateway




Hard to tell.
Maybe the gateway fails to send the call out the PRI.
I would do a PRI/Sip debug on the gateway and look at the information there.

Also I would look at the calls that fail if there is something specific about them. Is it calls to specific number, e.g.

hi avayax,

I have upload the debug file on https://nofile.io/f/bMEPMRu5huS/gateway_debug_asterisk_2018-05-13_08-26-34.log. Please help

Is that from a failed call?
Those debugs are “noisy” and hard to read.

I would do a sip debug on the Asterisk server.
sip set debug IP xxxx (if using chansip).

And then do PRI only debug on the gateway.

Make sure you only capture a failed call.

this is the “sip set debug IP xxxx”

SIP Debugging Enabled for IP: 10.141.12.217
Audio is at 18972
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 10.141.12.217:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK79433343;rport
Max-Forwards: 70
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: FPBX-14.0.2.14(14.7.6)
Date: Tue, 15 May 2018 06:11:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 277

v=0
o=root 1043222029 1043222029 IN IP4 10.141.100.30
s=Asterisk PBX 14.7.6
c=IN IP4 10.141.100.30
t=0 0
m=audio 18972 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


<— SIP read from UDP:10.141.12.217:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK79433343;received=10.141.100.30;rport=5060
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected];tag=as6da956c3
Call-ID: [email protected]:5060
CSeq: 102 INVITE
Server: Digium Gateway
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm=“asterisk”, nonce=“38c90325”
Content-Length: 0

<------------->
— (11 headers 0 lines) —
Transmitting (NAT) to 10.141.12.217:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK79433343;rport
Max-Forwards: 70
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected];tag=as6da956c3
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: FPBX-14.0.2.14(14.7.6)
Content-Length: 0


Audio is at 18972
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 10.141.12.217:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK708572aa;rport
Max-Forwards: 70
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 INVITE
User-Agent: FPBX-14.0.2.14(14.7.6)
Authorization: Digest username=“freepbx”, realm=“asterisk”, algorithm=MD5, uri="sip:[email protected]", nonce=“38c90325”, response=“da96890df9ac5a6794479f02c4e732e2”
Date: Tue, 15 May 2018 06:11:26 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 277

v=0
o=root 1043222029 1043222030 IN IP4 10.141.100.30
s=Asterisk PBX 14.7.6
c=IN IP4 10.141.100.30
t=0 0
m=audio 18972 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


<— SIP read from UDP:10.141.12.217:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK708572aa;received=10.141.100.30;rport=5060
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected]
Call-ID: [email protected]:5060
CSeq: 103 INVITE
Server: Digium Gateway
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: sip:[email protected]:5060
Content-Length: 0

<------------->
— (12 headers 0 lines) —

<— SIP read from UDP:10.141.12.217:5060 —>
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK708572aa;received=10.141.100.30;rport=5060
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected];tag=as08445ad0
Call-ID: [email protected]:5060
CSeq: 103 INVITE
Server: Digium Gateway
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------->
— (10 headers 0 lines) —
Transmitting (NAT) to 10.141.12.217:5060:
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 10.141.100.30:5060;branch=z9hG4bK708572aa;rport
Max-Forwards: 70
From: “test” sip:[email protected];tag=as25afc298
To: sip:[email protected];tag=as08445ad0
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 103 ACK
User-Agent: FPBX-14.0.2.14(14.7.6)
Content-Length: 0


Really destroying SIP dialog ‘[email protected]:5060’ Method: INVITE
VHOCVNVPAP13728*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups

and PRI debug on the gateway. it is very long so I cannot put here, Please help to access the link https://nofile.io/f/TRpC3G8ZfrR/gateway_debug_asterisk_2018-05-15_13-07-31.log

These is from called fails. Please help

Does this happen randomly or on specific numbers you dial?
What’s on the other end of the PRI, your voice service provider? Maybe he is rejecting that call.

it rejected all numbers. if we restarted the gateway, it would work normally. but only one or two days, it will happen again.

thanks

I just connected to PRI port 2. because it is testing. When I connected this line to old FreePBX that was using Digium card, it worked normally. but connected to gateway, it got the issue

thanks

this seems to be fixed since I changed the channels on DIGIUM gateway to 15 channels. I checked with telephone provider. they just enabled on 15 channels on the line, but the default of digium gateway is 30 channels. so that make a issue.

thanks

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.