Setting Up Mobile Call Account Verification with OnVerify

Account activation via mobile number at Jelastic is intended to ensure the complete protection from malefactors, which are trying to make profit on the provided free of charge trial period through the continuous generation of new accounts. By default, the SMS number confirmation is used. However, due to the fact of existing of a lot of public services that provide a temporary phone number (which can be used for just a single activation code receiving), the more secure option can be required.

According to the proposed below solution, the phone number verification via call can be used for that  - as an example, we’ve chosen the OnVerify service. It allows to send activation code via voice message instead of notifying users by means of SMS. So, let’s find out how to configure this type of account activation.

Note that in order to work with a mobile call verification, the mandatory account activation should be enabled, with the mobile number verification being added to the form. Thus, before proceeding further, please make sure you’ve performed all the necessary preliminary configurations, described in the linked document.

Adjust Registration Form Texts

Before enabling service at production, it’s highly recommended to adjust the activation form’s texts in order to make users aware, that they will receive a call rather than SMS notification (as it is said in the default form template).

To substitute the old texts, you need to update the corresponding lang-{x}.js localization file(s) and upload them via FTP to the public_html/activation/locale folder of your platform resources’ application at res.{platform_domain} (contact Jelastic team if the detailed instruction on this is required).

We suggest the strings below to be changed in the following way:

Placeholder ID

Default text (for SMS)

Recommended text (for mobile call)

titleSMSVerification

Please enter your phone number to receive a code via SMS and complete your account activation

Please enter your phone number to receive a call with a code, being dictated by a robot, and complete your account activation

textNoSMS

No SMS? Edit the phone number if it's incorrect, or contact support if you need further assistance.

No call? Edit the phone number if it's incorrect, or contact support if you need further assistance.

sendSMSButtonText

SEND

GET A CALL

resendSMSText

Send SMS again.

Get a call again.

errorSMSAlreadySent

An activation code was already sent to this number. Please use a different one or contact support for assistance.

An activation code was already uttered for this number. Please use a different number or contact support for assistance.

errorSendSMS

Some error has occurred - an activation code has not been sent.  In order to complete the activation, please contact support.

Some error has occurred - the call has not been made. In order to complete the activation, please contact support.

errorSendSMSCountryRestricted

Sending SMS messages to the recipient country is not allowed.

The phone call to the recipient country is not allowed.

errorSendSMSInvalidPhoneNumber

An activation code has not been sent. Please re-check the specified phone number and try again.

The call has not been made. Please re-check the specified phone number and try again.

Note that once all the necessary localization files are uploaded, you need to apply them to be used at your platform’s registration form through following the next link in your browser:

http://reg.{platform_domain}/activation/rebuild

Configure Mobile Call Verification

By default, Jelastic is configured to work with the Twilio SMS sending tool. Thus, if using any other code sending service (by means of SMS or voice, like in our case), you’ll need to change the corresponding control script.

1. Enter the 104 container of your hardware node via SSH and substitute the existing sendsms script’s content, located at /home/hivext/scripts, with the one presented below:

#!/bin/bash

#OnVerify integration

#=======================================
# !!!! CHANGE THESE PARAMETERS !!!!

USER_ID="{user_id}"
TEMPLATE_ID="{template_id}"
API_PASS="{api_pass}"

#=======================================

function usage
{
   if [ -n "$1" ]; then echo $1; fi
       echo "Usage: sendsms -n number -c code -l language"
       exit 1
}

while getopts "n:c:l:" opt; do
   case "$opt" in
       n) PNUMBER=$OPTARG ;;
       c) MSG=$OPTARG ;;
       l) L=${OPTARG^^} ;;
       *) echo "Unknown param: $opt"; usage ;;
   esac
done

#Limit message to 160 characters
MSG=${MSG:0:160}

RESPONSE=$(curl -s "http://www.onverify.com/call.php?userid=$USER_ID&apipass=$API_PASS&pin=$MSG&template_id=$TEMPLATE_ID&number=$PNUMBER")
RESULT=$?
if [ $RESULT -gt 1 ]; then
   echo "{\"result\": \"$RESULT\", \"message\": \"Failed to send Voice Message to $PHONE: $RESPONSE\"}"
else
   echo "{\"result\": \"0\", \"message\": \"queued\"}"
fi

2. Then, to make the script to work properly, you need to adjust the highlighted lines (within the CHANGE THESE PARAMETERS section) with your OnVerify account data, namely:
  • {user_id} - UID of your account
  • {api_pass} - API password, used for authentication

    Both of the abovementioned values can be found within the My Account > Details menu section

  • {template_id} - identifier of the template, that should be played to your customers

    In order to create it, switch to the Templates section at the top and click on the Add New Template string. In the opened frame, type the name of your sample and specify the message for being spoken by a robot line by line, with the Say action stated for each of them, e.g.:

    The required template ID will be shown at the top of the frame. After you save the new message, it will be permanently listed within the Templates section of your account, being available for editing.

3. Subsequently, you can review the Reports (within the same-named section at the top panel) with details on all of the mobile phone numbers that have tried to register at a platform, date and result of confirmation call (i.e. whether it was performed successfully), and your OnVerify account charge for each such action:

That’s all of the operations required! For now, the service is integrated and once the mobile number verification is activated, it will start working for protecting your platform from account spammers.