namespace AsterNET.Manager.Action { /// /// The LoginAction authenticates the connection.
/// A successful login is the precondition for sending any other action except /// for the ChallengeAction.
/// An unsuccessful login results in an ManagerError being received from the /// server with a message set to "Authentication failed" and the socket being /// closed by Asterisk. ///
/// /// public class LoginAction : ManagerAction { /// /// Creates a new empty LoginAction. /// public LoginAction() { } /// /// Creates a new LoginAction that performs a cleartext login.
/// You should not use cleartext login if you are concerned about security and login with a password hash instead. ///
/// the username as configured in Asterisk's manager.conf /// the user's password as configured in Asterisk's manager.conf /// public LoginAction(string username, string secret) { Username = username; Secret = secret; } /// /// Creates a new LoginAction that performs a login via challenge/response. /// /// the username as configured in Asterisk's manager.conf /// /// the digest alogrithm, must match the digest algorithm that was used with the corresponding /// ChallengeAction. /// /// the hash of the user's password and the challenge public LoginAction(string username, string authType, string key) { Username = username; AuthType = authType; Key = key; } /// /// Creates a new LoginAction that performs a login via challenge/response. /// /// the username as configured in Asterisk's manager.conf /// /// the digest alogrithm, must match the digest algorithm that was used with the corresponding /// ChallengeAction. /// /// the hash of the user's password and the challenge /// /// the event mask.
/// Set to "on" if all events should be send, "off" if not events should be sent /// or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent. /// public LoginAction(string username, string authType, string key, string events) { Username = username; AuthType = authType; Key = key; Events = events; } /// /// Get the name of this action, i.e. "Login". /// public override string Action { get { return "Login"; } } /// /// Get/Set the username as configured in asterik's manager.conf. /// public string Username { get; set; } /// /// Get/Set the secret to use when using cleartext login.
/// The secret contains the user's password as configured in Asterisk's manager.conf.
/// The secret and key properties are mutually exclusive. ///
public string Secret { get; set; } /// /// Get/Set the digest alogrithm when using challenge/response.
/// The digest algorithm is used to create the key based on the challenge and /// the user's password.
/// Currently Asterisk supports only "MD5". ///
public string AuthType { get; set; } /// /// Get/Set the key. /// public string Key { get; set; } /// /// Get/Set the event mask.
/// Set to "on" if all events should be send, "off" if not events should be sent or a combination of /// "system", "call" and "log" (separated by ',') to specify what kind of events should be sent. ///
public string Events { get; set; } } }