public bool Login(string serverAddress, string username, string password) { if (_client != null) { _client.ErrorOccurred -= _client_ErrorOccurred; } _client = new OpsClient(); _client.ErrorOccurred += _client_ErrorOccurred; return(_client.Login(serverAddress, username, password)); }
private static void Login(string serverAddress, string username, string password) { client = new OpsClient(); Console.WriteLine("Connecting..."); client.ErrorOccurred += client_ErrorOccurred; var result = client.Login(serverAddress, username, password); if (result) { Console.WriteLine("Successfully connected to {0} with username: {1}.", serverAddress, username); client.SessionCreated += new EventHandler <Ozeki.VoIP.VoIPEventArgs <OPSSDK.ISession> >(opsClient_SessionCreated); } else { Console.WriteLine("Connection fail try again."); Console.WriteLine("Please check whether the IP address is correct and the given user has right to use OPS SDK. This can be checked under PBX features/Preferences/User access profile."); ReadLoginInfos(); } }
private static void Login(string serverAddress, string username, string password) { client = new OpsClient(); Console.WriteLine("Connecting..."); client.ErrorOccurred += client_ErrorOccurred; var result = client.Login(serverAddress, username, password); if (result) { Console.WriteLine("Successfully connected to {0} with username: {1}.", serverAddress, username); client.SessionCreated += new EventHandler<Ozeki.VoIP.VoIPEventArgs<OPSSDK.ISession>>(opsClient_SessionCreated); } else { Console.WriteLine("Connection fail try again."); Console.WriteLine("Please check whether the IP address is correct and the given user has right to use OPS SDK. This can be checked under PBX features/Preferences/User access profile."); ReadLoginInfos(); } }
/// <summary> /// Create an OPS Client, and try to login into PBX with the given parameters /// </summary> /// <param name="serverAddress">The address of your Ozeki Phone System XE PBX</param> /// <param name="username">Valid Username for your Ozeki Phone System XE PBX</param> /// <param name="password">Valid Password for the given Username</param> /// <returns>Can or cannot connect to the PBX</returns> private bool TryCreateConnectToClient(string serverAddress, string username, string password) { opsClient = new OpsClient(); opsClient.ErrorOccurred += ClientOnErrorOccurred; var result = opsClient.Login(serverAddress, username, password); if (!result) { Console.WriteLine("Cannot connect to the server, please check the login details and the availability of your PBX! Press Enter to continue!"); Console.ReadLine(); return false; } return true; }