/// <summary> /// Called when the app is in foreground (when it starts or when it's resumed) /// </summary> protected override void OnLaunched() { Debug.WriteLine("[LinphoneForegroundLifeTimeAgent] The UI has entered the foreground."); AgentHost.OnAgentStarted(); //Force the callController to be initialized now to avoid creating it at the last moment (workaroud outgoing call crash after app started) Globals.Instance.CallController.IncomingCallViewDismissed = null; // Changes the decline reason if needed. if (Customs.DeclineCallWithBusyReason) { Globals.Instance.CallController.DeclineReason = Reason.LinphoneReasonBusy; } }
protected override void OnInvoke(ScheduledTask task) { Debug.WriteLine("[LinphoneScheduledAgent] ScheduledAgentImpl has been invoked with argument of type {0}.", task.GetType()); AgentHost.OnAgentStarted(); VoipHttpIncomingCallTask incomingCallTask = task as VoipHttpIncomingCallTask; if (incomingCallTask != null) { this.isIncomingCallAgent = true; Debug.WriteLine("[IncomingCallAgent] Received VoIP Incoming Call task"); BackgroundManager.Instance.OopServer.CallController.IncomingCallViewDismissed = OnIncomingCallDialogDismissed; BackgroundManager.Instance.InitLinphoneCore(); } else { VoipKeepAliveTask keepAliveTask = task as VoipKeepAliveTask; if (keepAliveTask != null) { this.isIncomingCallAgent = false; Debug.WriteLine("[KeepAliveAgent] Keep Alive task"); if (DeviceNetworkInformation.IsNetworkAvailable) { var server = BackgroundManager.Instance.OopServer; InitManager.CreateLinphoneCore(server, this, OutputTraceLevel.Message); server.LinphoneCore.NetworkReachable = true; server.LinphoneCore.IterateEnabled = true; Debug.WriteLine("[KeepAliveAgent] Linphone Core created"); } else { Debug.WriteLine("[KeepAliveAgent] Not connected, can't refresh register"); base.NotifyComplete(); } } else { throw new InvalidOperationException(string.Format("Unknown scheduled task type {0}", task.GetType())); } } }
/// <summary> /// Called when the first call has started. /// </summary> protected override void OnFirstCallStarting() { Debug.WriteLine("[LinphoneCallInProgressAgent] The first call has started."); AgentHost.OnAgentStarted(); }