Record command

The Record command records the voice of the current call. It is also capable of recording a chosen call based on the provided call ID. This command is only considered in the case of third party call control. Duration, Inactivity and FinishDigits are only considered in case of API extension control.

Request parameters

Parameter name Example value Description Mandatory
CallId 345fad34 ID of the call to record audio from. If this command is in a response to a call notification, this parameter will be the ID of that call and can be omitted. yes
Duration 60 Duration until the recording will run at the most, expressed in seconds. (unless voice activity detector or call party will hang up first) no
FinishDigits 1234567890*# When one of these digits are pressed, the record command will be interrupted. no
FinishedUrl http://yourapp.com/record_finished.php This URL will be requested if the record finished. no
Format mp3 Record format supports mp3 or wav format, default is mp3. no
Inactivity 5 When voice is not detected for this amount of seconds, the record command will be finished. no
RecordPath D:/recordings If the record path is specified, the audio file will be saved in the specified location. no
Username admin The username of the account. The username and password parameters are used to authenticate the user. yes
Password abc123 Specifies the password. The username and password parameters are used to authenticate the user. yes

Response parameters

Parameter name Example value Description Mandatory
Code 200 Returns the status code of the response. yes
Message Command successfully executed Returns th description of the response code. yes
NotificationName CallConnected Name of the notification request type. no

OzML example

This example below shows that how you can record a call and set conditions that can finish the recording. The Record command starts the recording, and in the FinishDigits attribute you can set some keys that would interrupt the recording if you press them. This code also finishes the recording after 60 seconds of Delay with the Hangup command.

<?xml version="1.0"?>
<Response>
    <Speak>Your call will be recorded. You can stop recording by pressing 1. You have 1 minutes to talk.</Speak>
    <Record FinishedUrl="http://yourapp.com/record_finished.php" FinishDigits="1" Format="wav"></Record>
    <Delay>60</Delay>
    <Hangup></Hangup>
</Response>

Example request and response

URL request

http://127.0.0.1:9509/api?command=Record&Username=HTTP_User_1&Password=qwe123&CallId=345fad34&Format=mp3&FinishedUrl=http%3a%2f%2fyourapp.com%2frecord_finished.php

Response

<?xml version="1.0"?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Code>200</Code>
  <Message>Command successfully executed</Message>
</Response>

More information