Telephony API

Call forwarding API

The Call Forwarding API allows you to configure a destination for incoming calls to your Sonetel phone numbers.

This option is available regardless if your phone numbers are purchased via the API or via the Sonetel customer portal.

Via the Sonetel API you can configure the call forwarding of your phone number.

 

Optional call forwarding destinations

The API allows you to change so that incoming calls are forwarded to either of these types of destinations.

  • Phone numbers
    Forward incoming calls to any mobile number or landline worldwide. Call forwarding costs like a local call.
  • IVR
    Calls can be forwarded to IVR-menus, voicemail services or announcements that you either create via the API or via the customer portal.
  • SIP-addresses
    Incoming calls can be forwarded across the Internet to any SIP address of choice.
  • Team members
    You can add team members in your Sonetel account. Each of them can have their own call forwarding settings, which will apply if you connect the number to them.

 

Changing call forwarding with NodeJS

Sample code for changing call forwarding of a phone number with NodeJS can be found here.

The function accepts three arguments:

  1. accessToken: This is the Oauth access token generated using the /oauth/token endpoint.
  2. e164Number: This is the phone number for which the call forwarding has to be changed. This must be a phone number you have subscribed to.
  3. settings: The settings object contains the details of where the calls must be forwarded. It must have two properties: connect_to, which specifies the phone number, SIP address or ID of the voice app where the incoming calls should be forwarded, and connect_to_type, which specifies the type of the entity specified in connect_to.

The function first checks that the accessToken and e164Number arguments are passed as strings, and that the settings argument is an object with the required properties. It then parses the accessToken to get the account ID of the user. It then sets up an HTTP request to the Sonetel API, using the specified hostname (defaulting to “public-api.sonetel.com” if not provided), the account ID and the phone number, and the PUT method to update the call forwarding settings. Finally, it sends the request and handles the response.

 

 

See the full API-documentation here.