Example #1
0
        public static Call.CallResponse MakeCall(string TO_NUMBER, string NEXMO_NUMBER)
        {
            var client = FullAuth.GetClient();

            var results = client.Call.Do(new Call.CallCommand
            {
                to = new[]
                {
                    new Call.Endpoint {
                        type   = "phone",
                        number = TO_NUMBER
                    }
                },
                from = new Call.Endpoint
                {
                    type   = "phone",
                    number = NEXMO_NUMBER
                },
                answer_url = new[]
                {
                    "https://developer.nexmo.com/ncco/tts.json"
                }
            });

            return(results);
        }
Example #2
0
        public static Call.CallResponse MakeCallWithNCCO(string TO_NUMBER, string NEXMO_NUMBER)
        {
            var client = FullAuth.GetClient();

            var talkAction = new TalkAction()
            {
                Text = "This is a text to speech call from Nexmo"
            };
            var ncco = new Ncco(talkAction);

            var results = client.Call.Do(new Call.CallCommand
            {
                to = new[]
                {
                    new Call.Endpoint {
                        type   = "phone",
                        number = TO_NUMBER
                    }
                },
                from = new Call.Endpoint
                {
                    type   = "phone",
                    number = NEXMO_NUMBER
                },

                NccoObj = ncco
            });

            return(results);
        }
Example #3
0
        public static Call.CallResponse GetCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var result = client.Call.Get(UUID);

            return(result);
        }
Example #4
0
        public static Call.CallGetRecordingResponse GetRecording(string recordingUrl)
        {
            var client = FullAuth.GetClient();

            var response = client.Call.GetRecording(recordingUrl);

            return(response);
        }
Example #5
0
        public static PaginatedResponse <Call.CallList> GetAllCalls()
        {
            var client = FullAuth.GetClient();

            var response = client.Call.List();

            return(response);
        }
Example #6
0
        public static Call.CallResponse UnmuteCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var result = client.Call.Edit(UUID, new Call.CallEditCommand
            {
                Action = "unmute"
            });

            return(result);
        }
Example #7
0
        public static Call.CallCommandResponse PlayAudioStreamToCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var result = client.Call.BeginStream(UUID, new Call.StreamCommand
            {
                stream_url = new[] { "https://nexmo-community.github.io/ncco-examples/assets/voice_api_audio_streaming.mp3" }
            });

            return(result);
        }
Example #8
0
        public static Call.CallCommandResponse PlayDTMFToCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var DIGITS = "8675309";

            var result = client.Call.SendDtmf(UUID, new Call.DtmfCommand()
            {
                digits = DIGITS
            });

            return(result);
        }
Example #9
0
        public static Call.CallCommandResponse PlayTtsToCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var TEXT   = "This is a text to speech sample";
            var result = client.Call.BeginTalk(UUID, new Call.TalkCommand
            {
                text       = TEXT,
                voice_name = "Kimberly"
            });

            return(result);
        }
Example #10
0
        public static Call.CallResponse TransferCall(string UUID)
        {
            var client = FullAuth.GetClient();

            var result = client.Call.Edit(UUID, new Call.CallEditCommand
            {
                Action      = "transfer",
                Destination = new Call.Destination
                {
                    Type = "ncco",
                    Url  = new[] { "https://developer.nexmo.com/ncco/transfer.json" }
                }
            });

            return(result);
        }
Example #11
0
        public static Call.CallResponse TransferCallWithInlineNCCO(string UUID)
        {
            var client     = FullAuth.GetClient();
            var talkAction = new TalkAction()
            {
                Text = "This is a transfer action using an inline NCCO"
            };
            var ncco     = new Ncco(talkAction);
            var response = client.Call.Edit(UUID,
                                            new Call.CallEditCommand()
            {
                Action      = "transfer",
                Destination = new Call.Destination()
                {
                    Type = "ncco",
                    Ncco = ncco
                }
            });

            return(response);
        }