Recording calls originated from script


I have a PHP script running on a box with Asterisk 11 and FreePBX that works like this:
When a person clicks a button on a special (internal) webpage, the PBX dials the user’s extension; then when they pick up, it dials the number from the phone list that they selected on the web page.
All works fine, except I need the calls to be recorded. I’ve got all the recording checkboxes checked for the extension, but still Asterisk is not recording the call. If I just dial out normally with the phone, it records fine.

My script opens a socket to Asterisk, and sends the following (example):

Action: Originate
Channel: SIP/101
Exten: 18004444444
CallerID: 5852222222
Context: from-internal
Priority: 1
Async: yes
Action: Monitor

What must I do to enable these calls to be recorded?

I did notice a very similar question that was unanswered in the past:

Surely there must be a way to accomplish this. Thanks!


To take advantage of all the FreePBX dialplan, you want to originate to a channel like this:

local/[email protected]

You will want to set a timeout that is shorter than the time it takes for the extension VM to answer.

Thanks for the reply! So do I use your example text in the "Channel: " line?

You mention that I should have a small timeout. What would be an example? Usually the first part, picking up the call on the person’s phone, is like a couple seconds.


freepbx*CLI> manager show command Originate


    How long to wait for call to be answered (in ms.).

If your user doesn’t answer the call, voicemail will, and the AMI will happily bridge the external call to voicemail. Use the Timeout param to prevent that.

Ok, progress! So changing the Channel as you mentioned worked, BUT the recording shows up on the wrong CDR line. There are two entries in the CDR database: the call from the PBX to the Phone, and the call out to the final destination. The recording shows up in the call from the PBX to the station, instead of the call to the destination person.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.