Skip to main content

Apply Options and Features to Numbers

In this guide, we will show you how to apply options and features to your telephone numbers.

Single TN Option Assignment

There are a set of options that can be assigned to a telephone number on a per-number basis.

To update these options, make a PUT request to our Update SipPeer TNs settings API endpoint.

Set of Options:

Use one of the examples to update the Call Forwarding option for a telephone number

Examples:

Request URL:

PUThttps://dashboard.bandwidth.com/api/accounts/{accountId}/sites/{siteId}/sippeers/{sippeerId}/tns/{tn}
<SipPeerTelephoneNumber>
<FullNumber>2052160156</FullNumber>
<CallForward>7042661720</CallForward>
</SipPeerTelephoneNumber>

Response

<SipPeerTelephoneNumberResponse>
<SipPeerTelephoneNumber>
<FullNumber>2052160156</FullNumber>
<CallForward>7042661720</CallForward>
</SipPeerTelephoneNumber>
</SipPeerTelephoneNumberResponse>

Using Other Order Types to Apply Number Features

Several order types described below are appropriate for use cases like applying caller ID information, directory listings, or other number features.

The TnOptions order type is used to apply number options described in the Create TN Options Order section of the API documentation.

To create a TN Options Order, make a POST request to our Create TN Option Order API endpoint. This can be done through tools like Postman or cURL.

Examples:

Request URL:

POSThttps://dashboard.bandwidth.com/api/accounts/{accountId}/tnOptions
<TnOptionOrder>
<CustomerOrderId>TnOptionOrder1</CustomerOrderId>
<TnOptionGroups>
<TnOptionGroup>
<CallForward>6042661720</CallForward>
<PortOutPasscode>a1b2c3</PortOutPasscode>
<TelephoneNumbers>
<TelephoneNumber>2018551020</TelephoneNumber>
</TelephoneNumbers>
</TnOptionGroup>
<TnOptionGroup>
<CallingNameDisplay>on</CallingNameDisplay>
<Sms>on</Sms>
<TelephoneNumbers>
<TelephoneNumber>9195551234</TelephoneNumber>
</TelephoneNumbers>
</TnOptionGroup>
</TnOptionGroups>
</TnOptionOrder>

Response

<TnOptionOrderResponse>
<TnOptionOrder>
<OrderCreateDate>2016-01-15T12:01:14.324Z</OrderCreateDate>
<AccountId>14</AccountId>
<CreatedByUser>jbm</CreatedByUser>
<OrderId>ddbdc72e-dc27-490c-904e-d0c11291b095</OrderId>
<LastModifiedDate>2016-01-15T12:01:14.324Z</LastModifiedDate>
<ProcessingStatus>RECEIVED</ProcessingStatus>
<CustomerOrderId>TnOptionOrder1</CustomerOrderId>
<TnOptionGroups>
<TnOptionGroup>
<CallForward>6042661720</CallForward>
<PortOutPasscode>a1b2c3</PortOutPasscode>
<TelephoneNumbers>
<TelephoneNumber>2018551020</TelephoneNumber>
</TelephoneNumbers>
</TnOptionGroup>
<TnOptionGroup>
<CallingNameDisplay>on</CallingNameDisplay>
<Sms>on</Sms>
<TelephoneNumbers>
<TelephoneNumber>9195551234</TelephoneNumber>
</TelephoneNumbers>
</TnOptionGroup>
</TnOptionGroups>
<ErrorList/>
</TnOptionOrder>
</TnOptionOrderResponse>

Fetch Order Status

Bandwidth recommends configuring your account with a subscription instead of polling the order resource for OrderStatus. Order processing times can vary and are not guaranteed, so bandwidth does not recommend setting a timeout on waiting for an order to show either COMPLETE or FAILED status, but instead relying on a webhook from an orders subscription.

Please follow the How to setup Notification Webhook guide for more information.

Since the TnOptions order is asynchronous, it is recommended to create a tnoptions subscription to receive order status webhooks. Otherwise, you can make GET request to Fetch TN Option Order status API endpoint to poll the order status.

Where to next?

Now that you have learned how to apply options and features to your numbers, check out some of the other available actions in the following guides: