call()

Verify.call(phone_number, verify_code=None, use_case_code=None, verify_method='', language='en', extension_type='', redial='', originating_ip=None, pressx=None, extra=None, timeout=None)

Calls the specified phone number, and using speech synthesis, speaks the verification code to the user.

Parameters  
phone_number The phone number to receive the text message. You must specify the phone number in its entirety. That is, it must begin with the country code, followed by the area code, and then by the local number. For example, you would specify the phone number (310) 555-1212 as 13105551212.
verify_code (optional) The verification code to send to the user. If omitted, TeleSign will automatically generate a random value for you.
language (optional) The written language used in the message. The default is English.
verify_method (optional)
extension_type (optional)
redial (optional)
use_case_code (optional, recommended) A four letter code (use case code) used to specify a particular usage scenario for the web service.
originating_ip (optional) An IP (v4 or v6) address, possibly detected by the customer’s website, that is considered related to the user verification request
timeout (optional) Timeout for the request (see timeout in the requests documentation). Will override any timeout set in the initialization. Note that this is not a timeout for the actual phone call, just for the http request.
extra (optional) Key value mapping of additional parameters.

Use-case Codes

The following table list the available use-case codes, and includes a description of each.

Code Description
BACS Prevent bulk account creation + spam.
BACF Prevent bulk account creation + fraud.
CHBK Prevent chargebacks.
ATCK Prevent account takeover/compromise.
LEAD Prevent false lead entry.
RESV Prevent fake/missed reservations.
PWRT Password reset.
THEF Prevent identity theft.
TELF Prevent telecom fraud.
RXPF Prevent prescription fraud.
OTHR Other.
UNKN Unknown/prefer not to say.

Example:

from telesign.api import Verify
from telesign.exceptions import AuthorizationError, TelesignError

cust_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
secret_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="

verify = Verify(cust_id, secret_key) # Instantiate a Verify object.

phone_number = "13107409700"

try:
    phone_info = verify.call(phone_number, use_case_code="ATCK")
except AuthorizationError as ex:
    # API authorization failed, the API response should tell you the reason
    ...
except TelesignError as ex:
    # failed to execute the Verify service, check the API response for details
    ...

# When the user inputs the validation code, you can verify that it matches the one that you sent.
if (phone_info != None):
    try:
        status_info = verify.status(phone_info.data["reference_id"], verify_code=phone_info.verify_code)
    except AuthorizationError as ex:
        ...
    except TelesignError as ex:
        ...