Asterisk Manager Interface (AMI) questions

I am trying to build a custom application that uses AMI to dial a customer, then start and stop recording the call.

I’m running Asterisk (the packaged binary in Debian 6.0 Squeeze).

I’m currently having three issues:

First, I cannot find a way to be sure that after issuing a “monitor” command in the AMI, the monitoring has actually started. If I have disk issues (for example, I am out of space or cannot write to the monitor file) I get an error in the console but I get a “success” response in the AMI. I have even tried to use a trick (rename the file after starting the monitoring) but I still get a success response even if the file does not exist or cannot be written to disk. The only error I get is if I try to monitor a non-existent channel. Is there some solution to this issue?

By the way, I have also tried using the “command” action to run a “mixmonitor” console command from the AMI. It does work, but again if it cannot actually write to the disk I get an error in console, but no errors at all in the AMI.

Second: I cannot find a way to play an audio file to a channel from the AMI. It seems I can only play DTMF tones. Is there some workaround to play a sound file to an already connected channel from AMI? My goal was to play an audio file that says something like “recording started” just after I have started recording.

Third: I have googled for some hours, but I still haven’t found documentation about which new AMI commands are available in the various Asterisk versions. I have been able to see commands up to 1.6, but I could not find a description of new commands for 1.8 and 1.10. I did not want to install 1.8 and 1.10 just to see which new AMI commands are available. Where can i find a list? Can someone please post a “manager show commands” output for 1.8 and 1.10?

Thanks to anyone who can help an asterisk newbie.


i think that using callfile would be an easier approach than ami in your case.

to make outbound call and start/stop recording, you can put a callfile in /var/spool/asterisk/outgoing and Asterisk will pick it and perform the outbound calling.

the callfile would look like: (assuming that you reach your customer via sip/xxxxxxxx)

channel: sip/xxxxxxxx

upon your customer answering the call, asterisk will execute the logic in your extensions.conf,
exten => take_recording,1,answer
exten => take_recording,2,wait(1)
exten => take_recording,3,Monitor(wav,myfile)

Answer() will do nothing here, as the call is already up before the dialplan starts running.

Thanks for you answer, but I think that this is not what I’m looking for.

My setup is for a call center where each operator has a workflow like this:

  • call a customer (done via AMI using action: originate)
  • talk to the customer (without recording)
  • ONLY IF NEEDED, the operator starts recording the call
  • when needed, the operator stops recording
  • the operator hangs up and calls the next customer.

Since I do not want to record EVERY call, and I do not want to record it from the beginning to the end, I need a way to start and stop recording while the call is already establised. Also, the operator does not know if he will need to record the call until he is in the middle of the call.

I have managed to do it with AMI, with the only issue that I cannot be positively sure that the recording is actually REALLY working, and I absolutely need to know that the recording has been done properly, because it has to be done by law.

I suspect the underlying requirement here is that the credit card industry does not permit the CVV code to appear on a recording, even if the recording is immediately destroyed.