コード例 #1
0
 /// <summary>
 /// Creates a new LinphoneCore (if not created yet) using a LinphoneCoreFactory.
 /// </summary>
 public void InitLinphoneCore()
 {
     // Initiate incoming call processing by creating the Linphone Core
     InitManager.CreateLinphoneCore(OopServer, null, OutputTraceLevel.Message);
     OopServer.LinphoneCore.NetworkReachable = true;
     OopServer.LinphoneCore.IterateEnabled   = true;
 }
コード例 #2
0
        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()));
                }
            }
        }