Name

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

Synopsis

    Authenticate(password[,options])

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.

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.

r

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

Returns 0 if the user enters a valid password within three tries, or -1 otherwise (or on hangup).

    ; 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,2,Authenticate(1234,a)
    exten => 123,3,Playback(pin-number-accepted)
    exten => 123,4,SayDigits(${ACCOUNTCODE})

Get Asterisk: The Future of Telephony 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.