Inbound Voice Scripting

When a User initiates contact into the xMatters system through a phone, the Phone Device Engine executes a script to process the call. This process is scriptable.

Once the conversation has been established with a User, a domain-specific script is called for each notification to present it to the User. The following figure illustrates this event flow:

Script Inputs

The callin script inputs are:

Script Package Structure

All Phone Device Engines reference the Callin script package. Each xMatters deployment can contain only one Callin script package. The Callin script package can contain multiple callin scripts. From the web user interface, an Administrator can assign a callin script to a phone line. Any inbound calls on that line will be processed with the assigned callin script.

Example

Example: User Calls In

The following example processes a User call in and plays all of the User’s pending notifications:

  1. main:
  2. $authenticated = false
  3. @phone::play("phrase", "call-in greeting")
  4. call authenticate
  5. if ( $authenticated )
  6.     $targetName = @session::getUserTargetName()
  7.     @recipient = @interaction::getRecipient($targetName)
  8.     @phone::setLanguage($recipient.country, $recipient.language)
  9.     gosub presentNotifications
  10. endif
  11. @phone::clearDtmf()
  12. @phone::play("phrase", "goodbye")
  13. @phone::hangup()
  14. exit
Annotation:

2-4.  Establishes the caller’s identity

6-7.  Retrieves context around the User

8.  Configures phone to User’s locale

9.  Presents notifications to User

11-13.  Disconnects User

Subroutine: presentNotifications
  1. presentNotifications:
  2. @phone::clearDtmf()
  3. $notificationIds = @session::getNotifications()
  4. for ($notId : $notificationIds )
  5.     @content = @session::getNotificationContent($notId)
  6.     gosub presentNotification
  7. endfor
  8. return
Annotation:

2-7.  Iterates through each notification, retrieving the notification content and presenting the notification to the User.

Subroutine: presentNotification
  1. presentNotification:
  2. @interaction::runInteractionScript($notId, $script, @script, @session, @content, @recipient, @phone)
  3. return
Annotation:

1.  Subroutine label.

2.  Runs the interaction script that has been enhanced for the notification. This script will present the notification to the user.

 

Next topic: Authenticate Script