Exemplo n.º 1
0
        public OutboundVoiceProfileServiceTest(MockHttpClientFixture mockHttpClientFixture)
            : base(mockHttpClientFixture)
        {
            this.service = new OutboundVoiceProfileService();

            this.option = new CreateOutboundVoiceProfileOptions()
            {
                BillingGroupId      = new Guid("6a09cdc3-8948-47f0-aa62-74ac943d6c58"),
                ConcurrentCallLimit = 10,
                Name        = "TestName",
                TrafficType = "conversational",
                ServicePlan = "global",
                Enabled     = true,
                Tags        = new List <string> {
                    "Tag1", "Tag2"
                },
                UsagePaymentMethod      = null,
                WhitelistedDestinations = new List <string> {
                    "Dest1", "Dest2"
                },
                MaxDestinationRate     = 1,
                DailySpendLimit        = "Unlimited",
                DailySpendLimitEnabled = false,
                CallRecording          = new OutboundVoiceProfileCallRecording()
                {
                    CallRecordingCallerPhoneNumbers = new List <string>()
                    {
                        "+19705555099"
                    },
                    CallRecordingChannels = "dual",
                    CallRecordingFormat   = "mp3",
                    CallRecordingType     = "all",
                },
            };

            this.listOptions = new ListOutboundVoiceProfileOptions()
            {
                FilterNameContains = null,
                Sort = null
            };

            this.requestOptions    = new RequestOptions();
            this.cancellationToken = default(CancellationToken);
        }
        public TelnyxList <OutboundVoiceProfile> List()
        {
            TelnyxList <OutboundVoiceProfile> outboundVoiceProfiles           = new TelnyxList <OutboundVoiceProfile>();
            ListOutboundVoiceProfileOptions   listOutboundVoiceProfileOptions = new ListOutboundVoiceProfileOptions
            {
                PageNumber = 1,
                PageSize   = 20
            };

            Console.WriteLine(JsonConvert.SerializeObject(listOutboundVoiceProfileOptions));

            try
            {
                outboundVoiceProfiles = outboundVoiceProfileService.List(listOutboundVoiceProfileOptions);
                Console.WriteLine(JsonConvert.SerializeObject(outboundVoiceProfiles));
            }
            catch (TelnyxException ex)
            {
                Console.WriteLine("exception");
                Console.WriteLine(JsonConvert.SerializeObject(ex));
            }
            return(outboundVoiceProfiles);
        }