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 OutboundVoiceProfile Create()
        {
            OutboundVoiceProfile outboundVoiceProfile = new OutboundVoiceProfile();
            CreateOutboundVoiceProfileOptions createOutboundVoiceProfileOptions = new CreateOutboundVoiceProfileOptions
            {
                BillingGroupId      = new Guid("6a09cdc3-8948-47f0-aa62-74ac943d6c58"),
                ConcurrentCallLimit = 10
            };

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

            try
            {
                outboundVoiceProfile = outboundVoiceProfileService.Create(createOutboundVoiceProfileOptions);
                Console.WriteLine(JsonConvert.SerializeObject(outboundVoiceProfile));
            }
            catch (TelnyxException ex)
            {
                Console.WriteLine("exception");
                Console.WriteLine(JsonConvert.SerializeObject(ex));
            }
            return(outboundVoiceProfile);
        }