shell

Application Endpoint

In this guide, you will learn how to configure an application endpoint. Application endpoints enable you to build customizable voice and SMS applications using the CarrierX API. Application endpoints can be configured through the Portal or programmatically. Refer to the following resources to learn more about each endpoint type:

Endpoints must be configured with a trunk group. A trunk group determines where a call should be routed. Trunks route calls to the appropriate endpoint by identifying the phone number dialed and matching it to the trunk group that the phone number is assigned to. Refer to the Configure a Trunk Group Quick Start Guide for more information. Trunk groups can be provisioned at the same time as an endpoint is created, as will be shown in the first portion of this guide.

I. Create Using Portal

In this section, we will create an application endpoint through the Portal. We will use the Conference endpoint as an example for the following steps. Note that this can also be done programmatically, as is covered in a later section of this guide.

To set up an application endpoint, log into your CarrierX account. On the left-side menu, locate and click on the Configure menu. Click Endpoints.

Select Endpoints

Click Add New Endpoint.

Click Add

Enter a name for the new endpoint. This is a friendly name that is used for internal reference.

Name Endpoint

Check Provision Trunk Group to create a trunk group alongside the endpoint. A trunk group determines where a call should be routed. Trunks route calls to the appropriate endpoint by identifying the phone number dialed and matching it to the trunk group that the phone number is assigned to.

This guide includes instructions on assigning a DID to a trunk group. For more information about trunk groups and how to manage them programmatically, please refer to the Core API Reference Guide.

Provision Group

Select the type of endpoint that you would like to create. In this example, we will configure a Conference endpoint. Choose Conference from the Select Endpoint Type dropdown menu.

Choose Endpoint

Click Create Endpoint.

Click Create

Now we have finished configuring a new application endpoint with a trunk group. You will need to assign a phone number to this endpoint. Refer to the Rent a Phone Number Quick Start Guide for instructions on renting a phone number. Instructions on assigning a phone number to a specific endpoint are included in the specific endpoint quick start guides.

To work with the endpoint programmatically from here, you will need to use the endpoint-specific credentials. Click on your endpoint and scroll down to see endpoint details.

Credentials

In the following two sections, we will go over configuring an application endpoint and trunk group programmatically.

II. Create Using REST API

In this section, we will configure an application endpoint programmatically. After you finish this step, you will also need to configure a trunk group, as shown in the section below.

Form a POST request and include at least the endpoint type in the request body. Refer to the Create Endpoint section of the Core API Reference Guide for a list of the other fields that can be added at the time of creation. Note that once the endpoint is created, only the name and capacity values can be edited.

curl -X POST \
'https://api.carrierx.com/core/v2/endpoints' \
-H 'Content-Type: application/json' \
--data-binary '{"type":"conference"}' \
-u '[your_user_name]:[your_password]'


A successful request will return a 200 status code along with a response that looks like the following:

{
    "endpoint_sid":"c8937ba8-13ee-46b7-8f26-532d2f0f3aa8",
    "partner_sid":"77354609-bd20-4ed0-a523-8c00792f15b8",
    "name":"N/A",
    "type":"conference",
    "voip_token":null,
    "capacity":0,
    "addresses":[],
    "attributes":{},
    "properties":{
      "container_sid":"null",
      "password":"po43nkKL3AAN",
      "api_url":"https://api.carrierx.com/conference/v1",
      "account_sid":"cxDD96hWE-bGt6TvLaauid80UQs01Djz",
      "login":"sample_login"
    },
    "transformations":[]
}


Take note of the field values login and password because you will use these to work with this specific endpoint. Note that each endpoint will have a distinct set of credentials. Using the Core API credentials instead of the specific endpoint credentials will result in an authentication error.

Now we will create a trunk group and then assign it to our endpoint.

Form a POST request and pass the endpoint_sid from the endpoint we created in the request body. Add the path argument with_trunks with the value true. This creates a trunk under the trunk group.

curl -X POST \
'https://api.carrierx.com/core/v2/trunk_groups?with_trunks=true' \
-d '{"trunks": [{"endpoint_sid": "c8937ba8-13ee-46b7-8f26-532d2f0f3aa8"}]}'
-u '[your_user_name]:[your_password]'


A successful request will return a 200 status code along with a response that looks like the following:

{
    "acls": [],
    "name": "N/A",
    "partner_sid": "77354609-bd20-4ed0-a523-8c00792f15b8",
    "routing_data": null,
    "routing_type": "failover",
    "soft_failure_codes": "408;",
    "soft_failure_cooldown": 120,
    "transformations": [],
    "trunk_group_sid": "4f8eb696-cb98-41d4-a44d-83ec98cc86b2",
    "trunks": [
        {
            "allow_forward": "disable",
            "call_type": "regular",
            "codec": null,
            "endpoint_sid": "c8937ba8-13ee-46b7-8f26-532d2f0f3aa8",
            "in_capacity": 0,
            "name": "N/A",
            "out_capacity": 0,
            "relay_sip_headers": [],
            "transformations": [],
            "trunk_sid": "e2209306-6818-4f4d-af39-c061850e325b"
        }
    ]
}

III. Next Steps

You configured an Application Endpoint! Refer to the Endpoints and Phone Numbers sections of the Core API Reference Guide for more information.

If you need to review some of the steps to create an Application Endpoint, see our Configure a SIP Trunk video.