• News
  • Idefisk
  • Tools
  • Tutorials
  • Forum
  • Reviews
  • VoIP Providers
  • Archives
  • Gallery
ZOIPER softphone
Back to Tutorials

6.1.2.49. Monitor (dialplan application)

1. Monitor - this application allows you to record a conversation.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

Monitor([file_format|[fname_base]|[options]]) ; by default the file format is .wav

 


List with the possible options

1) m - with this option the input and output audio files will be mixed automatically into one file.


When you are using the "m" option you dispose of three variations. The first one is: just to use the option "m" without changing anything else. This will cause the Asterisk PBX to mix up the input and output files in one joint file. The two separate files(input and output) will be deleted. The file which will remain is the joint file. The mixing up process will be handled by the UNIX program soxmix.

The second option is to set the "m" option and to set the variable MONITOR_EXEC. This variable is responsible for the program which will mix up the input and output files. You can set here another program, different from soxmix, for mixing up. However, if you use another program, there is a possibility the input and output not to be deleted after the mix process is over. This depends on the used program.

Soxmix and MONITOR_EXEC can take three arguments. The first one is the name of the input file, the next one is the name of the output file and the last one is the desired name for the mixed file. You can skip only the last parameter. In this case, the name of the mixed file will be the same as the input and output files, without the in/out suffixes.

The third option is to use the variable MONITOR_EXEC_ARGS. When it is set, the contents will be passed on as additional arguments to MONITOR_EXEC


2) b - with this option the call won’t be connected until it is bridged to another channel.

 


Purpose and usage

By the help of this application you can record your conversations. They will be recorded in two separated files. The output audio will be recorded in one file and the input audio in the separate one.

One of the best features of this application is that it can mix up the two separate files into one joint file automatically. You have only to set the special option. You also need an installed soxmix application.

It will record the input and output sounds and if you want it can even mix up them in one joint file.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

 


Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.

We need two registered user in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.



So, we have registered the user anatoliy and ivan

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.



On the picture above you can see our extensions.conf file.

So, in our example when somebody dials 12345, the call will be answered by the Answer application. The next executed extension will be the one which contains the Monitor application. We want the format of the audio files to be .wav. So, as first argument we will set wav. The next argument is for the name of the file. We have set it to proba. Finally, we want our input and output audio files to be mixed up in one joint file. So, we have set, as last argument, the option m. The system will use the soxmix UNIX program to perform the task. When the process finishes, the input and output files will be deleted and the only file, which will remain, is the joint file. The directory, where the file will be put by default is /var/spool/asterisk/monitor. You can change it in the asterisk.conf file.

If your system does not have installed soxmix, you can install it by typing apt-get install sox.

The next executed extension will be the one with the Dial application. Thanks to it, the call will be connected with the user ivan through the IAX2 channel. Remember that the channel is monitored and the conversation will be recorded. The monitoring of the channel will continue until either the StopMonitor application is executed or the line is hung up.

In order to be sure, that the Asterisk PBX will hang up the line after the conversation is over, it is always a good idea to make an extension for hanging up.

 


2. Screenshots of what you can see on the CLI of the Asterisk PBX



 


3. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

 

 
User Comments
Sheikh Ashil (sheikh_ashil at yahoo dot com)
27 March 2008 06:59:43
I am facing the same problem as Mehul. Can anybody explain even after two years, how to change the directory where the sound files are stored?
dinesh (dineshsunder dot k at dexterity dot in)
24 October 2007 08:29:08
hello sir,

i need to change the default directory of the monitor folder to some other directory.could you please help me out??

Regards.
rahul (rahul at digitalhubindia dot com)
31 October 2006 16:10:35
well i am trying to record files by having this configuration below
the calls are getting recorded but voice quality of calls is very poor i am using g729 from digium

please help what may be wrong in this

[outgoing]
exten => _X.,1,monitor(wav|${CALLERIDNAME}|m)
exten => _X.,2,Dial(SIP/${EXTEN}@85.90.227.72)
exten => _X.,3,Hangup
Jas (jas at backshall dot id dot au)
25 September 2006 08:50:13
Great - I've been looking for something like this!

Out of curiosity, is it at all possible to increment the file name by 1 every time this application is used?

For example..

recording1.wav
recording2.wav

Any ideas? At present, it just appears to write over the previous recording
Dov (dov dot listas at gmail dot com)
27 April 2006 19:58:31
What are the possible file formats?
Lacho (support at asteriskguru dot com)
26 December 2005 15:59:31
HI Mehul,

There is one way to achieve what you want - as you could see the second argument in the application is for the name of the file. If you write not only the filename, but also the whole new path, the Asterisk will use this path instead of the one set in the asterisk.conf file. I know it is not the best way but I think there is no other.

Regards
Mehul Shah (shahmehulmca at gmail dot com)
26 December 2005 12:56:51
Hello Sir,

I want to change the default directory of only and only of Monitor folder, how can i do that. If i change the astspooldir => /var/spool/asterisk path than it will chage the path of rest of the service but i only want to change the path of Monitor folder which stores the in and out or combination of in/out files to be recorded. Pls. suggest me what to do.
 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • Sending Fax from Zoiper to Zoiper using T.38
    added 08/Dec/2008 18:16
  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53

Latest Comments:

  • nice...
    tutorial: X-Lite - SIP softphone
  • Badly need your help. Things are only im...
    tutorial: Grandstream HandyTone-486 - SIP Analog Telephone Adapter (ATA)
  • how do i rectify this problem? all incom...
    tutorial: Troubleshooting
  • How are you. Summer afternoon - Summer a...
    tutorial: Cisco 7960 IP Phone - SIP firmware version
  • where is the tar file you mention above ...
    tutorial: Cisco 7960 IP Phone - SIP firmware version
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™