Precedence of Emergency Call

I have configured RasPBX with FreePBX v15, configured SIP Extensions to be used for Public Announcement System.

Now I want that If anyone announcing something by dialling the Extension currently and at the same time I have to do an Emergency announcement by dialling same Extension, how can I do it?

Is there any way to have precedence of such Emergency call?

Can we use barge-in or Chan spy to achieve the same?

If yes how to go about it?

exten => _*223x.#,1,Macro(user-callerid,)
exten => _*223x.#,n,Answer
exten => _*223x.#,n,NoCDR
exten => _*223x.#,n,Wait(1)
exten => _*223x.#,n,ChanSpy(sip/${EXTEN:4},qw)
exten => _*223x.#,n,Hangup

After reading little bit about the ChanSpy App, I understood that its used to listen to or barge into the current call.

In my case, I have a Public Announcement system. If someone dials the SIP Extension and starts announcing and lets say at the same time there is emergency and I want to play the Emergency Siren on that PA system by dialling same number, PA should drop the current call and proceed with Emergency Siren.

So I doubt whether ChanSpy will be helpful for my used case.

Since I want to stop the ongoing calls, I have written a bash script:

#!/bin/bash -xv
/usr/sbin/asterisk -r -x ‘core show channels’ | grep “Dial” | awk ‘{ print $1 }’ > /root/scripts/OnGoing_calls.txt
while IFS= read -r line
/usr/sbin/asterisk -r -x ‘channel request hangup $line’
done < /root/scripts/OnGoing_calls.txt

The issue is that asterisk command not recognising Bash variable.

How can I proceed in this case?

for variable expansion use double quotes

It should be possible to use the ACL: asterisk -rx “hangup request channelname”.

By running the “core show channels”, one should be able to find the SIP extension that is being used for the paging.

Once the call is killed, your emergency page can be implemented.

I would use PHP via tha AGI command to find a kill the existing call.

you mean to say that I should fire below command:

/usr/sbin/asterisk -r -x “channel request hangup $line”

Hear $line is bash variable which contains the Sip channel for on going call

If you can guide me for the same. I am new to this set up

So, um…why are we reinventing the wheel here?

Applications > Paging and Intercom

Create two Page Groups; one for normal announcements, one for the Emergencies. Set the Emergency page group Busy Extensions to either Force (if the endpoints support it) or Whisper (which injects the Emergency page audio over top of the current call in progress, if your endpoint doesn’t support Force).

Unless your endpoints don’t support the forced intercom calls and whisper is unacceptable in your environment, I see no need to go to all the effort put forth above. :man_shrugging:

The endpoint in my case is Raspberry Pi configured as a PA Client with Sip Extension.

How can be assured that this PA Client support “Busy Extensions” to be configured either “Force” or “Whisper”

I have created Two Paging groups and configured Bust Extensions “Force” for Emergency Group:

==> 1st Group is for emergency group 3001 which has all the Extensions
==> 2nd Group is only for Public Announcement System, which includes couple of extensions such as 5007, 3777 and 4901

I dialled 5007 Ext for announcement.
Then after I dialled emergency group 3001, Ext 5007 receive the emergency call but does not disconnect the 1st call.

Try Whisper. This is the option that will play the Emergency page audio over top of the non-emergency page if the line is in use at the time. This option will also force the same behavior on everyone’s phones. If they are on a call when the emergency page comes in, the audio will be whispered to them…meaning that the person they are speaking with will NOT be able to hear the emergency page audio on their end, but the employee will, ensuring some privacy.

I am missing out something in my testing
Please allow me sometime, I will test and get back.

1 Like

I have created Two Group:

A) Emergency Group “7001”: Below extensions are the members of it

2001 - 2008

B) Normal Group “7002”: This group also has all the same members as mentioned above.

And I have set up the “Busy Extension” as “Whisper”

I understand that if I dial “7002” and at the time if Emergency call is initiated by dialling “7001”, Emergency audio will be played in the background when the 1st call is still active.

My query is what if I have dialled individual Extension e.g. “2002” and making announcement and emergency group “7001” is dialled, in this will the “whisper” setting will work or it will work only when “7002” is initiated?

And what would happen for “Force” setting in above scenario

Try it?

I’m not sure from your description what your expectation is, so it’s hard to say what’s going to happen. The Ring Groups are unrelated, so whatever you do in the 7001 Ring Group should happen anyplace it’s used.

Ok…I think you are confusing this a bit…

On which Page Group? Both of them or just the Emergency 7001?

  • If only Emergency 7001 HAS Whisper and Normal 7002 does NOT, Normal 7002 will NOT be able to interrupt Emergency.
  • If BOTH have Whisper set, either 7001 OR 7002 will be able to interrupt (play over) the other…BUT, while NOT having Whisper enabled on Normal 7002 would prevent it from interrupting Emergency pages, it will ALSO prevent it from speaking the Normal page to those who are on a call even when there is not an Emergency, which may or may not be desired behavior.

Using FORCE will have varying effects depending on the Devices involved, with most of them merely treating the Page call like any other “call waiting” type of call if they are already busy…there will be no announcement played for them unless they actually ANSWER that Page call, which would place their original call on hold or hang up on them. It is nonsensical in that way, as most modern devices won’t actually force the announcement to be heard without requiring user intervention to switch calls.

You should definitely use WHISPER as your Busy option. I don’t know of any modern devices that behave with FORCE like you’d expect them to, making the option useless. Whisper is very much “device agnostic,” as Asterisk is merely mixing in the Page audio with the existing call directly at the PBX, requiring no action or explicit support from SIP/PJSIP devices.

Since WHISPER and FORCE only apply to devices on a call at the time, neither option will affect how idle phones behave when a Page call comes in. Most devices support the intercom auto-answer by default, but some will require an extra option to be enabled in their config if their intercom auto-answer is disabled by default.

I am really confused as the test results are not as per the theory here.

As mentioned earlier, If have Two paging groups with same members.

And I want that if any Sip Extension has called another Sip Extension and at the same time Emergency Paging group is dialled so that in will interrupt the current call and will be able to do the emergency announcement what setting should I have on this both Paging group.

7001 paging group for emergency
7002 paging group for normal

Please suggest