Connecting one freepbx system to another

I have followed the link below in attempting to connect a freepbx in one domain to another in a different domain.

https://wiki.freepbx.org/pages/viewpage.action?pageId=4161588

When I attempt to dial the extension in the other domain, I receive the recording of “All circuits are busy now. Please try your call again later”. What am I missing?

Below are my settings for the different items from the link:

IAX2 Trunk on System 1:
General Tab:
Trunk Name: Abilene
Outbound CallerID: “Las Cruces” (not sure if actually need anything here)
iax Settings Tab:
Trunk Name: Abilene
Peer Details:
host=IP address of system 2
username=Abilene
password=*******
type=friend
context=from-internal
qualify=yes
qualifyfreqok=25000
transfer=no
trunk=yes
forceencryption=yes
encryption=yes
auth=md5
Outbound Route System 1:
Route Settings Tab:
Route Name: InterOfficetoAbilene
Trunk Sequence for Matched Routes: Abilene
Dial Patterns Tab:
Dial pattern is: (prepend)8|[5XX/CallerID]
Nothing configured on remaining tabs
IAX Trunk on System 2:
Trunk Name: Las_Cruces
Outbound CallerID: “Abilene” (again not sure if I actually need this)
iax Settings Tab:
Trunk Name: Las_Cruces
PEER Details:
host=IP address of system 1
username=Las Cruces
secret=*******
type=friend
context=from-internal
qualify=yes
qualifyfreqok=25000
transfer=no
trunk=yes
forceencryption=yes
encryption=yes
auth=md5
Outbound Route on System 2
Route Settings tab:
Route Name: InterOfficetoLasCruces
Trunk Sequence for Matched Routes: Las_Cruces
Dial Patterns tab
(prepend)8|[8XX/CallerID]

I don’t understand your Outbound Route Dial Pattern description. If I understand correctly, Las Cruces has extension numbers in the range 800-899; Abilene uses 500-599. So to call extension 501 in Abilene, a Las Cruces user would dial 501. There is no need for any prepend or prefix. Assuming that all users should have access to the interoffice trunk, there is no need for the CallerID field either. The Outbound Route on the Las Cruces system would have
prepend: (blank)
prefix: (blank)
match pattern: 5XX
CallerID: (blank)

And on the Abilene system:
prepend: (blank)
prefix: (blank)
match pattern: 8XX
CallerID: (blank)

Next, check whether the trunks show as available; there may be networking issues between the systems.

If you still have trouble, paste the Asterisk logs from both systems for a failing attempted call at pastebin.com and post the link here.

1 Like

Finally got back around to looking at this. I removed the prefix, so the dial pattern page just has a match pattern of 5XX. The Caller ID entry was not on the dial pattern page, but on the Trunk page-General tab. When I remove the Caller ID there, I get a message that having a Caller ID entry is highly recommended. With removing just the prefix, I get the same message. Removing the Caller ID as well also doesn’t change anything. I am waiting to get the activation email from pastebin, but here is the snippet of the asterix log from the Las Cruces pbx that deals with the extension (502) that I dialed. There does not appear to be any corresponding entries in the Abilene log.

17562 [2023-07-27 09:39:31] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:1] Macro(“PJSIP/817-0000907e”, “user-callerid,LIMIT,EXTERNAL,”) in new stack
17563 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:2] Gosub(“PJSIP/817-0000907e”, “sub-record-check,s,1(out,502,dontcare)”) in new stack
17564 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [out@sub-record-check:1] NoOp(“PJSIP/817-0000907e”, “Outbound Recording Check from 817 to 502”) in new stack
17565 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [out@sub-record-check:7] Gosub(“PJSIP/817-0000907e”, “recordcheck,1(dontcare,out,502)”) in new stack
17566 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:3] ExecIf(“PJSIP/817-0000907e”, “0 ?Set(CDR(accountcode)=)”) in new stack
17567 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:4] Set(“PJSIP/817-0000907e”, “_ROUTEID=4”) in new stack
17568 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:5] Set(“PJSIP/817-0000907e”, “_ROUTENAME=InterOfficetoAbilene”) in new stack
17569 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:6] Set(“PJSIP/817-0000907e”, “INTRACOMPANYROUTE=YES”) in new stack
17570 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:7] Set(“PJSIP/817-0000907e”, “MOHCLASS=default”) in new stack
17571 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:8] Set(“PJSIP/817-0000907e”, “_CALLERIDNAMEINTERNAL=James Lines”) in new stack
17572 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:9] Set(“PJSIP/817-0000907e”, “_CALLERIDNUMINTERNAL=817”) in new stack
17573 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:10] Set(“PJSIP/817-0000907e”, “_EMAILNOTIFICATION=FALSE”) in new stack
17574 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:11] Set(“PJSIP/817-0000907e”, “_NODEST=”) in new stack
17575 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:12] Macro(“PJSIP/817-0000907e”, “dialout-trunk,1,502,off”) in new stack
17576 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [s@macro-dialout-trunk:6] Set(“PJSIP/817-0000907e”, “DIAL_NUMBER=502”) in new stack
17577 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [s@macro-dialout-trunk:15] Set(“PJSIP/817-0000907e”, “OUTNUM=502”) in new stack
17578 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [s@macro-dialout-trunk:23] Set(“PJSIP/817-0000907e”, “__CRM_DESTINATION=502”) in new stack
17579 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [s@macro-dialout-trunk:29] ExecIf(“PJSIP/817-0000907e”, “1?Set(CONNECTEDLINE(num,i)=502)”) in new stack
17580 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] pbx.c: Executing [s@macro-dialout-trunk:35] Dial(“PJSIP/817-0000907e”, “IAX2/Abilene/502,300,Ttb(func-apply-sipheaders^s^1,(1))U(sub-send-obroute-email^502^502^1^1690472372^James Lines^817)”) in new stack
17581 [2023-07-27 09:39:32] VERBOSE[30903][C-0000370e] app_dial.c: Called IAX2/Abilene/502
17582 [2023-07-27 09:39:33] VERBOSE[30903][C-0000370e] pbx.c: Executing [502@from-internal:13] Macro(“PJSIP/817-0000907e”, “outisbusy,”) in new stack
18063 [2023-07-27 09:41:42] VERBOSE[31427][C-0000370f] pbx.c: Executing [s@sub-record-check:3] Set(“DAHDI/i1/2675355078-312e”, “NOW=1690472502”) in new stack
18110 [2023-07-27 09:41:46] VERBOSE[31427][C-0000370f] pbx.c: Executing [5281133@from-digital:23] Set(“DAHDI/i1/2675355078-312e”, “__CRM_LINKEDID=1690472502.68051”) in new stack
18111 [2023-07-27 09:41:46] VERBOSE[31427][C-0000370f] pbx.c: Executing [s@ext-fax:4] ReceiveFAX(“DAHDI/i1/2675355078-312e”, “/var/spool/asterisk/fax/1690472502.68051.tif,f”) in new stack
18112 [2023-07-27 09:41:46] VERBOSE[31427][C-0000370f] res_fax.c: Channel ‘DAHDI/i1/2675355078-312e’ receiving FAX ‘/var/spool/asterisk/fax/1690472502.68051.tif’
18129 [2023-07-27 09:42:23] VERBOSE[31427][C-0000370f] pbx.c: Executing [s@crm-hangup:4] NoOp(“DAHDI/i1/2675355078-312e”, “MASTER CHANNEL: 1690472502.68051 = 1690472502.68051”) in new stack
26951 [2023-07-27 10:33:41] VERBOSE[11952][C-00003728] bridge_channel.c: Channel Local/FMPR-820@from-internal-000023a5;1 joined ‘simple_bridge’ basic-bridge <8b48f678-795d-4743-baab-502fef09591b>
26952 [2023-07-27 10:33:41] VERBOSE[11912][C-00003728] bridge_channel.c: Channel PJSIP/826-000090ac joined ‘simple_bridge’ basic-bridge <8b48f678-795d-4743-baab-502fef09591b>
26953 [2023-07-27 10:33:41] VERBOSE[11952][C-00003728] bridge_channel.c: Channel PJSIP/826-000090ac left ‘simple_bridge’ basic-bridge <8b48f678-795d-4743-baab-502fef09591b>
26954 [2023-07-27 10:33:41] VERBOSE[11952][C-00003728] bridge_channel.c: Channel Local/FMPR-820@from-internal-000023a5;1 left ‘simple_bridge’ basic-bridge <8b48f678-795d-4743-baab-502fef09591b>

Spoke too soon about the Abilene log. This seems to correspond. I am getting this error for all extensions in Abilene. Not sure what "Extension ‘51’ does not exist in context ‘from-internal’, as we don’t have an extension 51. But the from-internal reference is used in the Peer settings for the trunk between sites.

[2023-07-27 11:40:19] NOTICE[3579] res_pjsip_exten_state.c: Endpoint ‘502’ state subscription failed: Extension ‘51’ does not exist in context ‘from-internal’ or has no associated hint

So the attempt to dial on the trunk failed; either the trunk is not set up properly or the other end rejected the call. I know very little about IAX but suggest that at the Asterisk command prompt at both ends type
iax2 set debug on
try the call again and paste the logs.

This use of pastebin requires no account or activation. If you still have trouble, use pastebin.freepbx.org, which I generally don’t recommend because pastes expire, a possible problem for future readers of the thread.

Dumb question but why are you trying to make IAX work? Why not just setup a pjsip trunk on both and let them talk over that?

@dobrosavljevic I went this route because that was what I found on the freepbx wiki (see link on first post). According to that post and the replies at the bottom, using IAX is supposed to “just work”. I’m happy to try something else. Can you provide a link on how to set up the pjsip trunk between two sites? I’m only a couple of months in to using freepbx, so am definitely still in a learning stage.

@Stewart1 when I type in iax2 set debug on, I get “-bash: iax2: command not found”.

You need to do that from the Asterisk CLI

Ok. Set debug and tried a call. Below are the pastebin links for the two systems.

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