How to play and record wav in Asterisk

asteriskfreepbx

Please, how could I do these things on asterisk:

1) Externally (with some API) make a call from asterisk and play wav and hangup the call
2) How should I configure the extension/route/whatever on the another asterisk so it will pickup the call and record the wav?

Thanks.

Best Answer

To generate a call using the Asterisk Manager Interface (AMI), first you will need to write a dialplan context in /etc/asterisk/extensions.conf that performs the desired actions after the call is connected. (Playback a sound, then hangup.) From the external system, use AMI to Login and Originate a call to the desired destination. In the originate action, point the call to the context and extension of the dialplan you created. When the call connects, Asterisk will perform the actions you specified in the dialplan.

To answer a call and record it, create another dialplan context that uses the Answer and Record applications. When the extension is called, Asterisk will answer and begin recording.