public virtual async void TestDelete() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ICallService service = testServer.Host.Services.GetService(typeof(ICallService)) as ICallService; var model = new ApiCallServerRequestModel(); model.SetProperties(1, 1, 1, "B", 1, DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), 2); CreateResponse <ApiCallServerResponseModel> createdResponse = await service.Create(model); createdResponse.Success.Should().BeTrue(); ActionResponse deleteResult = await client.CallDeleteAsync(2); deleteResult.Success.Should().BeTrue(); ApiCallServerResponseModel verifyResponse = await service.Get(2); verifyResponse.Should().BeNull(); }
public FSInbound(string Host, int Port, string Password, string OutboundAddress = "", string DefaultHTTPMethod = "POST") : base(Host, Port, Password, EVENT_FILTER, 5, false) { //Call Services callSrvc = new CallService(); FSOutboundAddress = OutboundAddress; //Mapping of Key: job-uuid - Value: CallSid BackgroundJobs = new Dictionary <string, string>(); //Call Requests CallRequest = new Dictionary <string, Request>(); //Elapsed Times on a call CallElapsedTime = new Dictionary <string, int>(); this.DefaultHTTPMethod = DefaultHTTPMethod; base.OnBACKGROUND_JOB += new EventHandlers(ON_BACKGROUND_JOB); base.OnCHANNEL_PROGRESS += new EventHandlers(ON_CHANNEL_PROGRESS); base.OnCHANNEL_PROGRESS_MEDIA += new EventHandlers(ON_CHANNEL_PROGRESS_MEDIA); base.OnSESSION_HEARTBEAT += new EventHandlers(ON_SESSION_HEARTBEAT); base.OnCHANNEL_HANGUP_COMPLETE += new EventHandlers(ON_CHANNEL_HANGUP_COMPLETE); base.OnCHANNEL_ANSWER += new EventHandlers(ON_CHANNEL_ANSWER); base.OnCUSTOM += new EventHandlers(ON_CUSTOM); base.OnCHANNEL_BRIDGE += new EventHandlers(ON_CHANNEL_BRIDGE); base.OnCALL_UPDATE += new EventHandlers(ON_CALL_UPDATE); }
public FSInbound(string Host, int Port, string Password, string OutboundAddress = "", string DefaultHTTPMethod = "POST") : base(Host, Port, Password, EVENT_FILTER, 5, false) { //Call Services callSrvc = new CallService(); FSOutboundAddress = OutboundAddress; //Mapping of Key: job-uuid - Value: CallSid BackgroundJobs = new Dictionary<string, string>(); //Call Requests CallRequest = new Dictionary<string, Request>(); //Elapsed Times on a call CallElapsedTime = new Dictionary<string, int>(); this.DefaultHTTPMethod = DefaultHTTPMethod; base.OnBACKGROUND_JOB += new EventHandlers(ON_BACKGROUND_JOB); base.OnCHANNEL_PROGRESS += new EventHandlers(ON_CHANNEL_PROGRESS); base.OnCHANNEL_PROGRESS_MEDIA += new EventHandlers(ON_CHANNEL_PROGRESS_MEDIA); base.OnSESSION_HEARTBEAT += new EventHandlers(ON_SESSION_HEARTBEAT); base.OnCHANNEL_HANGUP_COMPLETE += new EventHandlers(ON_CHANNEL_HANGUP_COMPLETE); base.OnCHANNEL_ANSWER += new EventHandlers(ON_CHANNEL_ANSWER); base.OnCUSTOM += new EventHandlers(ON_CUSTOM); base.OnCHANNEL_BRIDGE += new EventHandlers(ON_CHANNEL_BRIDGE); base.OnCALL_UPDATE += new EventHandlers(ON_CALL_UPDATE); }
public HttpPilotClient(IMarshallingFactory factory) { _client = new TransportClient(); _marshaller = factory.GetMarshaller(new CallServiceAdapter(_client)); _unmarshaller = factory.GetUnmarshaller(this); _transportCallback = new CallbackReceiverAdapter(_unmarshaller, CallbackError); }
public ReplaceUsesService(ICallService callService, ConfigUrlService configUrlService, ConfigUrlCronService configUrlCronService, CallTokenService callTokenService) { _callService = callService; _configUrlService = configUrlService; _configUrlCronService = configUrlCronService; _callTokenService = callTokenService; }
public MainWindow(IGenerator generator, ICallService callService, IAgentService agentService, IConsoleService consoleService, IOptions <AppSettings> settings) { InitializeComponent(); this.generator = generator; this.callService = callService; this.consoleService = consoleService; this.agentService = agentService; this.settings = settings.Value; var allAgents = agentService.GetAllAgents(); foreach (var agent in allAgents) { AgenstList.Items.Add(agent); } Calls = new Queue <Call>(); ActiveCall = new List <Call>(); var newCalls = callService.GenerateCalls(); foreach (var call in newCalls) { Calls.Enqueue(call); } LogConsole.Items.Add(consoleService.CallInfo(Calls.Count())); Task.Factory.StartNew(() => { BeginInvokeExample(); }); }
public UserManager(IUserRepository userRepository, ISettingRepository settingRepository, IMessageService messageService, ICallService callService) { _userRepository = userRepository; _settingRepository = settingRepository; _messageService = messageService; _callService = callService; }
public async Task <IActionResult> GetService([FromServices] ICallService service) { return(Ok(new { Goods = await service.GetGoodsService(), Order = await service.GetOrderService() })); }
public CallController(ILogger <CallController> logger, IConfiguration configuration, ICallService callService ) { _logger = logger; _callService = callService; }
public UsersController( IUserService userService, ICallService callService ) { this._userService = userService; this._callService = callService; }
public DirectoryController(IEndpointResolverService endpointResolverService, IAccountSettings accountSettings, ICallService callService, ILogger logger, IDirectoryService directoryService) { _endpointResolverService = endpointResolverService; _accountSettings = accountSettings; _callService = callService; _logger = logger; _directoryService = directoryService; }
public CallFunction(ITokenService tokenService, IUsersService usersService, ICallService callService, IMeetingService meetingService) { // Utilize dependency injection // https://docs.microsoft.com/en-us/azure/azure-functions/functions-dotnet-dependency-injection _tokenService = tokenService; _usersService = usersService; _callService = callService; _meetingService = meetingService; }
private void CallCommandExecute() { if (string.IsNullOrEmpty(Phone)) return; _callService = DependencyService.Get<ICallService>(); _callService.MakeCall(Phone); }
public CallEtlService(ICallService serviceApi, CallTokenService tokenService, ConfigUrlService serviceUrl) { _serviceUrl = serviceUrl; _serviceApi = serviceApi; if (tokenService != null) { _token = tokenService.CallTokenCarga(); } }
public CallUrisFactoryApiService(ICallService serviceApi, CallTokenService tokenService, ConfigUrlService serviceUrl) { _serviceUrl = serviceUrl; _serviceApi = serviceApi; if (tokenService != null) { _token = tokenService.CallTokenUrisFactory(); } }
public ClientService( ICallService callService, IClientRepository clientRepository, IAddressRepository addressRepository) { this.callService = callService; this.clientRepository = clientRepository; this.addressRepo = addressRepository; }
public VerificationsController(IStringLocalizer <ErrorsResource> localizer, UserManager <ApplicationUser> userManager, IAccountService accountService, ISMSService sMSService, IConfiguration configuration, ICallService callService) : base(localizer) { _userManager = userManager; _accountService = accountService; _sMSService = sMSService; _configuration = configuration; _callService = callService; }
public TwilioVoiceController(IQueueStateHandler queueStateHandler, IAccountSettings accountSettings, ILogger logger, ICallService callService, IQueueService queueService, IQueueProvider queueProvider, IAgentService agentService) { _queueStateHandler = queueStateHandler; _accountSettings = accountSettings; _logger = logger; _callService = callService; _queueService = queueService; _queueProvider = queueProvider; _agentService = agentService; }
public CallServiceTest() { var costRepository = new Mock <ICostRepository>(); costRepository .Setup(x => x.GetCostFromInternationalCall(It.IsAny <Address>())) .Returns(3); this.callService = new CallService(costRepository.Object); }
//public ApiServer( ICallService callService, IFSService fsService, IGatewayService gatewayService) public ApiServer() { //_fsService = fsService; //_callService = callService; //_gatewayService = gatewayService; _fsService = new FSService(); _callService = new CallService(); FS = _fsService.GetFSServer(); fsInbound = new FSInbound(FS.Host, FS.Port, FS.Password, FS.OutAddress); _run = true; }
//public ApiServer( ICallService callService, IFSService fsService, IGatewayService gatewayService) public ApiServer() { //_fsService = fsService; //_callService = callService; //_gatewayService = gatewayService; _fsService = new FSService(); _callService = new CallService(); FS = _fsService.GetFSServer(); fsInbound = new FSInbound(FS.Host, FS.Port, FS.Password, FS.OutAddress); _run = true; }
private void CallCommandExecute() { if (string.IsNullOrEmpty(Phone)) { return; } _callService = DependencyService.Get <ICallService>(); _callService.MakeCall(Phone); }
public BillingSystem(IStation s, List <IPhoneNumber> phones) { CallService = new CallService(); Users = new List <IUser>(); PhoneNumbers = new Dictionary <IPhoneNumber, bool>(); Tariff = new Tariff(0.2); Station = s; foreach (var item in phones) { PhoneNumbers.Add(item, true); } RegisterHandlerForStation(s); }
public CallController( ApiSettings settings, ILogger <CallController> logger, ITransactionCoordinator transactionCoordinator, ICallService callService, IApiCallServerModelMapper callModelMapper ) : base(settings, logger, transactionCoordinator) { this.CallService = callService; this.CallModelMapper = callModelMapper; this.BulkInsertLimit = 250; this.MaxLimit = 1000; this.DefaultLimit = 250; }
public AttachController( IHostingEnvironment environment, IAttachService attachService, ICallService callService ) { this._environment = environment; this._attachService = attachService; this._callService = callService; this._baseSource = Path.Combine(this._environment.WebRootPath, "calls"); if (!Directory.Exists(this._baseSource)) { Directory.CreateDirectory(this._baseSource); } }
public virtual async void TestUpdate() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); var mapper = new ApiCallServerModelMapper(); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ICallService service = testServer.Host.Services.GetService(typeof(ICallService)) as ICallService; ApiCallServerResponseModel model = await service.Get(1); ApiCallClientRequestModel request = mapper.MapServerResponseToClientRequest(model); request.SetProperties(1, 1, 1, "B", 1, DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), DateTime.Parse("1/1/1988 12:00:00 AM"), 2); UpdateResponse <ApiCallClientResponseModel> updateResponse = await client.CallUpdateAsync(model.Id, request); context.Entry(context.Set <Call>().ToList()[0]).Reload(); updateResponse.Record.Should().NotBeNull(); updateResponse.Success.Should().BeTrue(); updateResponse.Record.Id.Should().Be(1); context.Set <Call>().ToList()[0].AddressId.Should().Be(1); context.Set <Call>().ToList()[0].CallDispositionId.Should().Be(1); context.Set <Call>().ToList()[0].CallStatusId.Should().Be(1); context.Set <Call>().ToList()[0].CallString.Should().Be("B"); context.Set <Call>().ToList()[0].CallTypeId.Should().Be(1); context.Set <Call>().ToList()[0].DateCleared.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Call>().ToList()[0].DateCreated.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Call>().ToList()[0].DateDispatched.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); context.Set <Call>().ToList()[0].QuickCallNumber.Should().Be(2); updateResponse.Record.Id.Should().Be(1); updateResponse.Record.AddressId.Should().Be(1); updateResponse.Record.CallDispositionId.Should().Be(1); updateResponse.Record.CallStatusId.Should().Be(1); updateResponse.Record.CallString.Should().Be("B"); updateResponse.Record.CallTypeId.Should().Be(1); updateResponse.Record.DateCleared.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.DateCreated.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.DateDispatched.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM")); updateResponse.Record.QuickCallNumber.Should().Be(2); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ICallService service) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); service.InitServiceList(); }
public CallApiVirtualPath(CallTokenService tokenService, ConfigUrlService serviceUrl, ICallService serviceApi) { _serviceUrl = serviceUrl; _serviceApi = serviceApi; if (tokenService != null) { bool tokenCargado = false; while (!tokenCargado) { try { _token = tokenService.CallTokenApiDocumentacion(); tokenCargado = true; } catch (Exception ex) { tokenCargado = false; } } } }
static CallValidator() { CallService = InstanceFactory.GetInstance <ICallService>(); }
public CallRepositoryConfigApiService(ICallService serviceApi) { _serviceApi = serviceApi; }
public UnreadController(ISmsService smsService, IEmailService emailService, ICallService callService) { _smsService = smsService; _emailService = emailService; _callService = callService; }
public CallController(ICallService callService) { _callService = callService; }
public CallShapeConfigApiService(ICallService serviceApi) { _serviceApi = serviceApi; }
public PhoneNumberController(IPhoneNumberService phoneNumberService, ISmsService smsService, ICallService callService) { _phoneNumberService = phoneNumberService; _smsService = smsService; _callService = callService; }
public CallModule(IInboundDependency apiServer) { this.apiserver = apiServer; this.callService = new CallService(); this.RequiresAuthentication(); #region Get All Calls Get["/Accounts/{AccountSid}/Calls"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } return(Response.AsXml <IEnumerable <Call> >(callService.GetAllCalls(Context.CurrentUser.UserName))); }; #endregion #region Make Call Post["/Accounts/{AccountSid}/Calls/Call.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } var request = this.Bind <CallRequest>(); //Todo //Validation request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return(Response.AsJson <Call>(res)); }; Post["/Accounts/{AccountSid}/Calls/Call"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } var request = this.Bind <CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return(Response.AsXml <Call>(res)); }; #endregion #region Modify Call Post["/Accounts/{AccountSid}/Calls/{CallSid}.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } var request = this.Bind <CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return(Response.AsJson <Call>(res)); }; Post["/Accounts/{AccountSid}/Calls/{CallSid}"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } var request = this.Bind <CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return(Response.AsXml <Call>(res)); }; #endregion #region Play to Call Post["/Accounts/{AccountSid}/Calls/{CallSid}/Play.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallPlayRequest>(); request.AccountSid = Context.CurrentUser.UserName; request.CallSid = x.CallSid; CallPlayResponse res = apiserver.GetServer().CallPlay(request); return(Response.AsJson <CallPlayResponse>(res)); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Play"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallPlayRequest>(); request.CallSid = x.CallSid; request.AccountSid = Context.CurrentUser.UserName; CallPlayResponse res = apiserver.GetServer().CallPlay(request); return(Response.AsXml <CallPlayResponse>(res)); } }; #endregion #region Stop Call Play Delete["/Accounts/{AccountSid}/Calls/{CallSid}/Play"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { if (apiserver.GetServer().StopCallPlay(x.CallSid)) { return(HttpStatusCode.NoContent); } else { return(HttpStatusCode.NoResponse); } //else to do } }; #endregion #region Record Call Post["/Accounts/{AccountSid}/Calls/{CallSid}/Record.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallRecordRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallRecordResponse res = apiserver.GetServer().CallRecord(request); return(Response.AsJson <CallRecordResponse>(res)); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Record"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallRecordRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallRecordResponse res = apiserver.GetServer().CallRecord(request); return(Response.AsXml <CallRecordResponse>(res)); } }; #endregion #region Stop Call Record Delete["/Accounts/{AccountSid}/Calls/{CallSid}/Record"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { if (apiserver.GetServer().StopCallRecord(x.CallSid)) { return(HttpStatusCode.NoContent); } else { return(HttpStatusCode.NoResponse); } } }; #endregion #region Speak Post["/Accounts/{AccountSid}/Calls/{CallSid}/Speak.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallSpeakRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallSpeakResponse res = apiserver.GetServer().CallSpeak(request); return(Response.AsJson <CallSpeakResponse>(res)); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Speak"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallSpeakRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallSpeakResponse res = apiserver.GetServer().CallSpeak(request); return(Response.AsXml <CallSpeakResponse>(res)); } }; #endregion #region Digits Post["/Accounts/{AccountSid}/Calls/{CallSid}/Digit.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallDigitRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallDigitResponse res = apiserver.GetServer().CallDigit(request); return(Response.AsJson <CallDigitResponse>(res)); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Digit"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return(HttpStatusCode.Unauthorized); } else { var request = this.Bind <CallDigitRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallDigitResponse res = apiserver.GetServer().CallDigit(request); return(Response.AsXml <CallDigitResponse>(res)); } }; #endregion }
public CallInController(ICallService callService, IApiAuthenticationSettings apiAuthenticationSettings) { _callService = callService; _apiAuthenticationSettings = apiAuthenticationSettings; }
public Station() { _portService = new PortService(); _callService = new CallService(); _terminalService = new TerminalService(); }
public CallController(ICallService callService) { this.CallService = callService; }
private void CallCommandExecute() { _callService = DependencyService.Get<ICallService>(); _callService.MakeCall("612345678"); }
public RoutingController(IEndpointResolverService endpointResolverService, ILogger logger, ICallService callService) { _endpointResolverService = endpointResolverService; _logger = logger; _callService = callService; }
/// <summary> /// default constructor /// </summary> /// <param name="callService"></param> /// <param name="contactService"></param> public ContactController(IContactService contactService, ICallService callService) { _contactService = contactService; _callService = callService; _customJsonConverter = new CustomJsonConverter(); }
public CallController(ICallService callService, IUnitOfWork unitOfWork) { CallService = callService; UnitOfWork = unitOfWork; }
public CallHistoryViewModel(ICallService callService) { _callService = callService; _PhoneNumbers = _callService.All(); }
public CallModule(IInboundDependency apiServer) { this.apiserver = apiServer; this.callService = new CallService(); this.RequiresAuthentication(); #region Get All Calls Get["/Accounts/{AccountSid}/Calls"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } return Response.AsXml<IEnumerable<Call>>(callService.GetAllCalls(Context.CurrentUser.UserName)); }; #endregion #region Make Call Post["/Accounts/{AccountSid}/Calls/Call.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } var request = this.Bind<CallRequest>(); //Todo //Validation request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return Response.AsJson<Call>(res); }; Post["/Accounts/{AccountSid}/Calls/Call"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } var request = this.Bind<CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return Response.AsXml<Call>(res); }; #endregion #region Modify Call Post["/Accounts/{AccountSid}/Calls/{CallSid}.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } var request = this.Bind<CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return Response.AsJson<Call>(res); }; Post["/Accounts/{AccountSid}/Calls/{CallSid}"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } var request = this.Bind<CallRequest>(); request.AccountSid = Context.CurrentUser.UserName; Call res = apiserver.GetServer().Call(request); return Response.AsXml<Call>(res); }; #endregion #region Play to Call Post["/Accounts/{AccountSid}/Calls/{CallSid}/Play.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallPlayRequest>(); request.AccountSid = Context.CurrentUser.UserName; request.CallSid = x.CallSid; CallPlayResponse res = apiserver.GetServer().CallPlay(request); return Response.AsJson<CallPlayResponse>(res); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Play"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallPlayRequest>(); request.CallSid = x.CallSid; request.AccountSid = Context.CurrentUser.UserName; CallPlayResponse res = apiserver.GetServer().CallPlay(request); return Response.AsXml<CallPlayResponse>(res); } }; #endregion #region Stop Call Play Delete["/Accounts/{AccountSid}/Calls/{CallSid}/Play"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { if (apiserver.GetServer().StopCallPlay(x.CallSid)) { return HttpStatusCode.NoContent; } else { return HttpStatusCode.NoResponse; } //else to do } }; #endregion #region Record Call Post["/Accounts/{AccountSid}/Calls/{CallSid}/Record.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallRecordRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallRecordResponse res = apiserver.GetServer().CallRecord(request); return Response.AsJson<CallRecordResponse>(res); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Record"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallRecordRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallRecordResponse res = apiserver.GetServer().CallRecord(request); return Response.AsXml<CallRecordResponse>(res); } }; #endregion #region Stop Call Record Delete["/Accounts/{AccountSid}/Calls/{CallSid}/Record"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { if (apiserver.GetServer().StopCallRecord(x.CallSid)) { return HttpStatusCode.NoContent; } else { return HttpStatusCode.NoResponse; } } }; #endregion #region Speak Post["/Accounts/{AccountSid}/Calls/{CallSid}/Speak.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallSpeakRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallSpeakResponse res = apiserver.GetServer().CallSpeak(request); return Response.AsJson<CallSpeakResponse>(res); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Speak"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallSpeakRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallSpeakResponse res = apiserver.GetServer().CallSpeak(request); return Response.AsXml<CallSpeakResponse>(res); } }; #endregion #region Digits Post["/Accounts/{AccountSid}/Calls/{CallSid}/Digit.json"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallDigitRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallDigitResponse res = apiserver.GetServer().CallDigit(request); return Response.AsJson<CallDigitResponse>(res); } }; Post["/Accounts/{AccountSid}/Calls/{CallSid}/Digit"] = x => { if (x.AccountSid != Context.CurrentUser.UserName) { return HttpStatusCode.Unauthorized; } else { var request = this.Bind<CallDigitRequest>(); request.AccountSid = Context.CurrentUser.UserName; CallDigitResponse res = apiserver.GetServer().CallDigit(request); return Response.AsXml<CallDigitResponse>(res); } }; #endregion }
public HomeViewModel(IMvxPhoneCallTask phoneCall, ICallService callService) { _phoneCall = phoneCall; _callService = callService; }