protected void RegisterOutgoingRequest(OutgoingCallRequest request) { if ((request.Source != default(PhoneNumber) && request.Target != default(PhoneNumber)) && (GetCallInfo(request.Source) == null && GetConnectionInfo(request.Source) == null) && CheckBalance(request.Source)) { var callInfo = new CallInfo() { Source = request.Source, Target = request.Target, Started = DateTime.Now }; ITerminal targetTerminal = GetTerminalByPhoneNumber(request.Target); IPort targetPort = GetPortByPhoneNumber(request.Target); if (targetPort.State == PortState.Free) { _connectionCollection.Add(callInfo); targetPort.State = PortState.Busy; targetTerminal.IncomingRequestFrom(request.Source); } else { OnCallInfoPrepared(this, callInfo); } } }
public void Call(OutgoingCallRequest request) { Task.Run(() => { Debug.WriteLine("VoipChannel.Call"); _hub.IsAppInsightsEnabled = ChatterBox.Client.Common.Settings.SignalingSettings.AppInsightsEnabled; Context.WithState(st => st.Call(request)).Wait(); }); }
protected virtual void OnOutgoingCall(object sender, PhoneNumber target) { if (OutgoingConnection != null) { ServerIncomingRequest = new OutgoingCallRequest() { Source = Number, Target = target }; OutgoingConnection(sender, ServerIncomingRequest); } }
public LocalRinging(RelayMessage message) { _message = message; try { _callRequest = (OutgoingCallRequest)JsonConvert.DeserializeObject(message.Payload, typeof(OutgoingCallRequest)); } catch (Exception) { if (Debugger.IsAttached) { throw; } } }
private async Task DigestActionInput(DialogContext dc, OutgoingCallRequest request) { var state = await _stateAccessor.GetAsync(dc.Context); // generate the luis result based on event input state.LuisResult = new PhoneLuis { Text = request.ContactPerson, Intents = new Dictionary <PhoneLuis.Intent, IntentScore>() }; state.LuisResult.Intents.Add(PhoneLuis.Intent.OutgoingCall, new IntentScore() { Score = 0.9 }); state.LuisResult.Entities = new PhoneLuis._Entities { _instance = new PhoneLuis._Entities._Instance(), contactName = string.IsNullOrEmpty(request.ContactPerson) ? null : new string[] { request.ContactPerson }, phoneNumber = string.IsNullOrEmpty(request.PhoneNumber) ? null : new string[] { request.PhoneNumber } }; state.LuisResult.Entities._instance.contactName = string.IsNullOrEmpty(request.ContactPerson) ? null : new[] { new InstanceData { StartIndex = 0, EndIndex = request.ContactPerson.Length, Text = request.ContactPerson } }; state.LuisResult.Entities._instance.phoneNumber = string.IsNullOrEmpty(request.PhoneNumber) ? null : new[] { new InstanceData { StartIndex = 0, EndIndex = request.PhoneNumber.Length, Text = request.PhoneNumber } }; // save to turn context dc.Context.TurnState.Add(StateProperties.PhoneLuisResultKey, state.LuisResult); }
public void StartOutgoingCall(OutgoingCallRequest request) { var capabilities = VoipPhoneCallMedia.Audio; if (request.VideoEnabled) { capabilities |= VoipPhoneCallMedia.Video; } var vCC = VoipCallCoordinator.GetDefault(); VoipCall = vCC.RequestNewOutgoingCall(request.PeerUserId, request.PeerUserId, "ChatterBox Universal", capabilities); if (VoipCall != null) { SubscribeToVoipCallEvents(); VoipCall.NotifyCallActive(); } }
private void SetActiveCall(string userId, string userName, bool addVideoCaps) { var foregroundIsVisible = false; var state = Hub.Instance.ForegroundClient.GetForegroundState(); if (state != null) { foregroundIsVisible = state.IsForegroundVisible; } if (VoipCall == null) { var fakeRequest = new OutgoingCallRequest() { PeerUserId = userId, VideoEnabled = addVideoCaps }; StartOutgoingCall(fakeRequest); } }
// On win8.1 the functionality for voip call is not available // so this implementation is dummy. public void SetActiveCall(OutgoingCallRequest request) { }
public void StartOutgoingCall(OutgoingCallRequest request) { }
public virtual async Task Call(OutgoingCallRequest request) { }
public VoipState_EstablishOutgoing(OutgoingCallRequest request) { _callRequest = request; }
// Handles routing to additional dialogs logic. private async Task <DialogTurnResult> RouteStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var a = stepContext.Context.Activity; var state = await _stateAccessor.GetAsync(stepContext.Context, () => new PhoneSkillState(), cancellationToken : cancellationToken); state.IsAction = false; if (a.Type == ActivityTypes.Message && !string.IsNullOrEmpty(a.Text)) { // Get connected LUIS result from turn state. var result = stepContext.Context.TurnState.Get <PhoneLuis>(StateProperties.PhoneLuisResultKey); var intent = result?.TopIntent().intent; // switch on general intents switch (intent) { case PhoneLuis.Intent.OutgoingCall: { return(await stepContext.BeginDialogAsync(nameof(OutgoingCallDialog), cancellationToken : cancellationToken)); } case PhoneLuis.Intent.None: { // No intent was identified, send confused message await stepContext.Context.SendActivityAsync(_templateManager.GenerateActivity(PhoneSharedResponses.DidntUnderstandMessage), cancellationToken); break; } default: { // intent was identified but not yet implemented await stepContext.Context.SendActivityAsync(_templateManager.GenerateActivity(PhoneMainResponses.FeatureNotAvailable), cancellationToken); break; } } } else if (a.Type == ActivityTypes.Event) { // Handle skill actions here var eventActivity = a.AsEventActivity(); switch (eventActivity.Name) { case Events.SkillBeginEvent: { if (eventActivity.Value is Dictionary <string, object> userData) { // Capture user data from event if needed } break; } case Events.TokenResponseEvent: { // Auth dialog completion var result = await stepContext.ContinueDialogAsync(cancellationToken); // If the dialog completed when we sent the token, end the skill conversation if (result.Status != DialogTurnStatus.Waiting) { var response = stepContext.Context.Activity.CreateReply(); response.Type = ActivityTypes.EndOfConversation; await stepContext.Context.SendActivityAsync(response, cancellationToken); } break; } case Events.OutgoingCallEvent: { OutgoingCallRequest actionData = null; var eventValue = a.Value as JObject; if (eventValue != null) { actionData = eventValue.ToObject <OutgoingCallRequest>(); if (!string.IsNullOrEmpty(actionData.ContactPerson) || !string.IsNullOrEmpty(actionData.PhoneNumber)) { await DigestActionInput(stepContext, actionData); } } state.IsAction = true; return(await stepContext.BeginDialogAsync(nameof(OutgoingCallDialog), cancellationToken : cancellationToken)); } default: await stepContext.Context.SendActivityAsync(new Activity(type : ActivityTypes.Trace, text : $"Unknown Event '{eventActivity.Name ?? "undefined"}' was received but not processed."), cancellationToken); break; } } // If activity was unhandled, flow should continue to next step return(await stepContext.NextAsync(cancellationToken : cancellationToken)); }
public VoipState_ActiveCall(OutgoingCallRequest callRequest) { _callRequest = callRequest; }
public void Call(OutgoingCallRequest request) { InvokeHubChannel <IVoipChannel>(request); }
public void SetActiveCall(OutgoingCallRequest request) { SetActiveCall(request.PeerUserId, request.PeerUserId, request.VideoEnabled); }
public IAsyncAction CallAsync(OutgoingCallRequest request) { return(Context.WithState(st => st.CallAsync(request)).AsAsyncAction()); }
public IAsyncAction CallAsync(OutgoingCallRequest request) { return(InvokeHubChannelAsync <ICallChannel>(request).AsTask().AsAsyncAction()); }
public override async Task Call(OutgoingCallRequest request) { var remoteRingingState = new VoipState_RemoteRinging(request); await Context.SwitchState(remoteRingingState); }
public RemoteRinging(OutgoingCallRequest request) { _request = request; }
public VoipState_EstablishIncoming(RelayMessage message) { _message = message; _callRequest = (OutgoingCallRequest)JsonConvert.Deserialize(message.Payload, typeof(OutgoingCallRequest)); }
private const int _callDueTimeout = 1000 * 30; // 30 seconds public VoipState_RemoteRinging(OutgoingCallRequest request) { _request = request; }