Beispiel #1
0
        /// <summary>
        /// With TelAPI you can modify the way a callers voice sounds by changing things such as speed and pitch of the audio.
        /// </summary>
        /// <param name="callSid">An alphanumeric string used for identification of calls</param>
        /// <param name="effectOptions">Voice effect options</param>
        /// <returns></returns>
        public async Task<Call> VoiceEffects(string callSid, VoiceEffectOptions effectOptions)
        {
            Require.Argument("CallSid", callSid);

            var request = new RestRequest(System.Net.Http.HttpMethod.Post);
            request.Resource = RequestUri.VoiceEffectsUri;
            request.AddUrlSegment(RequestUriParams.CallSid, callSid);

            CreateVoiceEffectsOptions(effectOptions, request);

            return await Execute<Call>(request);
        }
Beispiel #2
0
 /// <summary>
 /// Helper method to populate Rest params
 /// </summary>
 /// <param name="voiceOptions">Voice effect options</param>
 /// <param name="request">Rest Request</param>
 private void CreateVoiceEffectsOptions(VoiceEffectOptions voiceOptions, RestRequest request)
 {
     if (voiceOptions.AudioDirection.HasValue) request.AddParameter("AudioDirection", voiceOptions.AudioDirection.ToString().ToLower());
     if (voiceOptions.Pitch.HasValue) request.AddParameter("Pitch", voiceOptions.Pitch.Value.ToString(CultureInfo.InvariantCulture));
     if (voiceOptions.PitchSemiTones.HasValue) request.AddParameter("PitchSemiTones", voiceOptions.PitchSemiTones.Value.ToString(CultureInfo.InvariantCulture));
     if (voiceOptions.PitchOctaves.HasValue) request.AddParameter("PitchOctaves", voiceOptions.PitchOctaves.Value.ToString(CultureInfo.InvariantCulture));
     if (voiceOptions.Rate.HasValue) request.AddParameter("Rate", voiceOptions.Rate.Value.ToString(CultureInfo.InvariantCulture));
     if (voiceOptions.Tempo.HasValue) request.AddParameter("Tempo", voiceOptions.Tempo.Value.ToString(CultureInfo.InvariantCulture));
 }
Beispiel #3
0
        /// <summary>
        /// With TelAPI you can modify the way a callers voice sounds by changing things such as speed and pitch of the audio.
        /// </summary>
        /// <param name="callSid">An alphanumeric string used for identification of calls</param>
        /// <param name="effectOptions">Voice effect options</param>
        /// <returns></returns>
        public Call VoiceEffects(string callSid, VoiceEffectOptions effectOptions)
        {
            Require.Argument("CallSid", callSid);

            var request = new RestRequest(Method.POST);
            request.Resource = RequestUri.VoiceEffectsUri;
            request.AddUrlSegment(RequestUriParams.CallSid, callSid);

            CreateVoiceEffectsOptions(effectOptions, request);

            return Execute<Call>(request);
        }