Forwarding call to two endpoints not working

In my paging project, the same page must reach two different endpoints. This is my current (non-working) dial plan and related logs:

extensions.conf:

[Lynd-default]
; Forward calls to 901 and 904 and handle DTMF
exten => 902,1,NoOp(Processing call forwarded to 901 and 904)
same => n,Dial(PJSIP/3cx-trunk/sip:901@3CXPublicIP&PJSIP/3cx-trunk/sip:904@3CXPublicIP,30,aU(Lynd-send-dtmf)) ; Simultaneous calls with DTMF
same => n,Hangup()

[Lynd-send-dtmf]
; Subroutine to send DTMF tones and playback demo-thanks
exten => s,1,NoOp(Sending DTMF tones and playing demo-thanks)
same => n,Wait(1) ; Wait for the call to be fully established
same => n,SendDTMF(#0) ; Send the DTMF tones
same => n,Wait(1) ; Wait briefly after sending DTMF
same => n,Playback(demo-thanks,noanswer) ; Play demo-thanks without treating as answering
same => n,Return()

Logs:

– Called 902@Lynd-default
– Executing [902@Lynd-default:1] NoOp(“Local/902@Lynd-default-0000000a;2”, “Processing call forwarded to 901 and 904”) in new stack
– Executing [902@Lynd-default:2] Dial(“Local/902@Lynd-default-0000000a;2”, “PJSIP/3cx-trunk/sip:901@3CXPublicIP&PJSIP/3cx-trunk/sip:904@3CXPublicIP,30,aU(Lynd-send-dtmf)”) in new stack
– Called PJSIP/3cx-trunk/sip:901@3CXPublicIP
– Called PJSIP/3cx-trunk/sip:904@3CXPublicIP
– PJSIP/3cx-trunk-00000010 connected line has changed. Saving it until answer for Local/902@Lynd-default-0000000a;2
– PJSIP/3cx-trunk-00000011 connected line has changed. Saving it until answer for Local/902@Lynd-default-0000000a;2
– PJSIP/3cx-trunk-00000011 is ringing
– Local/902@Lynd-default-0000000a;1 is ringing
– PJSIP/3cx-trunk-00000010 is ringing
> 0x71bf8c00ad50 – Strict RTP learning after remote address set to: 3CXPublicIP:9584
– PJSIP/3cx-trunk-00000011 answered Local/902@Lynd-default-0000000a;2
– Local/902@Lynd-default-0000000a;1 answered
> Launching Dial() on Local/902@Lynd-default-0000000a;1
– No devices or endpoints to dial (technology/resource)
– PJSIP/3cx-trunk-00000011 Internal Gosub(Lynd-send-dtmf,s,1) start
– Executing [s@Lynd-send-dtmf:1] NoOp(“PJSIP/3cx-trunk-00000011”, “Sending DTMF tones and playing demo-thanks”) in new stack
– Executing [s@Lynd-send-dtmf:2] Wait(“PJSIP/3cx-trunk-00000011”, “1”) in new stack
– Executing [s@Lynd-send-dtmf:3] SendDTMF(“PJSIP/3cx-trunk-00000011”, “#0”) in new stack
> 0x71bf8c00ad50 – Strict RTP switching to RTP target address 3CXPublicIP:9584 as source
== Spawn extension (Lynd-send-dtmf, s, 3) exited non-zero on ‘PJSIP/3cx-trunk-00000011’
[Dec 4 11:06:19] WARNING[11846][C-0000000b]: app_stack.c:1079 gosub_run: PJSIP/3cx-trunk-00000011 Abnormal ‘Gosub(Lynd-send-dtmf,s,1)’ exit. Popping routine return locations.
– Channel PJSIP/3cx-trunk-00000011 joined ‘simple_bridge’ basic-bridge
– Channel Local/902@Lynd-default-0000000a;2 joined ‘simple_bridge’ basic-bridge
– Channel PJSIP/3cx-trunk-00000011 left ‘simple_bridge’ basic-bridge
– Channel Local/902@Lynd-default-0000000a;2 left ‘simple_bridge’ basic-bridge
== Spawn extension (Lynd-default, 902, 2) exited non-zero on ‘Local/902@Lynd-default-0000000a;2’
SC3CX-Asterisk*CLI> quit
Asterisk cleanly ending (0).
Executing last minute cleanups
user@SC3CX-Asterisk:~$ sudo vim /etc/asterisk/extensions.conf
user@SC3CX-Asterisk:~$ sudo asterisk -rvvvvv
Asterisk 20.6.0~dfsg+~cs6.13.40431414-2build5, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Connected to Asterisk 20.6.0~dfsg+~cs6.13.40431414-2build5 currently running on SC3CX-Asterisk (pid = 11598)
SC3CX-AsteriskCLI> dialplan reload
Dialplan reloaded.
– Including switch ‘DUNDi/e164’ in context ‘ael-dundi-e164-switch’
– Including switch ‘Lua/’ in context ‘local’
– Including switch ‘Lua/’ in context ‘demo’
– Including switch ‘Lua/’ in context ‘public’
– Including switch ‘Lua/’ in context ‘default’
– Time to scan old dialplan and merge leftovers back into the new: 0.000598 sec
– Time to restore hints and swap in new dialplan: 0.000005 sec
– Time to delete the old dialplan: 0.000052 sec
– Total time merge_contexts_delete: 0.000655 sec
– pbx_config successfully loaded 29 contexts (enable debug for details).
SC3CX-Asterisk
CLI> channel originate Local/902@Lynd-default application Playback
– Called 902@Lynd-default
– Executing [902@Lynd-default:1] NoOp(“Local/902@Lynd-default-0000000b;2”, “Processing call forwarded to 901 and 904”) in new stack
– Executing [902@Lynd-default:2] Dial(“Local/902@Lynd-default-0000000b;2”, “PJSIP/3cx-trunk/sip:901@3CXPublicIP&PJSIP/3cx-trunk/sip:904@3CXPublicIP,30,aU(Lynd-send-dtmf)”) in new stack
– Called PJSIP/3cx-trunk/sip:901@3CXPublicIP
– Called PJSIP/3cx-trunk/sip:904@3CXPublicIP
– PJSIP/3cx-trunk-00000013 connected line has changed. Saving it until answer for Local/902@Lynd-default-0000000b;2
– PJSIP/3cx-trunk-00000012 connected line has changed. Saving it until answer for Local/902@Lynd-default-0000000b;2
– PJSIP/3cx-trunk-00000013 is ringing
– PJSIP/3cx-trunk-00000012 is ringing
– Local/902@Lynd-default-0000000b;1 is ringing
> 0x71bf800162d0 – Strict RTP learning after remote address set to: 3CXPublicIP:9590
– PJSIP/3cx-trunk-00000013 answered Local/902@Lynd-default-0000000b;2
– Local/902@Lynd-default-0000000b;1 answered
> Launching Playback() on Local/902@Lynd-default-0000000b;1
[Dec 4 11:09:52] WARNING[11861]: app_playback.c:471 playback_exec: Playback requires an argument (filename)
– PJSIP/3cx-trunk-00000013 Internal Gosub(Lynd-send-dtmf,s,1) start
– Executing [s@Lynd-send-dtmf:1] NoOp(“PJSIP/3cx-trunk-00000013”, “Sending DTMF tones and playing demo-thanks”) in new stack
– Executing [s@Lynd-send-dtmf:2] Wait(“PJSIP/3cx-trunk-00000013”, “1”) in new stack
– Executing [s@Lynd-send-dtmf:3] SendDTMF(“PJSIP/3cx-trunk-00000013”, “#0”) in new stack
> 0x71bf800162d0 – Strict RTP switching to RTP target address 3CXPublicIP:9590 as source
== Spawn extension (Lynd-send-dtmf, s, 3) exited non-zero on ‘PJSIP/3cx-trunk-00000013’
[Dec 4 11:09:54] WARNING[11862][C-0000000c]: app_stack.c:1079 gosub_run: PJSIP/3cx-trunk-00000013 Abnormal ‘Gosub(Lynd-send-dtmf,s,1)’ exit. Popping routine return locations.
– Channel PJSIP/3cx-trunk-00000013 joined ‘simple_bridge’ basic-bridge <1b3e0743-e73a-4e2c-9d7c-4098283b1362>
– Channel Local/902@Lynd-default-0000000b;2 joined ‘simple_bridge’ basic-bridge <1b3e0743-e73a-4e2c-9d7c-4098283b1362>
– Channel Local/902@Lynd-default-0000000b;2 left ‘simple_bridge’ basic-bridge <1b3e0743-e73a-4e2c-9d7c-4098283b1362>
== Spawn extension (Lynd-default, 902, 2) exited non-zero on ‘Local/902@Lynd-default-0000000b;2’
– Channel PJSIP/3cx-trunk-00000013 left ‘simple_bridge’ basic-bridge <1b3e0743-e73a-4e2c-9d7c-4098283b1362>
SC3CX-Asterisk*CLI>

The first one to answer gets the call; that is normal.

You’d have to use the Page application, within its intended scope of usage, to initiate a call that will connected to multiple parties. I suspect this won’t come within its scope.

Incidentally, I’m sure I saw the same dialplan in another thread. If there is a good reason for no continuing with the old thread, you should explain it an cross reference that thread.

OK. I will look into the page application. I knew that is where I would land, but thought I could do a lab test with what I had.

As far as cross-referencing, I will do that. Many forums require a new thread for each issue.

Thanks

That really depends on how independent the issues are. My suspicion is that what you were asking about on the other thread constrains what solutions are possible here.

I removed my last reply because it is no longer relevant.

Here is my current status and needs:

This dial plan works for me:

exten => 500,1,Answer
same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,(A(demo-thanks),i,q,n,5))
same => n,Hangup

This dial plan does not play demo-thanks:
exten => 500,1,Answer
same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,i,q,n,5)
same => n,Playback(demo-thanks)
same => n,Hangup

I am not sure why “Playback” does not work, but my end goal is to delay playing demo-thanks by 2 seconds, but I have not figured out how to do that with the working dial plan.

Research shows that Page and Playback do not work together because Page uses a one-way channel, and Playback uses a two-way channel. What is the best answer if I want to wait 2 seconds before playing audio or play silence before the intended audio (2 audio files)?

Both use oneway channels.

I think you are pushing the limits of what is possible, but if you want to use Playback into a paging conference, you need to run it on the B side of an Originate, and run page on a local channel, on the A side.

Based on your feedback, my buddy, ChatGPT, and I are trying to delay the playing of the audio file by 2 seconds because the Page tone is walking on the start of the audio. This is where I am at, but I am having difficulty getting past the Originate log file error below:

[Lynd-default]

; Entry point for paging
exten => 500,1,NoOp(Starting Paging with Delayed Audio Playback)
same => n,Originate(Local/paging@Lynd-default,exten,delayed-playback,Lynd-default,1)
same => n,Hangup()

; Local channel for paging
[Lynd-default]
exten => paging,1,NoOp(Paging extensions)
same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,i,q,n,5)
same => n,Hangup()

; Local channel for delayed playback
[Lynd-default]
exten => delayed-playback,1,NoOp(Playing Delayed Audio File)
same => n,Wait(2) ; Wait for 2 seconds
same => n,Playback(demo-thanks) ; Play the audio file
same => n,Hangup()

Log file:

Executing [500@Lynd-default:2] Originate(“Local/500@Lynd-default-0000002c;2”, “Local/paging@Lynd-default,app,Wait,2”) in new stack
[Dec 5 12:31:11] ERROR[19687][C-00000015]: app_originate.c:255 originate_exec: Incorrect type, it should be ‘exten’ or ‘app’:
== Spawn extension (Lynd-default, 500, 2) exited non-zero on ‘Local/500@Lynd-default-0000002c;2’
SC3CX-Asterisk*CLI>

Log does not match dialplan. Log shows invalid quoting.

I am getting that error from the following channel command:
channel originate Local/500@Lynd-default application Page
– Called 500@Lynd-default
– Executing [500@Lynd-default:1] NoOp(“Local/500@Lynd-default-0000002d;2”, “Starting Paging with Delayed Audio Playback”) in new stack
– Executing [500@Lynd-default:2] Originate(“Local/500@Lynd-default-0000002d;2”, “Local/paging@Lynd-default,app,Wait,2”) in new stack
[Dec 5 13:39:39] ERROR[19928][C-00000016]: app_originate.c:255 originate_exec: Incorrect type, it should be ‘exten’ or ‘app’:
== Spawn extension (Lynd-default, 500, 2) exited non-zero on ‘Local/500@Lynd-default-0000002d;2’

Executing [500@Lynd-default:2] Originate(“Local/500@Lynd-default-0000002c;2”,
“Local/paging@Lynd-default,app,Wait,2”) in new stack

You appear to have too many commas there.

Antony.


“640 kilobytes (of RAM) should be enough for anybody.”

  • Bill Gates

                                                Please reply to the list;
                                                      please *don't* CC me.
    
1 Like

Got it working with this:
[Lynd-default]

; Entry point for paging
exten => 500,1,NoOp(Starting Paging with Delayed Audio Playback)
same => n,Originate(Local/paging@Lynd-default,exten,Lynd-default,delayed-playback,1)
same => n,Hangup()

; Local channel for paging
exten => paging,1,NoOp(Paging extensions)
same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,i,q,n,5)
same => n,Hangup()

; Delayed playback extension
exten => delayed-playback,1,NoOp(Delayed Playback Triggered)
same => n,Wait(2) ; Wait for 2 seconds
same => n,Playback(demo-congrats) ; Play the audio file
same => n,Hangup()

You do not separate the option flags within an application’s “options” parameter with comma.

same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,i,q,n,5)

should be

same => n,Page(PJSIP/3cx-trunk/sip:500@3CXPublicIP,iqn,5)
1 Like

I didn’t realize this yesterday because my testing was done via channel commands. Today, I discovered this dial plan throws 603 declined errors when dialed from a 3cx extension. If I shorten things up the 603 errors go away but the demo-thanks file does not play. How can I keep this plan and eliminate the errors?

; Entry point for paging
exten => 901,1,NoOp(Starting Paging with Delayed Audio Playback)
same => n,Originate(Local/paging@Lynd-default,exten,Lynd-default,delayed-playback,1)
same => n,Hangup()

; Local channel for paging
exten => paging,1,NoOp(Paging extensions)
same => n,Page(PJSIP/3cx-trunk/sip:501@3CXPublicIP,iqn,5)
same => n,Hangup()

; Delayed playback extension
exten => delayed-playback,1,NoOp(Delayed Playback Triggered)
same => n,Wait(2) ; Wait for 2 seconds
same => n,Playback(demo-thanks) ; Play the audio file
same => n,Hangup()

Answer the call, so that you get a very short accepted call, rather than a call that is rejected.

The page does pick up and plays demo-thanks, but on the 3cx extension, I hear an error message and see the 603 declined logs. If it weren’t for that, everything would seem to be working as expected.

You are getting an error because you are hanging up an unanswered call on the incoming side. Answer the incoming call and either immediately hang it up, or play back something like “Paging initiated”, and hang up.

You could also do a very long Wait, so the caller hears silence, until they hang up.

I figured out what you meant after my post. I am working on it.

Thank you

This resolved the 603 error:

exten => 901,1,NoOp(Call received for 902, forwarding to 901)
same => n,Answer() ; Answer the incoming call
same => n,Wait(30)
same => n,Hangup() ; Hang up after the wait

I have moved from a paging config to a conference config because I need multiple endpoints to pick up the same call and receive dtmf tones. From what I understand both cannot be done with a simple Dial or Page config. The calls pick up fine but I have been stuck on getting the conference to disconnect from all endpoints. Ideally the initiator of the page hangs up and that terminates everyone. The Initiator should use the user_profile and end points use the listener_profile in confbridge.conf.

Here is what I have for confbridge.conf and dial plan:

confbridge:
[bridge_profile]
type=bridge
sound_join=no
sound_leave=no
sound_only_person=no ; Suppress “only person in the conference” message
end_marked=yes

[user_profile]
type=user
marked_user=yes ; Ensures conference ends when caller hangs up
dtmf_passthrough=yes
announce_join_leave=no
music_on_hold_class=none
talk_detection_events=no

[listener_profile]
type=user
marked_user=no
dtmf_passthrough=yes
announce_join_leave=no
music_on_hold_class=none
talk_detection_events=no

Dial plan:

[Lynd-default]
exten => 9001,1,NoOp(Setting up a conference for 501 and 502 ring groups)
same => n,Answer()
same => n,Set(CALLERID(all)=“3cxuser” <905>)
same => n,Set(PJSIP_HEADER(add,From)=sip:905@3CXPublicIP)
same => n,Originate(PJSIP/3cx-trunk/sip:2222222222@3CXPublicIP,exten,add-to-conference,1)
same => n,Originate(PJSIP/3cx-trunk/sip:3333333333@3CXPublicIP,exten,add-to-conference,1)
same => n,ConfBridge(9000,bridge_profile,user_profile)
same => n,Hangup()

[add-to-conference]
exten => 1,1,NoOp(Adding a channel to the conference)
same => n,ConfBridge(9000,bridge_profile,listener_profile)
same => n,Hangup()

exten => h,1,NoOp(Cleaning up after conference ends)
same => n,System(/usr/sbin/asterisk -rx ‘confbridge kick 9000 all’)
same => n,Hangup(