Name

Authenticate() — Requires that the caller enter a correct password before continuing

Synopsis

Authenticate(password[,options[,maxdigits]])

Requires a caller to enter a given password in order to continue execution of the next priority in the dialplan. Authenticate() gives the caller three chances to enter the password correctly. If the password is not correctly entered after three tries, the channel is hung up.

If password begins with the / character, it is interpreted as a file that contains a list of valid passwords (one per line). Passwords may also be stored in the Asterisk database (AstDB); see the d option below.

The maxdigits parameter sets the maximum number of digits that may be entered by the caller. It not set, the application will accept an unlimited number of digits and will wait for the caller to press the # key after entering his authentication code.

A set of options may be provided, consisting of one or more of the letters in the following list:

a

Sets the CDR field named accountcode and the channel variable ACCOUNTCODE to the password that is entered

d

Interprets the path as the database key from the Asterisk database in which to find the password, not a literal file. When using a database key, the value associated with the key can be anything.

j

Supports jumping to priority n+101 if authentication fails

m

Interprets the given path as a file that contains a list of account codes and password hashes delimited with : (colon character), 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

Removes the database key upon successful entry (valid with d only).

; force the caller to enter the password before continuing, 
; and set the CDR field named 'accountcode' to the entered password
exten => 123,1,Answer()
exten => 123,n,Authenticate(1234,a)
exten => 123,n,Playback(pin-number-accepted)
exten => 123,n,SayDigits(${ACCOUNTCODE})

Get Asterisk: The Future of Telephony, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.