Authenticate Script

  1. main:
  2.    # Authenticate with retries
  3.    $retry = 3
  4.    @phone::clearDtmf()
  5.    while( $retry > 0 )
  6.       if (exists($userId))
  7.          $id = $userId
  8.       else
  9.          @phone::play("phrase", "call-in userid")
  10.          $id = @phone::getDigits(10)
  11.       endif
  12.       @phone::play("phrase", "enter password")
  13.       $pwd = @phone::getDigits(10)
  14.       $idLength = $id::length()
  15.       $pwdLength = $pwd::length()
  16.       if (( $idLength > 0) && ($pwdLength > 0))
  17.          @session = @interaction::authenticatePhoneLogin($id, $pwd)
  18.          $authenticated = @session::isAuthenticated()
  19.       endif
  20.       if ( $authenticated )
  21.          $retry = 0
  22.          if (! exists($userId))
  23.             $userId = $id
  24.          endif
  25.       else
  26.          $retry = $retry - 1
  27.          @phone::clearDtmf()
  28.          @phone::play("phrase", "bad password")
  29.       endif
  30.    endwhile
  31.    if (! $authenticated)
  32.       @phone::clearDtmf()
  33.       @phone::play("phrase", "exhaust login")
  34.    endif
  35. return
Annotation:

3.  Sets the number of times a User can try to authenticate.

5.  Establishes a loop until the number of retries has been exhausted.

6-11.  Determines the caller’s phone ID. If not already set, the User is prompted.

12-13.  Prompts for caller’s phone password.

14-19.  Attempts to authenticate caller based on the $id and $pwd

20-25.  If successfully authenticated, sets the $userId and exits the loop.

26-29.  If the provided $id and $pwd cannot be authenticated, informs the User that the login failed and decrements the number of retries.

31-34.  If the caller could not be authenticated after the specified number of retries, then informs the User that they have exhausted all of their login attempts.

Event Processing Overview

Script Hierarchy

Relationship between Scripts and Script Objects