record Action
Records audio from the call to a wav file in the Aculab media file store.
The recording can be encrypted by supplying an encryption cipher property when setting up the record action.
Recorded files are available immediately to play in the same application, but generally take a few seconds to become available elsewhere. See Media File Availability for more details.
language wrappers and examples
The record properties are:
Property | Required/Optional | Default | Description |
---|---|---|---|
next page | required | A web page request object that defines the web page to be called once the recording has finished. It is passed the filename and details of the recording, which will be immediately available to play within the same application, but may not yet be available for general access. | |
id from API V2.0 | optional | "" | A user-defined string that can be used to uniquely identify each recording. |
barge in digits | optional | "#" | A string of zero or more digits. This stops the record action if any of these digits are pressed. |
seconds max duration | optional | 60 | An integer value. The maximum duration of the recording. |
milliseconds max silence | optional | 3000 | An integer value. The amount of silence in milliseconds after which the recording stops. |
milliseconds max initial silence from API V2.0 | optional | 0 | An integer value. The maximum amount of time in milliseconds to listen for the first audio input. The recording starts when the first audio input is heard. Setting this to 0 (the default) indicates that the value of milliseconds_max_silence will be used to listen for the first audio input. |
format | optional | determined automatically | One of "alaw" or "ulaw". The companding used to encode the audio data in the file. |
encryption cipher | optional | - | A cipher object to be used to encrypt the recorded file. If none is supplied the recorded file is saved unencrypted. |
beep on start | optional | false | true or false. Whether to play a beep before starting to record. |
recording available page from API V2.0 | optional | - | A web page request object that defines a web page that is notified once the recorded file is fully available to all applications and can be downloaded. The request to this page happens asynchronously and is not restricted to the lifetime of the application that made the recording. Its response is not considered part of the application flow. |
Returns to next page
As soon as recording is completed the recorded file can be played or deleted by the same application (see Recording Available Notification for wider availability). The name of the recorded file is generated automatically and returned to the application via the subsequent HTTP Request to the next page
in the action result along with details of the recording as follows:
Property | Availability | Description |
---|---|---|
filename | always | A string representing the filename of the recording on the Aculab media file store. |
file available from API V2.0 | always | true or false. Indicates whether the recorded file is available from the Aculab media file store outside of this application. |
id from API V2.0 | always | The user-defined id specified in the action. |
contains sound | always | true or false. Indicates whether the recorded file contains sound above the general background level of noise. |
seconds duration | always | A floating point value to one decimal place. The estimated duration of the file in seconds. |
reason from API V2.0 | always | A string indicating the reason the recording completed. One of 'duration', 'bargein', 'aborted', 'filesize', 'silence', 'error', 'other', 'hangup'. Available in REST API Version 2 and later. |
barge in digit from API V2.0 | if reason is 'bargein' | A string containing the single digit that was pressed to barge in. Available in REST API Version 2 and later. |
Recording Available Notifications
The recorded file can be accessed by the same application once next page has been called. However, more general access may not be available for several seconds (see Media File Availability).
When the file is available for general access, the page supplied in recording available page
will be requested, which can use the Managing Files Web Services API to download it. An action result
is included which is exactly the same as that in the next page request above, but with the file available
property set to true.
-
Examples:
Record a call's incoming audio and specify a page to receive the recorded file name:
"record" : { "next_page" : { "url" : "my_record_handler_page" } }
The following may be returned to
next page
once 3 seconds of silence is detected during the recording:"action_result" : { "action" : "record", "result" : { "id": "", "filename" : "/rest_api/recordings/2018/06/16/14_35_03_04f01fb92e8913a8.62100.wav", "file_available" : false, "contains_sound" : true, "seconds_duration" : 16.7, "reason" : "silence" } }
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
"record" : { "next_page" : { "url" : "my_record_handler_page" }, "encryption_cipher": { "type" : "aescbc", "key" : "431F43FAF57534C91F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A", "initialisation_vector" : "F846443B9B85FAED9AB17570D5A82A31" } }
The following may be returned to
next page
if recording is still running after 60 seconds:"action_result" : { "action" : "record", "result" : { "id": "", "filename" : "/rest_api/recordings/2018/06/16/14_35_03_04f01fb92e8913a8.62100.wav", "file_available" : false, "contains_sound" : true, "seconds_duration" : 60.2, "reason" : "duration" } }
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
"record" : { "next_page" : { "url" : "my_record_handler_page" }, "id" : "rec_0616_1875", "beep_on_start" : true, "barge_in_digits" : "#*", "seconds_max_duration" : 180, "milliseconds_max_silence" : 5000, "format" : "alaw", "recording_available_page" : { "url" : "my_recording_available_page" } }
The following may be returned in the action result to
next page
if a '*' is pressed during the recording:"action_result" : { "action" : "record", "result" : { "id" : "rec_0616_1875", "filename" : "/rest_api/recordings/2018/06/16/14_35_03_04f01fb92e8913a8.62100.wav", "file_available" : false, "contains_sound" : true, "seconds_duration" : 32.9, "reason" : "bargein", "barge_in_digit" : "*" } }
The following may be returned in the action result to
recording available page
:"action_result" : { "action" : "record", "result" : { "id" : "rec_0616_1875", "filename" : "/rest_api/recordings/2018/06/16/14_35_03_04f01fb92e8913a8.62100.wav", "file_available" : true, "contains_sound" : true, "seconds_duration" : 32.9, "reason" : "bargein", "barge_in_digit" : "*" } }
-
Record Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllAn action that records audio from the call to a wav file in the Aculab media file store.
-
public class Record : TelephonyAction { // Constructors [Obsolete] public Record(); public Record(WebPageRequest nextPage, Cipher encryptionCipher = null); // Members public WebPageRequest NextPage; public string Id; public WebPageRequest RecordingAvailablePage; public bool BeepOnStart; public string BargeInDigits; public int SecondsMaxDuration; public int MillisecondsMaxSilence; public int MillisecondsMaxInitialSilence; public string Format; public Cipher EncryptionCipher; }
Examples:
-
Record a call's incoming audio and specify a page to receive the recorded file name:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x43, 0x1F, 0x43, 0xFA, 0xF5, 0x75, 0x34, 0xC9, 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 0xDF, 0x59, 0x5D, 0x3A }; byte[] initialisationVector = new byte[] { 0xF8, 0x46, 0x44, 0x3B, 0x9B, 0x85, 0xFA, 0xED, 0x9A, 0xB1, 0x75, 0x70, 0xD5, 0xA8, 0x2A, 0x31 }; var cipher = new AesCbcCipher(key, initialisationVector); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx"), cipher); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")) { Id = "rec_0616_1875", SecondsMaxDuration = 180, BeepOnStart = false, BargeInDigits = "#*", MillisecondsMaxSilence = 5000, RecordingAvailablePage = new WebPageRequest("MyRecordingAvailablePage.aspx") }; actions.Add(record);
Get the duration of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var duration = recordResult.SecondsDuration;
Get the filename of the recording from the action's recording available page request:
// Unpack the request var instanceInfo = new TelephonyRequest(Request).InstanceInfo; var recResult = (RecordResult)instanceInfo.ActionResult; if (recResult.FileAvailable) { var recordFilename = recResult.Filename; // Recorded file can now be used by other application instances or downloaded }
-
-
public class Record : TelephonyAction { // Constructors [Obsolete] public Record(); public Record(WebPageRequest nextPage, Cipher encryptionCipher = null); // Members public WebPageRequest NextPage; public string Id; public WebPageRequest RecordingAvailablePage; public bool BeepOnStart; public string BargeInDigits; public int SecondsMaxDuration; public int MillisecondsMaxSilence; public int MillisecondsMaxInitialSilence; public string Format; public Cipher EncryptionCipher; }
Examples:
-
Record a call's incoming audio and specify a page to receive the recorded file name:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x43, 0x1F, 0x43, 0xFA, 0xF5, 0x75, 0x34, 0xC9, 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 0xDF, 0x59, 0x5D, 0x3A }; byte[] initialisationVector = new byte[] { 0xF8, 0x46, 0x44, 0x3B, 0x9B, 0x85, 0xFA, 0xED, 0x9A, 0xB1, 0x75, 0x70, 0xD5, 0xA8, 0x2A, 0x31 }; var cipher = new AesCbcCipher(key, initialisationVector); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx"), cipher); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")) { Id = "rec_0616_1875", SecondsMaxDuration = 180, BeepOnStart = false, BargeInDigits = "#*", MillisecondsMaxSilence = 5000, RecordingAvailablePage = new WebPageRequest("MyRecordingAvailablePage.aspx") }; actions.Add(record);
Get the duration of the recording from the action's next page request:
// Unpack the request var telephonyRequest = new TelephonyRequest(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var duration = recordResult.SecondsDuration;
Get the filename of the recording from the action's recording available page request:
// Unpack the request var instanceInfo = new TelephonyRequest(Request).InstanceInfo; var recResult = (RecordResult)instanceInfo.ActionResult; if (recResult.FileAvailable) { var recordFilename = recResult.Filename; // Recorded file can now be used by other application instances or downloaded }
-
-
public class Record : TelephonyAction { // Constructors [Obsolete] public Record(); public Record(WebPageRequest nextPage, Cipher encryptionCipher = null); // Members public WebPageRequest NextPage; public string Id; public WebPageRequest RecordingAvailablePage; public bool BeepOnStart; public string BargeInDigits; public int SecondsMaxDuration; public int MillisecondsMaxSilence; public int MillisecondsMaxInitialSilence; public string Format; public Cipher EncryptionCipher; }
Examples:
-
Record a call's incoming audio and specify a page to receive the recorded file name:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
List<TelephonyAction> actions = new List<TelephonyAction>(); byte[] key = new byte[] { 0x43, 0x1F, 0x43, 0xFA, 0xF5, 0x75, 0x34, 0xC9, 0x1F, 0x2D, 0xEB, 0x2E, 0x50, 0x2A, 0x4C, 0x8C, 0xBA, 0x58, 0xAB, 0x50, 0x18, 0xBD, 0x15, 0x06, 0x41, 0x9E, 0xEA, 0xB6, 0xDF, 0x59, 0x5D, 0x3A }; byte[] initialisationVector = new byte[] { 0xF8, 0x46, 0x44, 0x3B, 0x9B, 0x85, 0xFA, 0xED, 0x9A, 0xB1, 0x75, 0x70, 0xD5, 0xA8, 0x2A, 0x31 }; var cipher = new AesCbcCipher(key, initialisationVector); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx"), cipher); actions.Add(record);
Get the filename of the recording from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var recordFilename = recordResult.Filename;
-
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
List<TelephonyAction> actions = new List<TelephonyAction>(); var record = new Record(new WebPageRequest("MyRecordHandlerPage.aspx")) { Id = "rec_0616_1875", SecondsMaxDuration = 180, BeepOnStart = false, BargeInDigits = "#*", MillisecondsMaxSilence = 5000, RecordingAvailablePage = new WebPageRequest("MyRecordingAvailablePage.aspx") }; actions.Add(record);
Get the duration of the recording from the action's next page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var recordResult = (RecordResult)telephonyRequest.InstanceInfo.ActionResult; var duration = recordResult.SecondsDuration;
Get the filename of the recording from the action's recording available page request:
// Unpack the request var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request); var recResult = (RecordResult)instanceInfo.ActionResult; if (recResult.FileAvailable) { var recordFilename = recResult.Filename; // Recorded file can now be used by other application instances or downloaded }
-
-
-
Record Class
Namespace: Aculab.Cloud.RestAPIWrapper
Assembly: Aculab.Cloud.RestAPIWrapper.dllAn action that records audio from the call to a wav file in the Aculab media file store.
-
Public Class Record Inherits TelephonyAction ' Constructors [Obsolete] Public Sub New () Public Sub New (nextPage As Webpagerequest, Optional encryptionCipher As Cipher = Nothing) ' Members Public Property NextPage As Webpagerequest Public Property Id As String Public Property RecordingAvailablePage As Webpagerequest Public Property BeepOnStart As Bool Public Property BargeInDigits As String Public Property SecondsMaxDuration As Integer Public Property MillisecondsMaxSilence As Integer Public Property MillisecondsMaxInitialSilence As Integer Public Property Format As String Public Property EncryptionCipher As Cipher End Class
Examples:
-
Record a call's incoming audio and specify a page to receive the recorded file name:
Dim actions = New List(Of TelephonyAction) Dim Record = New Record(New WebPageRequest("MyRecordHandlerPage.aspx")) actions.Add(Record)
Get the filename of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim recordFilename = recordResult.Filename
-
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
Dim actions = New List(Of TelephonyAction) Dim key As Byte() = { _ &H43, &H1F, &H43, &HFA, &HF5, &H75, &H34, &HC9, _ &H1F, &H2D, &HEB, &H2E, &H50, &H2A, &H4C, &H8C, _ &HBA, &H58, &HAB, &H50, &H18, &HBD, &H15, &H6, _ &H41, &H9E, &HEA, &HB6, &HDF, &H59, &H5D, &H3A} Dim initialisationVector As Byte() = { _ &HF8, &H46, &H44, &H3B, &H9B, &H85, &HFA, &HED, _ &H9A, &HB1, &H75, &H70, &HD5, &HA8, &H2A, &H31} Dim cipher = New AesCbcCipher(key, initialisationVector) Dim recordAction = New Record(New WebPageRequest("MyRecordHandlerPage.aspx"), cipher) actions.Add(recordAction)
Get the filename of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim recordFilename = recordResult.Filename
-
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
Dim actions = New List(Of TelephonyAction) Dim record = New Record(New WebPageRequest("MyRecordHandlerPage.aspx")) With { .Id = "rec_0616_1875", .SecondsMaxDuration = 180, .BeepOnStart = False, .BargeInDigits = "#*", .MillisecondsMaxSilence = 5000, .RecordingAvailablePage = New WebPageRequest("MyRecordingAvailablePage.aspx") } actions.Add(record)
Get the duration of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim duration = recordResult.SecondsDuration
Get the filename of the recording from the action's recording available page request:
' Unpack the request Dim instanceInfo = New TelephonyRequest(Request).InstanceInfo Dim recResult As RecordResult = instanceInfo.ActionResult If recResult.FileAvailable Then Dim recFilename = recResult.Filename ' Recorded file can now be used by other application instances Or downloaded End If
-
-
Public Class Record Inherits TelephonyAction ' Constructors [Obsolete] Public Sub New () Public Sub New (nextPage As Webpagerequest, Optional encryptionCipher As Cipher = Nothing) ' Members Public Property NextPage As Webpagerequest Public Property Id As String Public Property RecordingAvailablePage As Webpagerequest Public Property BeepOnStart As Bool Public Property BargeInDigits As String Public Property SecondsMaxDuration As Integer Public Property MillisecondsMaxSilence As Integer Public Property MillisecondsMaxInitialSilence As Integer Public Property Format As String Public Property EncryptionCipher As Cipher End Class
Examples:
-
Record a call's incoming audio and specify a page to receive the recorded file name:
Dim actions = New List(Of TelephonyAction) Dim Record = New Record(New WebPageRequest("MyRecordHandlerPage.aspx")) actions.Add(Record)
Get the filename of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim recordFilename = recordResult.Filename
-
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
Dim actions = New List(Of TelephonyAction) Dim key As Byte() = { _ &H43, &H1F, &H43, &HFA, &HF5, &H75, &H34, &HC9, _ &H1F, &H2D, &HEB, &H2E, &H50, &H2A, &H4C, &H8C, _ &HBA, &H58, &HAB, &H50, &H18, &HBD, &H15, &H6, _ &H41, &H9E, &HEA, &HB6, &HDF, &H59, &H5D, &H3A} Dim initialisationVector As Byte() = { _ &HF8, &H46, &H44, &H3B, &H9B, &H85, &HFA, &HED, _ &H9A, &HB1, &H75, &H70, &HD5, &HA8, &H2A, &H31} Dim cipher = New AesCbcCipher(key, initialisationVector) Dim recordAction = New Record(New WebPageRequest("MyRecordHandlerPage.aspx"), cipher) actions.Add(recordAction)
Get the filename of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim recordFilename = recordResult.Filename
-
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
Dim actions = New List(Of TelephonyAction) Dim record = New Record(New WebPageRequest("MyRecordHandlerPage.aspx")) With { .Id = "rec_0616_1875", .SecondsMaxDuration = 180, .BeepOnStart = False, .BargeInDigits = "#*", .MillisecondsMaxSilence = 5000, .RecordingAvailablePage = New WebPageRequest("MyRecordingAvailablePage.aspx") } actions.Add(record)
Get the duration of the recording from the action's next page request:
' Unpack the request Dim telephonyRequest = New TelephonyRequest(Request) Dim recordResult As RecordResult = telephonyRequest.InstanceInfo.ActionResult Dim duration = recordResult.SecondsDuration
Get the filename of the recording from the action's recording available page request:
' Unpack the request Dim instanceInfo = New TelephonyRequest(Request).InstanceInfo Dim recResult As RecordResult = instanceInfo.ActionResult If recResult.FileAvailable Then Dim recFilename = recResult.Filename ' Recorded file can now be used by other application instances Or downloaded End If
-
-
-
class Record extends TelephonyAction
Represents a record action.
Class synopsis:
// Constructors: public Record(WebPageRequest nextPage) // Members: public void setId(String id) public void setBeepOnStart(boolean enabled) public void setBargeInDigits(String digits) public void setSecondsMaxDuration(int seconds) public void setMillisecondsMaxSilence(int milliseconds) public void setMillisecondsMaxInitialSilence(int milliseconds) public void setFormat(String format) public void setEncryptionCipher(Cipher encryptionCipher) public void setRecordingAvailablePage(WebPageRequest recordingAvailablePage)
class RecordResult extends ActionResult
Represents the result of a record action. This is sent in the
action result
for both thenext page
and therecording available page
.Class synopsis:
// Members: public String getFilename() public boolean getFileAvailable() public String getId() public boolean containsSound() public double getSecondsDuration() public String getReason() public String getBargeInDigit()
Examples:
Record a call's incoming audio and specify a page to receive the recorded file name:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); actions.add(new Record(new WebPageRequest("my_record_handler_page")));
Get details of the recording from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); RecordResult recordResult = (RecordResult)ourRequest.getInstanceInfo().getActionResult(); String id = recordResult.getId(); String recordedFilename = recordResult.getFilename(); double duration = recordResult.getSecondsDuration(); String reason = recordResult.getReason();
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); //Specify a 256 bit cipher to be used to encrypt the recording byte[] key = new byte[] { (byte)0x43, (byte)0x1F, (byte)0x43, (byte)0xFA, (byte)0xF5, (byte)0x75, (byte)0x34, (byte)0xC9, (byte)0x1F, (byte)0x2D, (byte)0xEB, (byte)0x2E, (byte)0x50, (byte)0x2A, (byte)0x4C, (byte)0x8C, (byte)0xBA, (byte)0x58, (byte)0xAB, (byte)0x50, (byte)0x18, (byte)0xBD, (byte)0x15, (byte)0x06, (byte)0x41, (byte)0x9E, (byte)0xEA, (byte)0x86, (byte)0xDF, (byte)0x59, (byte)0x5D, (byte)0x3A }; byte[] initialisationVector = new byte[] { (byte)0xF8, (byte)0x46, (byte)0x44, (byte)0x3B, (byte)0x9B, (byte)0x85, (byte)0xFA, (byte)0xED, (byte)0x9A, (byte)0xB1, (byte)0x75, (byte)0x70, (byte)0xD5, (byte)0xA8, (byte)0x2A, (byte)0x31 }; Cipher encryptionCipher = new AesCbcCipher(key, initialisationVector); Record recordAction = new Record(new WebPageRequest("my_record_handler_page")); recordAction.setEncryptionCipher(encryptionCipher); actions.add(recordAction);
Get details of the recording from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); RecordResult recordResult = (RecordResult)ourRequest.getInstanceInfo().getActionResult(); String id = recordResult.getId(); String recordedFilename = recordResult.getFilename(); double duration = recordResult.getSecondsDuration(); String reason = recordResult.getReason();
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
List<TelephonyAction> actions = new ArrayList<TelephonyAction>(); Record recordAction = new Record(new WebPageRequest("my_record_handler_page")); recordAction.setId("rec_0616_1875"); recordAction.setBeepOnStart(false); recordAction.setBargeInDigits("#*"); recordAction.setSecondsMaxDuration(180); recordAction.setMillisecondsMaxSilence(5000); recordAction.setFormat("alaw"); recordAction.setRecordingAvailablePage(new WebPageRequest("my_recording_available_page")); actions.add(recordAction);
Get details of the recording from the action's next page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); RecordResult recordResult = (RecordResult)ourRequest.getInstanceInfo().getActionResult(); String id = recordResult.getId(); String recordedFilename = recordResult.getFilename(); double duration = recordResult.getSecondsDuration(); String reason = recordResult.getReason();
Get details of the recording from the action's recording available page request:
TelephonyRequest ourRequest = new TelephonyRequest(request); RecordResult recordResult = (RecordResult)ourRequest.getInstanceInfo().getActionResult(); String id = recordResult.getId(); String recordedFilename = recordResult.getFilename();
-
class Record
Represents a record action.
Class synopsis:
# Record object: Record(next_page, id=None, beep_on_start=None, barge_in_digits=None, seconds_max_duration=None, milliseconds_max_silence=None, milliseconds_max_initial_silence=None, format=None, encryption_cipher=None, recording_available_page=None) # Instance methods: Record.set_id(id) Record.set_beep_on_start(beep_on_start) Record.set_barge_in_digits(barge_in_digits) Record.set_seconds_max_duration(seconds_max_duration) Record.set_milliseconds_max_silence(milliseconds_max_silence) Record.set_milliseconds_max_initial_silence(milliseconds_max_initial_silence) Record.set_format(format) Record.set_encryption_cipher(encryption_cipher) Record.set_recording_available_page(recording_available_page)
Record Result
The Record Result is represented by a dictionary. It is found within the
action result
for both thenext page
and therecording available page
.Obtaining the Record Result dictionary:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "record": record_result = action_result.get("result")
Examples:
Record a call's incoming audio and specify a page to receive the recorded file name:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] list_of_actions.append(Record(WebPage(url='my_record_handler_page')))
Get details of the recording from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "record": record_result = action_result.get("result") id = record_result.get("id") filename = record_result.get("filename") seconds_duration = record_result.get("seconds_duration") reason = record_result.get("reason") # Your code here...
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] my_cipher = AESCBCCipher(key='431F43FAF57534C91F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A', initialisation_vector='F846443B9B85FAED9AB17570D5A82A31') record_action = Record(WebPage(url='my_record_handler_page')) record_action.set_encryption_cipher(my_cipher) list_of_actions.append(record_action)
Get details of the recording from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "record": record_result = action_result.get("result") id = record_result.get("id") filename = record_result.get("filename") seconds_duration = record_result.get("seconds_duration") reason = record_result.get("reason") # Your code here...
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
# Create a list of actions that will be passed to the TelephonyResponse constructor list_of_actions = [] record_action = Record(WebPage(url='my_record_handler_page')) record_action.set_id("rec_0616_1875") record_action.set_beep_on_start(False) record_action.set_barge_in_digits("#*") record_action.set_seconds_max_duration(180) record_action.set_milliseconds_max_silence(5000) record_action.set_format("alaw") record_action.set_recording_available_page(WebPage(url="my_recording_available_page")) list_of_actions.append(record_action)
Get details of the recording from the action's next page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "record": record_result = action_result.get("result") id = record_result.get("id") filename = record_result.get("filename") seconds_duration = record_result.get("seconds_duration") reason = record_result.get("reason") # Your code here...
Get details of the recording from the action's recording available page request:
my_request = TelephonyRequest(request) action_result = my_request.get_action_result() if action_result.get("action") == "record": record_result = action_result.get("result") id = record_result.get("id") filename = record_result.get("filename") # Your code here...
-
The Record class
Introduction
Represents a record action.
Class synopsis
class Record extends ActionBase { /* methods */ public __construct(WebPageRequest|string $next_page, array $opts = null) public self setID(string $id) public self setFormat(string $fmt) public self setSecondsMaxDuration(int $secs) public self setBeepOnStart(boolean $beep) public self setBargeInDigits(string $digits) public self setMillisecondsMaxSilence(int $msecs) public self setMillisecondsMaxInitialSilence(int $msecs) public self setEncryptionCipher(Cipher $cipher) public self setRecordingAvailablePage(WebPageRequest|string $page, string $method = null) }
The RecordResult class
Introduction
Represents the result information of a record action.
Class synopsis
class RecordResult extends ActionResult { /* methods */ public string getID() public string getFilename() public boolean getFileAvailable() public boolean getContainsSound() public float getSecondsDuration() public string getReason() public string|null getBargeInDigit() /* inherited methods */ public string getAction() public boolean getInterrupted() }
Examples:
Record a call's incoming audio and specify a page to receive the recorded file name:
$response->addAction(new Aculab\TelephonyRestAPI\Record(new Aculab\TelephonyRestAPI\WebPageRequest('my_record_handler_page')));
Get the filename of the recording from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $recordResult = $info->getActionResult(); $recordFilename = $recordResult->getFilename();
Record a call's incoming audio to an encrypted media file and specify a page to receive the recorded file name. Specify the cipher to encrypt the recording:
$r = new Aculab\TelephonyRestAPI\Record('my_record_handler_page'); $cipher = new Aculab\TelephonyRestAPI\AesCbcCipher( "431F43FAF57534C91F2DEB2E502A4C8CBA58AB5018BD1506419EEA86DF595D3A", "F846443B9B85FAED9AB17570D5A82A31" ); $r->setEncryptionCipher($cipher); $response->addAction($r);
Get the filename of the recording from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $recordResult = $info->getActionResult(); $recordFilename = $recordResult->getFilename();
Record a call's incoming audio for up to 3 minutes, enabling barge in for '#' and '*', stopping the record on 5 seconds of silence and specifying a page to be notified when the recorded file is available for download:
$recAction = new Aculab\TelephonyRestAPI\Record('my_record_handler_page'); $recAction->setRecordingAvailablePage('my_recording_available_page') ->setID('rec_0616_1875') ->setSecondsMaxDuration(180) ->setBeepOnStart(false) ->setBargeInDigits('#*') ->setMillisecondsMaxSilence(5000); $response->addAction($recAction);
Get the duration of the recording from the action's next page request:
$info = InstanceInfo::getInstanceInfo(); $recordResult = $info->getActionResult(); $duration = $recordResult->getSecondsDuration();
Get the filename of the recording from the action's recording available page request:
$info = InstanceInfo::getInstanceInfo(); $recordResult = $info->getActionResult(); if ($recordResult->getFileAvailable()) { $recordFilename = $recordResult->getFilename(); /* file can now be used by other application instances or downloaded */ }