Skip to content

Calls

Make phone calls using Sonetel's CallBack API.

Call

Use Sonetel's CallBack API to make business quality international calls at the cost of 2 local calls.

See the API documentation for more information.

Examples:

>>> call = Call(access_token='your_access_token')
>>> call.callback(num1='+12125551234', num2='+44123456789')
{'statusCode': 202, "response": {"session_id": "1234567890"}}

Parameters:

Name Type Description Default
access_token (str, required)

The access token generated from the Auth class.

required
app_name str

The name of the app that is making the request. Defaults to 'PythonSonetelPackage'. This is used to identify the app in logs.

'PythonSonetelPackage'

Returns:

Name Type Description
dict JSON

Return the status code and message as a dict.

callback(num1, num2, cli1='automatic', cli2='automatic')

Number Format

It is recommended that both the phone numbers (num1 and num2) be entered in the international E164 format with a leading +. For example, if you want to call a US number (212) 555-1234, it should be set as +12125551234.

However you can also provide SIP addresses. Additionally, num1 can be your Sonetel username - this will make sure that the incoming call to you is handled as per your incoming settings defined in the app.

Caller ID

It is best to use 'automatic' CLI as our system selects the best possible phone to be shown from the numbers available in your account. If you don't have a Sonetel number, then your verified mobile number is used as CLI. Read more at https://sonetel.com/cli

Parameters:

Name Type Description Default
num1 str

The first phone number that will be called. This should be your phone number, SIP address or Sonetel email address.

required
num2 str

The phone number or address that you wish to connect to.

required
cli1 str

Optional. The caller ID shown to the first person. Defaults to automatic.

'automatic'
cli2 str

Optional. The caller ID shown to the second person. Defaults to automatic.

'automatic'

Returns:

Name Type Description
response dict

Return the JSON response from the API as a dict.