Authenticate()

Verlangt zur Fortsetzung eines Vorgangs die Eingabe eines Passworts vom Anrufer.

Authenticate(Passwort[,Optionen[,maxZiffern]])

Verlangt, dass der Anrufer ein gegebenes Passwort korrekt eingibt, um dann mit der Ausführung der nächsten Priorität im Dialplan fortzufahren. Authenticate() gibt dem Anrufer drei Versuche, das Passwort korrekt einzugeben. Andernfalls wird die Verbindung beendet.

Falls Passwort mit dem /-Zeichen beginnt, wird es als Datei interpretiert, die eine Liste gültiger Passwörter (genau eins pro Zeile) enthält. Passwörter können auch in der Asterisk-Datenbank (AstDB) gespeichert sein, siehe dazu die Option d weiter unten.

Folgende Optionen sind möglich (auch in Kombination):

a
(accountcode) Setzt den Namen des CDR-Felds accountcode und die Variable für den Channel, ACCOUNTCODE, auf das eingegebene Passwort.
d
(database) Interpretiert Passwort als Schlüssel der Asterisk-Datenbank. Wenn ein Datenbankschlüssel benutzt wird, kann der mit dem Schlüssel assoziierte Wert beliebig sein.
r
(remove) Entfernt den Datenbankschlüssel nach erfolgreicher Verbindung und Eintreten in die Datenbank (nur möglich mit Option d).
j
(jump) Bei falschem Passwort statt aufzulegen zur Priorität n+101 springen, falls diese existiert.
[Wichtig]Wichtig

Beachten Sie bei der Option d, dass - wenig nachvollziehbar! - als Parameter /passwoerter/1234 verlangt wird, wobei passwoerter die Familie ist und 1234 das Passwort; der unter diesem Schlüssel gespeicherte Wert ist irrelevant. Der gesunde Menschenverstand würde einen Datenbank-Eintrag wie /passwoerter/art => 1234 erwarten.

Mit Angabe von maxZiffern wird die Eingabe automatisch nach sovielen Ziffern beendet, ohne dass der User # drücken muss (Default: 0 für keine Begrenzung).

Liefert 0 zurück, falls der Benutzer nach maximal drei Versuchen ein gültiges Passwort eingegeben hat, sonst -1 (auch nach Auflegen).

; Passwort 1234 verlangen:
exten => 123,1,Answer()
exten => 123,2,Authenticate(1234,j,4)           ; hier ausnahmsweise mit Priority-Jumping
                                                ; weil wir dem Anrufer noch sagen wollen
                                                ; dass sein Passwort falsch ist
exten => 123,3,Playback(pin-nummer-akzeptiert)
exten => 123,103,Playback(pin-nummer-falsch)
[Anmerkung]Anmerkung

Interner Hilfetext zu dieser Applikation in Asterisk 1.4: 

  -= Info about application 'Authenticate' =- 

[Synopsis]
Authenticate a user

[Description]
  Authenticate(password[|options[|maxdigits]]): This application asks the caller
to enter a given password in order to continue dialplan execution. If the password
begins with the '/' character, it is interpreted as a file which contains a list of
valid passwords, listed 1 password per line in the file.
  When using a database key, the value associated with the key can be anything.
Users have three attempts to authenticate before the channel is hung up. If the
passsword is invalid, the 'j' option is specified, and priority n+101 exists,
dialplan execution will continnue at this location.
  Options:
     a - Set the channels' account code to the password that is entered
     d - Interpret the given path as database key, not a literal file
     j - Support jumping to n+101 if authentication fails
     m - Interpret the given path as a file which contains a list of account
         codes and password hashes delimited with ':', listed one per line in
         the file. When one of the passwords is matched, the channel will have
         its account code set to the corresponding account code in the file.
     r - Remove the database key upon successful entry (valid with 'd' only)
     maxdigits  - maximum acceptable number of digits. Stops reading after
         maxdigits have been entered (without requiring the user to
         press the '#' key).
         Defaults to 0 - no limit - wait for the user press the '#' key.

Differenz zum internen Hilfetext in Asterisk 1.2: 

8,10c8,10
<   Authenticate(password[|options[|maxdigits]]): This application asks the caller
< to enter a given password in order to continue dialplan execution. If the password
< begins with the '/' character, it is interpreted as a file which contains a list of
---
>   Authenticate(password[|options]): This application asks the caller to enter a
> given password in order to continue dialplan execution. If the password begins
> with the '/' character, it is interpreted as a file which contains a list of
25,28d24
<      maxdigits  - maximum acceptable number of digits. Stops reading after
<          maxdigits have been entered (without requiring the user to
<          press the '#' key).
<          Defaults to 0 - no limit - wait for the user press the '#' key.

Siehe auch. VMAuthenticate()


Version 1.2, November 2002

Neue Version verfügbar

Sie betrachten gerade die alte Version des Buches (Version 1.0). Wir empfehlen Ihnen für Asterisk 1.4 und 1.6 die neue Version des Buches.

Asterisk-Tag 2008

Lernen Sie Mark Spencer (den Erfinder von Asterisk) kennen! Viele Vorträge, Case-Studies und Workshops rund um das Thema VoIP. Asterisk-Tag.org

Das gedruckte Buch