Example #1
0
        /// <summary>
        /// Save a modified or new recording format.  A new recording format is recognized by a Guid.Empty ID.
        /// </summary>
        /// <param name="recordingFileFormat">The recording format to save.</param>
        public async Task SaveRecordingFileFormat(RecordingFileFormat recordingFileFormat)
        {
            var request = NewRequest(HttpMethod.Post, "SaveRecordingFileFormat");

            request.AddBody(recordingFileFormat);
            await ExecuteAsync(request).ConfigureAwait(false);
        }
        /// <summary>
        /// Records a call
        /// </summary>
        /// <param name="accountSid">The account sid.</param>
        /// <param name="callSid">Call SID.</param>
        /// <param name="record">Specifies if a call recording should start or end. Allowed values are "true" to start recording and "false" to end recording. Any number of simultaneous, separate recordings can be initiated.</param>
        /// <param name="direction">Specifies which audio stream to record. Allowed values are "in" to record the incoming caller's audio, "out" to record the outgoing caller's audio, and "both" to record both.</param>
        /// <param name="timeLimit">The maximum duration of the recording.Allowed value is an integer greater than 0.</param>
        /// <param name="callbackUrl">A URL that will be requested when the recording ends, sending information about the recording. The longer the recording, the longer the delay in processing the recording and requesting the CallbackUrl. Url length is limited to 200 characters.</param>
        /// <param name="fileFormat">Specifies the file format of the recording. Allowed values are "mp3" or "wav" - any other value will default to "mp3".</param>
        /// <param name="trimSilence">Trims all silence from the beginning of the recording. Allowed values are "true" or "false" - any other value will default to "false".</param>
        /// <param name="transcribe">Specifies if this recording should be transcribed. Allowed values are "true" and "false" - all other values will default to "false".</param>
        /// <param name="transcribeQuality">Specifies the quality of the transcription. Allowed values are "auto" for automated transcriptions and "hybrid" for human-reviewed transcriptions - all other values will default to "auto".</param>
        /// <param name="transcribeCallback">A URL that will be requested when the call ends, sending information about the transcription. The longer the recording, the longer the delay in processing the transcription and requesting the TranscribeCallback. URL length is limited to 200 characters.</param>
        /// <returns>Returns created recording</returns>
        public Recording RecordCall(string accountSid, string callSid, bool record,
                                    RecordingAudioDirection direction = RecordingAudioDirection.BOTH, int?timeLimit = null,
                                    string callbackUrl = null, RecordingFileFormat fileFormat = RecordingFileFormat.MP3,
                                    bool trimSilence   = false, bool transcribe = false,
                                    TranscribeQuality transcribeQuality = TranscribeQuality.AUTO,
                                    string transcribeCallback           = null)
        {
            // Get client to make request
            var client = HttpProvider.GetHttpClient();

            // Create POST request
            var request = RestRequestHelper.CreateRestRequest(Method.POST,
                                                              $"Accounts/{accountSid}/Calls/{callSid}/Recordings.json");

            // Mark obligatory parameters
            Require.Argument("Record", record);

            // Add RecordCall query and body parameters
            this.SetParamsForRecordCall(request, record, direction, timeLimit, callbackUrl, fileFormat, trimSilence,
                                        transcribe, transcribeQuality, transcribeCallback);

            // Send request
            var response = client.Execute(request);

            return(this.ReturnOrThrowException <Recording>(response));
        }
Example #3
0
        private void _createNewButton_Click(object sender, EventArgs e)
        {
            RecordingFileFormat format = new RecordingFileFormat();

            format.Name   = _defaultName;
            format.Format = RecordingFileFormat.DefaultFormat;
            _formatsBindingSource.Add(format);
            _formatsDataGridView.CurrentCell = _formatsDataGridView.Rows[_formatsDataGridView.Rows.Count - 1].Cells[0];
        }
Example #4
0
        private RecordingFileFormat GetSelectedFormat()
        {
            RecordingFileFormat recordingFileFormat = null;

            if (_formatsDataGridView.SelectedRows.Count > 0)
            {
                recordingFileFormat = _formatsDataGridView.SelectedRows[0].DataBoundItem as RecordingFileFormat;
            }
            return(recordingFileFormat);
        }
Example #5
0
        private void _deleteButton_Click(object sender, EventArgs e)
        {
            RecordingFileFormat format = GetSelectedFormat();

            if (format != null)
            {
                _displayedFormat = null;
                _recordingFormats.Remove(format);
                _deletedFormats.Add(format);
            }
        }
        /// <summary>
        /// Records a call. Uses {accountSid} from configuration in HttpProvider
        /// </summary>
        /// <param name="callSid">Call SID.</param>
        /// <param name="record">Specifies if a call recording should start or end. Allowed values are "true" to start recording and "false" to end recording. Any number of simultaneous, separate recordings can be initiated.</param>
        /// <param name="direction">Specifies which audio stream to record. Allowed values are "in" to record the incoming caller's audio, "out" to record the outgoing caller's audio, and "both" to record both.</param>
        /// <param name="timeLimit">The maximum duration of the recording.Allowed value is an integer greater than 0.</param>
        /// <param name="callbackUrl">A URL that will be requested when the recording ends, sending information about the recording. The longer the recording, the longer the delay in processing the recording and requesting the CallbackUrl. Url length is limited to 200 characters.</param>
        /// <param name="fileFormat">Specifies the file format of the recording. Allowed values are "mp3" or "wav" - any other value will default to "mp3".</param>
        /// <param name="trimSilence">Trims all silence from the beginning of the recording. Allowed values are "true" or "false" - any other value will default to "false".</param>
        /// <param name="transcribe">Specifies if this recording should be transcribed. Allowed values are "true" and "false" - all other values will default to "false".</param>
        /// <param name="transcribeQuality">Specifies the quality of the transcription. Allowed values are "auto" for automated transcriptions and "hybrid" for human-reviewed transcriptions - all other values will default to "auto".</param>
        /// <param name="transcribeCallback">A URL that will be requested when the call ends, sending information about the transcription. The longer the recording, the longer the delay in processing the transcription and requesting the TranscribeCallback. URL length is limited to 200 characters.</param>
        /// <returns>Returns created recording</returns>
        public Recording RecordCall(string callSid, bool record,
                                    RecordingAudioDirection direction = RecordingAudioDirection.BOTH, int?timeLimit = null,
                                    string callbackUrl = null, RecordingFileFormat fileFormat = RecordingFileFormat.MP3,
                                    bool trimSilence   = false, bool transcribe = false,
                                    TranscribeQuality transcribeQuality = TranscribeQuality.AUTO,
                                    string transcribeCallback           = null)
        {
            // Get account sid from configuration
            var accountSid = HttpProvider.GetConfiguration().AccountSid;

            return(this.RecordCall(accountSid, callSid, record, direction, timeLimit, callbackUrl, fileFormat,
                                   trimSilence,
                                   transcribe, transcribeQuality, transcribeCallback));
        }
Example #7
0
        /// <summary>
        /// The Record element is used to record audio during a call.
        /// </summary>
        /// <param name="action">URL where some parameters specific to <Record> will be sent for further processing.</param>
        /// <param name="method">Specifies the method to use when requesting the action or transcribeCallback URL.</param>
        /// <param name="timeout">The number of seconds Record should wait during silence before ending.</param>
        /// <param name="finishOnKey">The key a caller can press to end the Record.</param>
        /// <param name="maxLength">The maximum length in seconds a recording should be.</param>
        /// <param name="transcribe">Boolean value specifying if the recording should be transcribed.</param>
        /// <param name="transcribeCallback">URL where the recording transcription will be sent.</param>
        /// <param name="playBeep">Boolean value specifying if a beep should be played when the recording begins.</param>
        /// <param name="bothLegs">Boolean value specifying if both call legs should be recorded.</param>
        /// <param name="fileFormat">The recording file format. Can be mp3 or wav. Default is mp3.</param>
        /// <returns></returns>
        public static Record Create(string action, HttpMethod? method, long? timeout, string finishOnKey, long? maxLength, bool? transcribe, string transcribeCallback, bool? playBeep, bool? bothLegs, RecordingFileFormat? fileFormat)
        {
            Record record = new Record();

            record.Action = action;
            record.Method = method == null ? null : method.ToString();
            record.Timeout = timeout == null ? null : timeout.ToString().ToLower();
            record.FinishOnKey = finishOnKey;
            record.MaxLength = maxLength == null ? null : maxLength.ToString();
            record.Transcribe = transcribe == null ? null : transcribe.ToString().ToLower();
            record.TranscribeCallback = transcribeCallback;
            record.PlayBeep = playBeep == null ? null : playBeep.ToString().ToLower();
            record.BothLegs = bothLegs == null ? null : bothLegs.ToString().ToLower();
            record.FileFormat = fileFormat == null ? null : fileFormat.ToString();
            
            return record;
        }
        public void SaveSettings(string folder, RecordingFileFormat format)
        {
            try
            {
                var setting_container = SimpleIOCContainer.Instance.Resolve<IGenericSettingsRepository<ProgramSettings>>();
                var settings = setting_container.GetSettings();
                settings.RecordingPath = folder;
                settings.RecordingFileFormat = format;
                SettingsHelper.SaveOptions(settings);

                if (!Directory.Exists(settings.RecordingPath))
                    Directory.CreateDirectory(settings.RecordingPath);

            }
            catch (Exception ex)
            {
                view.ShowError(ex);
            }
        }
        public RecordingContext(ISession my_session, RecordingFileFormat my_format, string my_extension_subpath)
        {
            session           = my_session;
            format            = my_format;
            extension_subpath = my_extension_subpath;

            recorder_filename = Path.GetTempFileName();

            switch (format)
            {
            case RecordingFileFormat.MP3:
                mp3_recorder = new MP3StreamRecorder(recorder_filename);
                break;

            case RecordingFileFormat.WAV:
                wav_recorder = new WaveStreamRecorder(recorder_filename);
                break;
            }
        }
        public void SaveSettings(string folder, RecordingFileFormat format)
        {
            try
            {
                var setting_container = SimpleIOCContainer.Instance.Resolve <IGenericSettingsRepository <ProgramSettings> >();
                var settings          = setting_container.GetSettings();
                settings.RecordingPath       = folder;
                settings.RecordingFileFormat = format;
                SettingsHelper.SaveOptions(settings);

                if (!Directory.Exists(settings.RecordingPath))
                {
                    Directory.CreateDirectory(settings.RecordingPath);
                }
            }
            catch (Exception ex)
            {
                view.ShowError(ex);
            }
        }
 /// <summary>
 /// Sets the parameters for record call.
 /// </summary>
 /// <param name="request">The request.</param>
 /// <param name="record">if set to <c>true</c> [record].</param>
 /// <param name="direction">The direction.</param>
 /// <param name="timeLimit">The time limit.</param>
 /// <param name="callbackUrl">The callback URL.</param>
 /// <param name="fileFormat">The file format.</param>
 /// <param name="trimSilence">if set to <c>true</c> [trim silence].</param>
 /// <param name="transcribe">if set to <c>true</c> [transcribe].</param>
 /// <param name="transcribeQuality">The transcribe quality.</param>
 /// <param name="transcribeCallback">The transcribe callback.</param>
 private void SetParamsForRecordCall(IRestRequest request, bool record, RecordingAudioDirection direction,
                                     int?timeLimit, string callbackUrl, RecordingFileFormat fileFormat, bool trimSilence, bool transcribe,
                                     TranscribeQuality transcribeQuality, string transcribeCallback)
 {
     request.AddParameter("Record", record);
     request.AddParameter("Direction", EnumHelper.GetEnumValue(direction));
     if (timeLimit != null)
     {
         request.AddParameter("TimeLimit", timeLimit);
     }
     if (callbackUrl.HasValue())
     {
         request.AddParameter("CallbackUrl", callbackUrl);
     }
     request.AddParameter("FileFormat", EnumHelper.GetEnumValue(fileFormat));
     request.AddParameter("TrimSilence", trimSilence);
     request.AddParameter("Transcribe", transcribe);
     request.AddParameter("TranscribeQuality", EnumHelper.GetEnumValue(transcribeQuality));
     if (transcribeCallback.HasValue())
     {
         request.AddParameter("TranscribeCallback", transcribeCallback);
     }
 }
Example #12
0
        private void UpdateSelectedFormat()
        {
            RecordingFileFormat selectedFormat = GetSelectedFormat();

            _deleteButton.Enabled   = (selectedFormat != null);
            _nameTextBox.Enabled    = (selectedFormat != null);
            _formatTextBox.Enabled  = (selectedFormat != null);
            _exampleTextBox.Enabled = (selectedFormat != null);
            _resetCurrentToDefaultButton.Enabled = (selectedFormat != null);
            if (selectedFormat == null)
            {
                _nameTextBox.Text    = String.Empty;
                _formatTextBox.Text  = String.Empty;
                _exampleTextBox.Text = String.Empty;
            }
            else
            {
                _nameTextBox.Text   = selectedFormat.Name;
                _formatTextBox.Text = selectedFormat.Format;
                _nameTextBox.Focus();
            }
            _displayedFormat = selectedFormat;
        }
Example #13
0
 /// <summary>
 /// Stops the recording and saves as specified with the file name originally specified
 /// </summary>
 /// <returns>The recording that was saved.</returns>
 /// <param name="howToSave">How to save.</param>
 public Recording stopAndSaveRecording(RecordingFileFormat howToSave)
 {
     return(stopAndSaveRecording(new RecordingFileFormat[] { howToSave }));
 }
Example #14
0
 /// <summary>
 /// The Record element is used to record audio during a call.
 /// </summary>
 /// <param name="action">URL where some parameters specific to Record will be sent for further processing.</param>
 /// <param name="method">Specifies the method to use when requesting the action or transcribeCallback URL.</param>
 /// <param name="timeout">The number of seconds Record should wait during silence before ending.</param>
 /// <param name="finishOnKey">The key a caller can press to end the Record.</param>
 /// <param name="maxLength">The maximum length in seconds a recording should be.</param>
 /// <param name="transcribe">Boolean value specifying if the recording should be transcribed.</param>
 /// <param name="transcribeCallback">URL where the recording transcription will be sent.</param>
 /// <param name="playBeep">Boolean value specifying if a beep should be played when the recording begins.</param>
 /// <param name="bothLegs">Boolean value specifying if both call legs should be recorded.</param>
 /// <param name="fileFormat">The recording file format. Can be mp3 or wav. Default is mp3</param>
 /// <returns></returns>
 public Response Record(string action, HttpMethod? method, long? timeout, string finishOnKey, long? maxLength, bool? transcribe, string transcribeCallback, bool? playBeep, bool? bothLegs, RecordingFileFormat? fileFormat)
 {
     Elements.Add(Element.Record.Create(action, method, timeout, finishOnKey, maxLength, transcribe, transcribeCallback, playBeep, bothLegs, fileFormat));
     return this;
 }
Example #15
0
 public override void OnCancel()
 {
     _displayedFormat = null;
     _formatsBindingSource.RemoveSort();
     base.OnCancel();
 }