I am developing MikoPBX - an easy-to-configure PBX based on Asterisk 16.
Recently we decided to add the functionality of the notification about the recording of the conversation. The task was formulated as follows:
The notification should be triggered once, immediately after the client connects with the company employee. The alert must be heard by all participants in the call.
Connecting modules
It was decided to use the functionality of the ChanSpy application .
First, you need to make sure that the required modules are loaded when you start asterisk. Add to modules.conf :
load => app_chanspy.so load => app_originate.so
Dialplan implementation
extensions.conf, global:
[globals] PBX_REC_ANNONCE=/var/mikopbx/media/custom/alert
dialplan
[annonce-spy]
exten => _.!,1,ExecIf($[ "${EXTEN}" == "h" ]?Hangup()
same => n,Set(chan=PJSIP/${EXTEN})
; .
same => n,ExecIf($["${CHANNELS(${chan})}x" != "x"]?Chanspy(${chan},uBq))
same => n,Hangup()
[annonce-play]
exten => annonce,1,Answer()
;
same => n,Playback(${PBX_REC_ANNONCE})
same => n,Hangup()
, :
Originate(Local/${chan}@annonce-spy,exten,annonce-playback-in,annonce,1,10,a);
"a" - ,
"chan" - , .
Local/${chan}@annonce-spy - Chanspy
"10" - ${chan}@annonce-spy,
exten,annonce-playback-in,annonce,1 - Playback
Let's add the incoming dialplan. In the Dial application, we use the " U " option to intercept the moment when the subscribers are connected:
[incoming]
exten => _XXX,1,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})},60,U(dial-answer))
[dial-answer]
exten => _[0-9*#+]!,1,Set(chan=${CUT(CHANNEL,/,2)})
same => n,Originate(Local/${chan}@annonce-spy,exten,annonce-play,annonce,1,2,a);
same => n,return
Now it remains to test the inbox. Similarly, you can implement notification for outgoing calls.
Conclusion
Relatively simple, without using AGI, only on the basis of dialplan applications it is possible to implement the notification about the recording of conversations.
Oddly enough, there is quite a bit of information on this topic on the net.
I hope this article will be useful to the reader.