public void TestStartDtmf(bool passCreds)
        {
            var uuid                   = "63f61863-4a51-4f6b-86e1-46edebcf9356";
            var expectedUri            = $"{ApiUrl}/v1/calls/{uuid}/talk";
            var expectedResponse       = @"{
                  ""message"": ""DTMF sent"",
                  ""uuid"": ""63f61863-4a51-4f6b-86e1-46edebcf9356""
                }";
            var expectedRequestContent = @"{""digits"":""1234""}";
            var command                = new DtmfCommand {
                Digits = "1234"
            };

            Setup(expectedUri, expectedResponse, expectedRequestContent);

            var creds  = Request.Credentials.FromAppIdAndPrivateKey(AppId, PrivateKey);
            var client = new NexmoClient(creds);

            CallCommandResponse response;

            if (passCreds)
            {
                response = client.VoiceClient.StartDtmf(uuid, command, creds);
            }
            else
            {
                response = client.VoiceClient.StartDtmf(uuid, command);
            }
            Assert.Equal("DTMF sent", response.Message);
            Assert.Equal(uuid, response.Uuid);
        }
Esempio n. 2
0
        public void Execute()
        {
            var VONAGE_APPLICATION_ID   = Environment.GetEnvironmentVariable("VONAGE_APPLICATION_ID") ?? "VONAGE_APPLICATION_ID";
            var VONAGE_PRIVATE_KEY_PATH = Environment.GetEnvironmentVariable("VONAGE_PRIVATE_KEY_PATH") ?? "VONAGE_PRIVATE_KEY_PATH";
            var UUID   = Environment.GetEnvironmentVariable("UUID") ?? "UUID";
            var DIGITS = Environment.GetEnvironmentVariable("DIGITS") ?? "DIGITS";

            var credentials = Credentials.FromAppIdAndPrivateKeyPath(VONAGE_APPLICATION_ID, VONAGE_PRIVATE_KEY_PATH);
            var client      = new VonageClient(credentials);

            var command = new DtmfCommand()
            {
                Digits = DIGITS
            };

            var response = client.VoiceClient.StartDtmf(UUID, command);

            Console.WriteLine($"Play dtmf complete message: {response.Message}");
        }
Esempio n. 3
0
        /// <summary>
        /// PUT /v1/calls/{uuid}/dtmf - send Dual-tone multi-frequency(DTMF) tones to an active Call
        /// </summary>
        /// <param name="id">id of call</param>
        /// <param name="cmd">Command to execute against call</param>
        /// <param name="creds">(Optional) Overridden credentials for only this request</param>
        public static CallCommandResponse SendDtmf(string id, DtmfCommand cmd, Credentials creds = null)
        {
            var response = VersionedApiRequest.DoRequest("PUT", ApiRequests.GetBaseUriFor(typeof(Call), $"/v1/calls/{id}/dtmf"), cmd, creds);

            return(JsonConvert.DeserializeObject <CallCommandResponse>(response.JsonResponse));
        }
Esempio n. 4
0
 /// <summary>
 /// PUT /v1/calls/{uuid}/dtmf - send Dual-tone multi-frequency(DTMF) tones to an active Call
 /// </summary>
 /// <param name="id">id of call</param>
 /// <param name="cmd">Command to execute against call</param>
 /// <param name="creds">(Optional) Overridden credentials for only this request</param>
 public CallCommandResponse SendDtmf(string id, DtmfCommand cmd, Credentials creds = null)
 {
     return(SendDtmf(id, cmd, creds ?? Credentials));
 }