login | register
Wed 09 of Jul, 2008 [06:07 UTC]

voip-info.org

Discuss [5] History

Asterisk cmd Monitor

Created by: oej,Last modification on Sat 26 of Apr, 2008 [00:38 UTC] by JustRumours

Synopsis

Record a telephone conversation to a sound file

Description

  • Monitor(ext,basename)
  • Monitor(ext,basename,flags) — New feature added to CVS 2004-06-03

The Monitor command starts recording a channel. The channel's input and output voice packets are saved to separate sound files. You may change filenames during a recording by using the ChangeMonitor command. Recording continues until either the StopMonitor command is executed or the channel hangs up.
If you don't specify a full path, the file will be stored in the "monitor" subdir of the path specified with astspooldir in asterisk.conf (so default will be /var/spool/asterisk/monitor).

A more detailed description on recording with Asterisk can be found at Asterisk cmd Record.

Command Parameters

  • ext: The sound file format to save in, which will be also used as the filename extension. Default: wav

  • basename: The base filename to use when saving the sound files. If not supplied, the default basename is constructed on the channel name plus a number, for example, IAX2[foo@bar]-3. The channel's input voice packets will be saved to basename-in.ext and the output voice packets will be saved to basename-out.ext. The default location for saved files is the /var/spool/asterisk/monitor directory.

  • flags: If flags contains the letter m, then when recording finishes, Asterisk will execute a unix program to combine the two sound files into a single sound file. By default, Asterisk will execute soxmix and then delete the original two sound files. Note that sox/soxmix may not necessarily understand the sound format (e.g. alaw) and can't therefore mix the in and out files down to one single file. You may specify a different mixing method by setting the MONITOR_EXEC channel variable to the path of the unix program you wish executed, then call Monitor to begin recording. At the completion of recording, the specified unix program will be executed with three command-line parameters: the two sound files and the filename where the program should save the combined sound file. In this situation, earlier versions of Asterisk will not delete the two original sound files; it's up to your program to do that if you need/wish to. The "m" flag is settable through the manager interface. Also see b - Don't begin recording unless a call is bridged to another channel.

Example 1

When a call is sent to extension 2060, recording of the call will begin, and the caller is sent to conference number 1 with the MeetMe command.

 exten => 2060,1,Answer
 exten => 2060,2,Wait(1)
 exten => 2060,3,Monitor(wav,myfilename)
 exten => 2060,4,Meetme(1,ps)

For an extensive example of using Monitor, see:


Example 2: 512 Simultaneous Calls with Digital Recording

How to use a RAM disk to eliminate the I/O bottleneck associated with digitally recording calls via the Monitor application:

Example 3: Play beeping sound during recording

If you want peep every 15s, you should do

 exten => _X.,1,Set(LIMIT_WARNING_FILE=beep)
 exten => _X.,2,Dial(Local/mixmoncontext/#{EXTEN}||L(36000000:36000000:15000)\n)

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Comments

Comments Filter
222

333Monitor doesn't save anything

by er_maky, Tuesday 10 of June, 2008 [09:52:14 UTC]
Hi, i've problems with monitor.

I've a simple agi to test that, here is the code:


  1. !/usr/bin/perl


use Asterisk::AGI;

my $AGI = new Asterisk::AGI;


$AGI->exec(Monitor,"wav|/etc/asterisk/savedComand");

$AGI->exec(BackgroundDetect,"soundFile|500|100");

$AGI->exec(StopMonitor);




This code create the files, both savedComand-in and savedComand-out, but they are empty.
I've tried to change the extension to gsm, but it's the same.
The most strange thing here is than that code has worked fine many months until last week.
Could anyone help me please?
Thank you

222

333Only one user in the channel

by cyrilrbt, Thursday 31 of May, 2007 [17:41:24 UTC]
Apparently, Monitoring skips when a user is alone on a channel (waiting for something, for example). If there are no
commands from Asterisk for more than 5 seconds, it won't be monitored. When listening to the recorded file, 5 seconds
could have been 10 minutes during the call.
222

333Monitor Status?

by engival, Friday 18 of August, 2006 [20:40:21 UTC]
Is there a way to get a status of a channel to tell if it's being monitored/recorded, and to what filename?

via the manager API, "Action: Status" shows all channels as "Unmonitored", regardless if they're being recorded or not. (Does that "unmonitored" refer to something completely unrelated?)
222

333option b may cause audio delay

by vortex_0_o, Tuesday 04 of April, 2006 [15:33:27 UTC]
Please check before you use option b with monitor as may cause audio delay of 1 sec or greater from one side of the call.
222

333MP3 Option

by , Thursday 20 of January, 2005 [11:43:28 UTC]
Anyone like to set an extra-Option to make soxmix to mux into a mp3-file?