Access IVR via SIP trunk

Hello FreePBX gurus :).
As a matter of fact we started discussion in IVR Question, which is pretty old topic. Because nobody answered for a long time I am oppening a new topic here.

The problem is:

  1. I have two intracompany sites with FreePBX boxes on each site. The servers are interconnected via a SIP trunk. All this happen inside the company cloud without direct access to the internet. On the FreePBX on site1 the IVR is composed. All calls between two sites are fine.
  2. Because we do not have a public telephone number (to which IVR to be assigned) I created a Misk application in order to reach the IVR by dialing an extension.
    We have two FreePBX (computer based FreePBX 13.0.197.28) located in two different locations. Of course we have a trunk between them. All calls are perfect … exept the IVR.
    If I try to dial the IVR extension from the phone connected to the FreePBX on which the IVR is created - everything is working just fine.
    But If I try to dial the IVR extension from the phone connected to the secong FreePBX am getting a message “The destination cannot be reached”.
    What I am doing wrong?
    Thanks in advance for all opinions, sugestions … criticism … everithing :blush:

The #dicko advised me:
Your tie line trunk is from-internal?
the from-internal context does not include ivr’s,
the dialplan includes

Include =>        'from-internal-additional-custom' 

So you could try adding ivr-n (where n is the one you want to be available ) to that context

[from-internal-additional-custom]
include => ivr-n
include => ivr-m

O.K. so as #dicko advised me:

  1. I checked the /etc/asterisk/ extensions_additional.conf
    the records say -
    [ivr-1] ; Welcome IVR
    include => ivr-1-custom
    include => from-did-direct-ivr
  2. I add to the /etc/asterisk/extensions_custom.conf
    [from-internal-additional-custom]
    include => ivr-1
  3. So far I do not have responce from the remote office (will have after …may be an hour … people are “too busy to support me in this particurlar moment”.
    But I got some strange effect - if I try to call IVR from the location it is buid (my current location - office 1) first I get a message “We have not receive the valid response. Please try again later.” and immediately after that I can hear the IVR welcome and I can use all IVR options.
    Any Idea why?

#PitzKey asked me:
Please undo the custom changes, and please post call traces and screenshots of the trunk config from both servers.

So:

Trunk configuration for site 1 (main site)

General

Trunk Name: SIP_Trunk_to _Site2

Hide callerID: No

Otbound callerID: empty

CID Options: Allow Any SID

Maximum channel: empty

Asterisk trunk Dial Options: T

System

Continue if Busy: No

Disable Trunk: No

Monitor Trunk Failures: No

Dialed Number Manipulation Rules

Everytimg is empty including Outbound Dial Prefix

Sip settings

Outgoing

Trunk Name: Trunk_to_Site2

PEER Details: host=192.168.20.1

Username=user1

Secret=password

Type=peer

Fromuser=user1

Incoming

USER Context: user2

USER Details: secret=password

Type=user

Context=from-trunk

Outbound Routes

Route Settings

Route Name: SIP_Route_to Site2

Route CID: empty

Override Extension: No

Route Password: empty

Route Type: Nothing chosen

Music On Hold: default

Time Group: Permanent Route

Route Position: No Change

Trunk Sequence for Matched Routes: SIP_Trunk_to_Site2

Optional destination on Congestion: Normal Congestion

Dial Patterns

[prepend] prefix| [32XX]/caller id]

Import/Export Patterns nothing

Notifications

Email to: empty

Email from: [email protected]

Email Subject: PBX: A call has been placed via outbound route: {{ROUTENAME}}

Email Body: bla bla bla

Additional settings

Call recording: Do not care

PIN set: empty

Ibound routes

Nothing set

===========================================================

Trunk configuration for site 2 (secong site)

General

Trunk Name: SIP_Trunk_to _Site1

Hide callerID: No

Otbound callerID: empty

CID Options: Allow Any SID

Maximum channel: empty

Asterisk trunk Dial Options: T

System

Continue if Busy: No

Disable Trunk: No

Monitor Trunk Failures: No

Dialed Number Manipulation Rules

Everytimg is empty including Outbound Dial Prefix

Sip settings

Outgoing

Trunk Name: Trunk_to_Site1

PEER Details: host=192.168.10.1

Username=user2

Secret=password

Type=peer

Fromuser=user2

Incoming

USER Context: user1

USER Details: secret=password

Type=user

Context=from-trunk

Outbound Routes

Route Settings

Route Name: SIP_Route_to Site1

Route CID: empty

Override Extension: No

Route Password: empty

Route Type: Nothing chosen

Music On Hold: default

Time Group: Permanent Route

Route Position: No Change

Trunk Sequence for Matched Routes: SIP_Trunk_to_Site1

Optional destination on Congestion: Normal Congestion

Dial Patterns

[prepend] prefix| [34XX]/caller id]

Import/Export Patterns nothing

Notifications

Email to: empty

Email from: [email protected]

Email Subject: PBX: A call has been placed via outbound route: {{ROUTENAME}}

Email Body: bla bla bla

Additional settings

Call recording: Do not care

PIN set: empty

Ibound routes

Nothing set

The logs:

And there is the log from Site2 trying to call the IVR on Site1:
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] netsock2.c: Using SIP VIDEO TOS bits 136
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] netsock2.c: Using SIP VIDEO CoS mark 6
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] netsock2.c: Using SIP RTP TOS bits 184
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] netsock2.c: Using SIP RTP CoS mark 5
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: SIP/Trunk_to_Site1-0000000e Internal Gosub(func-apply-sipheaders,s,1(3)) start
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:1] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?Set(CHANNEL(hangup_handler_push)=crm-hangup,s,1)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:2] NoOp(“SIP/Trunk_to_Site1-0000000e”, “Applying SIP Headers to channel SIP/Trunk_to_Site1-0000000e”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:3] Set(“SIP/Trunk_to_Site1-0000000e”, “TECH=SIP”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:4] Set(“SIP/Trunk_to_Site1-0000000e”, “SIPHEADERKEYS=Alert-Info”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:5] While(“SIP/Trunk_to_Site1-0000000e”, “1”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:6] Set(“SIP/Trunk_to_Site1-0000000e”, “sipheader=unset”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:7] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “1?SIPRemoveHeader(Alert-Info:)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:8] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?Set(PJSIP_HEADER(remove,Alert-Info)=)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:9] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?Set(sipheader=http://127.0.0.1;info=unset)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:10] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?Set(sipheader=http://127.0.0.1unset)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:11] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?SIPAddHeader(Alert-Info:unset)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:12] ExecIf(“SIP/Trunk_to_Site1-0000000e”, “0?Set(PJSIP_HEADER(add,Alert-Info)=unset)”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:13] EndWhile(“SIP/Trunk_to_Site1-0000000e”, “”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:5] While(“SIP/Trunk_to_Site1-0000000e”, “0”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@func-apply-sipheaders:14] Return(“SIP/Trunk_to_Site1-0000000e”, “”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: Spawn extension (from-trunk-sip-Trunk_to_Site1, 3400, 1) exited non-zero on ‘SIP/Trunk_to_Site1-0000000e’
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: SIP/Trunk_to_Site1-0000000e Internal Gosub(func-apply-sipheaders,s,1(3)) complete GOSUB_RETVAL=
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_dial.c: Called SIP/Trunk_to_Site1/3400
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_dial.c: SIP/Trunk_to_Site1-0000000e answered SIP/3222-0000000d
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: SIP/Trunk_to_Site1-0000000e Internal Gosub(sub-send-obroute-email,s,1(3400,3400,3,1614850334,col. S.Paskalev,3222)) start
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@sub-send-obroute-email:1] GotoIf(“SIP/Trunk_to_Site1-0000000e”, “0?sendEmail”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@sub-send-obroute-email:2] NoOp(“SIP/Trunk_to_Site1-0000000e”, “email notifications disabled…exiting.”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] pbx.c: Executing [s@sub-send-obroute-email:3] Return(“SIP/Trunk_to_Site1-0000000e”, “”) in new stack
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: Spawn extension (from-trunk-sip-Trunk_to_Site1, , 1) exited non-zero on ‘SIP/Trunk_to_Site1-0000000e’
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] app_stack.c: SIP/Trunk_to_Site1-0000000e Internal Gosub(sub-send-obroute-email,s,1(3400,3400,3,1614850334,col. S.Paskalev,3222)) complete GOSUB_RETVAL=
[2021-03-04 11:32:15] VERBOSE[15290][C-00000007] bridge_channel.c: Channel SIP/Trunk_to_Site1-0000000e joined ‘simple_bridge’ basic-bridge <0692f1c7-49eb-498d-98f6-68c3eac9ba7f>
[2021-03-04 11:32:15] VERBOSE[15264][C-00000007] bridge_channel.c: Channel SIP/3222-0000000d joined ‘simple_bridge’ basic-bridge <0692f1c7-49eb-498d-98f6-68c3eac9ba7f>
[2021-03-04 11:32:26] VERBOSE[15290][C-00000007] bridge_channel.c: Channel SIP/Trunk_to_Site1-0000000e left ‘simple_bridge’ basic-bridge <0692f1c7-49eb-498d-98f6-68c3eac9ba7f>
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] bridge_channel.c: Channel SIP/3222-0000000d left ‘simple_bridge’ basic-bridge <0692f1c7-49eb-498d-98f6-68c3eac9ba7f>
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] app_macro.c: Spawn extension (macro-dialout-trunk, s, 33) exited non-zero on ‘SIP/3222-0000000d’ in macro ‘dialout-trunk’
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Spawn extension (from-internal, 3400, 11) exited non-zero on ‘SIP/3222-0000000d’
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [h@from-internal:1] Macro(“SIP/3222-0000000d”, “hangupcall”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@macro-hangupcall:1] GotoIf(“SIP/3222-0000000d”, “1?theend”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@macro-hangupcall:3] ExecIf(“SIP/3222-0000000d”, “0?Set(CDR(recordingfile)=)”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@macro-hangupcall:4] Hangup(“SIP/3222-0000000d”, “”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] app_macro.c: Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/3222-0000000d’ in macro ‘hangupcall’
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/3222-0000000d’
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] app_stack.c: SIP/3222-0000000d Internal Gosub(crm-hangup,s,1) start
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:1] NoOp(“SIP/3222-0000000d”, “Sending Hangup to CRM”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:2] NoOp(“SIP/3222-0000000d”, “HANGUP CAUSE: 16”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:3] ExecIf(“SIP/3222-0000000d”, “0?Set(__CRM_VOICEMAIL=)”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:4] NoOp(“SIP/3222-0000000d”, “MASTER CHANNEL: 1614850334.13 = 1614850334.13”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:5] GotoIf(“SIP/3222-0000000d”, “0?return”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:6] Set(“SIP/3222-0000000d”, “__CRM_HANGUP=1”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:7] AGI(“SIP/3222-0000000d”, “sangomacrm.agi”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] res_agi.c: Launched AGI Script /var/lib/asterisk/agi-bin/sangomacrm.agi
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] res_agi.c: <SIP/3222-0000000d>AGI Script sangomacrm.agi completed, returning 0
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] pbx.c: Executing [s@crm-hangup:8] Return(“SIP/3222-0000000d”, “”) in new stack
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] app_stack.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/3222-0000000d’
[2021-03-04 11:32:26] VERBOSE[15264][C-00000007] app_stack.c: SIP/3222-0000000d Internal Gosub(crm-hangup,s,1) complete GOSUB_RETVAL=

I’ve forgotten to place the log file from Site1.
There it is:
[2021-03-04 11:32:15] VERBOSE[1985][C-00000030] netsock2.c: Using SIP VIDEO TOS bits 136
[2021-03-04 11:32:15] VERBOSE[1985][C-00000030] netsock2.c: Using SIP VIDEO CoS mark 6
[2021-03-04 11:32:15] VERBOSE[1985][C-00000030] netsock2.c: Using SIP RTP TOS bits 184
[2021-03-04 11:32:15] VERBOSE[1985][C-00000030] netsock2.c: Using SIP RTP CoS mark 5
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [3400@from-trunk:1] Set(“SIP/user2-00000041”, “__FROM_DID=3400”) in new stack
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [3400@from-trunk:2] NoOp(“SIP/user2-00000041”, “Received an unknown call with DID set to 3400”) in new stack
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [3400@from-trunk:3] Goto(“SIP/user2-00000041”, “s,a2”) in new stack
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx_builtins.c: Goto (from-trunk,s,2)
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:2] Answer(“SIP/user2-00000041”, “”) in new stack
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:3] Log(“SIP/user2-00000041”, “WARNING,Friendly Scanner from 10.150.33.2”) in new stack
[2021-03-04 11:32:15] WARNING[4732][C-00000030] Ext. s: Friendly Scanner from 10.150.33.2
[2021-03-04 11:32:15] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:4] Wait(“SIP/user2-00000041”, “2”) in new stack
[2021-03-04 11:32:17] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:5] Playback(“SIP/user2-00000041”, “ss-noservice”) in new stack
[2021-03-04 11:32:17] VERBOSE[4732][C-00000030] file.c: <SIP/user2-00000041> Playing ‘ss-noservice.ulaw’ (language ‘en’)
[2021-03-04 11:32:22] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:6] SayAlpha(“SIP/user2-00000041”, “3400”) in new stack
[2021-03-04 11:32:22] VERBOSE[4732][C-00000030] file.c: <SIP/user2-00000041> Playing ‘digits/3.ulaw’ (language ‘en’)
[2021-03-04 11:32:23] VERBOSE[4732][C-00000030] file.c: <SIP/user2-00000041> Playing ‘digits/4.ulaw’ (language ‘en’)
[2021-03-04 11:32:24] VERBOSE[4732][C-00000030] file.c: <SIP/user2-00000041> Playing ‘digits/0.ulaw’ (language ‘en’)
[2021-03-04 11:32:25] VERBOSE[4732][C-00000030] file.c: <SIP/user2-00000041> Playing ‘digits/0.ulaw’ (language ‘en’)
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Executing [s@from-trunk:7] Hangup(“SIP/user2-00000041”, “”) in new stack
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Spawn extension (from-trunk, s, 7) exited non-zero on ‘SIP/user2-00000041’
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Executing [h@from-trunk:1] Macro(“SIP/user2-00000041”, “hangupcall,”) in new stack
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Executing [s@macro-hangupcall:1] GotoIf(“SIP/user2-00000041”, “1?theend”) in new stack
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx_builtins.c: Goto (macro-hangupcall,s,3)
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Executing [s@macro-hangupcall:3] ExecIf(“SIP/user2-00000041”, “0?Set(CDR(recordingfile)=)”) in new stack
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Executing [s@macro-hangupcall:4] Hangup(“SIP/user2-00000041”, “”) in new stack
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] app_macro.c: Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/user2-00000041’ in macro ‘hangupcall’
[2021-03-04 11:32:26] VERBOSE[4732][C-00000030] pbx.c: Spawn extension (from-trunk, h, 1) exited non-zero on ‘SIP/user2-00000041’
[2021-03-04 11:37:02] VERBOSE[1911] asterisk.c: Remote UNIX connection
[2021-03-04 11:37:02] VERBOSE[5117] asterisk.c: Remote UNIX connection disconnected
[2021-03-04 11:37:02] VERBOSE[1911] asterisk.c: Remote UNIX connection
[2021-03-04 11:37:02] VERBOSE[5119] asterisk.c: Remote UNIX connection disconnected

And may be I have to expain that the extension 3222 from Site 2 is trying to call extension 3400 on Site1. The 3400 is a Misc application on Site1 with the next settings:
Enable: Yes
Description: reach IVR by extension
Feature Code: 3400
Destination: IVR
Welcome IVR

The voice responce (the one site2 hear) is something like - “The number is not in service”

On Site 1, create an Inbound Route with DID Number set to 3400 and CallerID Number left blank. Set the Destination to the desired IVR. Test.

Thank you very much #Stewart1!!! This solved my problem.
I suspect that it is relatet to the inbound routes … but was not confident (lack of expirience with FreePBX).
Thanks again!!!

Isn’t the preferred method of tying two FreePBX (asterisk) systems together to us an IAX trunk? Would there be any benefits (or drawbacks) in this specific situation to using IAX trunk over a SIP?

Yes it is #ashcortech. As a matter of fact the firs trunk I prepared was an IAX trunk. This is the prefered method according to all FreePBX gurus. But … I have a big problem with making video calls. Many of the codecs are missing in the IAX trunk configuration. Because of this my next attempt was with SIP trunk. And … everything works just fine. So I will be glad if you can share your experiance with IAX trunks.

A dubious claim. IAX is preferred by beginners because it’s slightly easier to config NAT traversal and there are many ancient setup tutorials on the web so you can set it up without understanding how it works.

I don’t want to make it sound like I’m gatekeeping here, obviously everyone should use what works for them, but there are advantages to using sip over IAX.

I just remember from the Asterisk classes I took a long time ago that AIX was specifically created for asterisk system interconnects. Specifically to make it easy and efficient. IRL I’m really only using them for one client who has several offices and wants to be able to direct dial extensions from any office to any other.

What are the advantages of SIP over AIX in that situation?

I guess as hmaznev mentioned video calls would be one issue.

Agree … absolutely agree wit you Lgaetz

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