Date created: Tuesday, May 21, 2013 3:28:22 PM. Last modified: Tuesday, February 24, 2015 11:49:03 AM

Call Recording With Pause

Set up call monitoring (recording) under the dial plan (extensions.conf) for all calls into our main number "123456789";

[main-numbers]
exten => 123456789,1,Monitor(wav,${STRFTIME(${EPOCH},,%Y-%m-%d--%H-%M-%S)} ${CALLERID(num)} to ${EXTEN},m)
exten => 123456789,1,n,Set(DYNAMIC_FEATURES=InPause#InUnpause)
exten => 123456789,1,n,Dial(SIP/584,60)
exten => 123456789,1,n,Hangup()

;Set the recording type to wav and a file name of "YYYY-MM-DD--H-M-S CALLERID to EXTENSIONID". The 'm' option merges the caller and called party audio streams into one mixed down file
;Set the variable DYNAMIC_FEATURES to equal a hash '#' separated list of features in features.conf we want to enable for this call
;Dial the receptionist at SIP extension 584


Set up two macro's in our dial plan also, so we can do more when pausing and unpausing the recording;

[macro-recpause]
exten => s,1,Playback(/var/lib/asterisk/sounds/beep)
exten => s,n,NoOp(Call Paused - Channel=${CHANNEL} BrigdePeer=${BRIDGEPEER})
exten => s,n,PauseMonitor

[macro-recunpause]
exten => s,1,Playback(/var/lib/asterisk/sounds/beep)
exten => s,n,NoOp(Call Unpaused - Channel=${CHANNEL} BrigdePeer=${BRIDGEPEER})
exten => s,n,UnpauseMonitor


Set up two features in features.conf that can be activated during a call to pause and unpause call recording;

InPause         => #1,peer/callee,Macro,recpause
InUnpause       => #3,peer/callee,Macro,recunpause

; Dialing #1 during an active call from the peer phone (the phone that was called, reception in this example!) will initiate our macro above called "recpause"
; Dialing #3 from the peer calls the recunpause macro. We want the internal operator to be in control of this feature, nor the external party calling in.


In this example calls will be saved in a default location such as /var/spool/asterisk/monitor. A beep sound is plaid to the caller to let them know when the recording is stopped or started.

If we wanted a beep plaid to the callee/receptionist also we would need to do two things. Firstly, create a custom entry for hold music that plays a single beep in musiconhold.conf;

  [beep]
  mode=files
  directory=/var/lib/asterisk/moh/beep/
  ; Directory that contains one file which is a single beep sound

Now change the features.conf entries to include the hold music;

InPause         => #1,peer/callee,Macro,recpause,beep
InUnpause       => #3,peer/callee,Macro,recunpause,beep

The Playback() function in the macro's only plays to the bridger peer, which is the party calling in, not the callee/receptionist. This music on hold is plaid to the person triggering the feature, so the callee/receptionsit. Now both parties hear a beep. However, if custom hold music is already applied to this extension through AGI or similar this won't work, also if call recording is defined else where in the dial plan or via AGI it might class and no audio will be recorded at all.


Previous page: Basic SIP Trunk
Next page: DAHDI Monitoring