NAV
cURL

Carrier Documentation

This documentation is intended for carriers. The documentation for Somleng's Open Source implementation of Twilio's REST API is available here.

Configuring Outbound SIP Trunks

To setup outbound dialing you create an Outbound SIP trunk(s) via the Carrier Dashboard. When configuring an Outbound SIP trunk, you specify your host as either a fully qualified domain name (FQDN) or IP Address. This tells Somleng to send outbound calls to your this host using the configured dial string. Somleng will send SIP and RTP from NATed from the IP address below:

NAT IP
13.250.230.15

You should allow this IP address on your firewall.

Configuring Inbound SIP Trunks

To setup inbound dialing you create an Inbound SIP Trunk via the Carrier Dashboard. When configuring an Inbound SIP trunk, you specify your source IP address from which you will send SIP from. You can then send SIP to the following endpoints. We recommend that you use sip.somleng.org if possible for high-availability.

Endpoint
sip.somleng.org
52.74.4.205
18.136.239.28
3.0.30.251

RTP

RTP from Somleng is sent through a NAT Gateway. This means that the ports specified in the SDP in the SIP Invite from Somleng are unreachable. In order to work-around this problem, it is required that you setup Symmetric Latching on your device/software.

Symmetric RTP means that the IP address and port pair used by an outbound RTP flow is reused for the inbound flow. The IP address and port are learned when the initial RTP flow is received your device. The flow's source address and port are latched onto and used as the destination for the RTP sourced by the other side of the call. The IP address and port in the c line and m line respectively in the SDP message are ignored.

Carrier API

The Carrier API is intended for carriers who need to automate provisioning of carrier resources (e.g. Accounts) rather that using the dashboard. This API is written according to the JSON API Specification. We recommend using a JSON API Client for consuming this API.

Authentication

This API uses Bearer authentication. You must include your API key in the Authorization header for all requests. Your API key is available on the Carrier Dashboard.

Accounts

Create an account

Request

curl "https://api.somleng.org/carrier/v1/accounts" -d '{
  "data": {
    "type": "account",
    "attributes": {
      "name": "Rocket Rides",
      "metadata": {
        "foo": "bar"
      }
    }
  }
}' -X POST \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer SIKsLRqKRSjwjRv43HBeAbGHvjQxaI5Nx9f-iHMaA3Y"

Endpoint

POST https://api.somleng.org/carrier/v1/accounts

POST https://api.somleng.org/carrier/v1/accounts

Parameters

{
  "data": {
    "type": "account",
    "attributes": {
      "name": "Rocket Rides",
      "metadata": {
        "foo": "bar"
      }
    }
  }
}
Name Description
data[attributes][name] required A friendly name which identifies the account
data[attributes][metadata] Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

Response


201 Created
{
  "data": {
    "id": "2fc1eff9-1743-494b-9f03-e7c53730d42b",
    "type": "account",
    "attributes": {
      "created_at": "2021-09-17T01:34:43Z",
      "updated_at": "2021-09-17T01:34:43Z",
      "name": "Rocket Rides",
      "metadata": {
        "foo": "bar"
      },
      "status": "enabled",
      "type": "carrier_managed",
      "auth_token": "P0aR3c1Whb6ocWWNFivGdLiPBJhqFYyy4zAQVkBOQ8o"
    }
  }
}

List all accounts

Request

curl -g "https://api.somleng.org/carrier/v1/accounts" -X GET \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer 5g72eOtd0PEO3cU9QnJm3SijGWoYTAYZ5BaWrCcdWek"

Endpoint

GET https://api.somleng.org/carrier/v1/accounts

GET https://api.somleng.org/carrier/v1/accounts

Parameters

None known.

Response


200 OK
{
  "data": [
    {
      "id": "3193afdf-1440-493e-95aa-7148aea7819f",
      "type": "account",
      "attributes": {
        "created_at": "2021-09-17T01:34:43Z",
        "updated_at": "2021-09-17T01:34:43Z",
        "name": "Telco Net",
        "metadata": {
        },
        "status": "enabled",
        "type": "carrier_managed",
        "auth_token": "o8cZ1cqPqMgdZi66X5gqPIcaLby5_pFWhMjSelQKw4o"
      }
    },
    {
      "id": "b59ae851-0cf0-4a0e-b09e-ab7abd692a4e",
      "type": "account",
      "attributes": {
        "created_at": "2021-09-17T01:34:43Z",
        "updated_at": "2021-09-17T01:34:43Z",
        "name": "Rocket Rides",
        "metadata": {
        },
        "status": "enabled",
        "type": "customer_managed"
      }
    }
  ],
  "links": {
    "prev": "https://api.somleng.org/carrier/v1/accounts?page%5Bbefore%5D=3193afdf-1440-493e-95aa-7148aea7819f",
    "next": null
  }
}

Retrieve an account

Request

curl -g "https://api.somleng.org/carrier/v1/accounts/84276fbb-10de-416d-b705-b795f8325150" -X GET \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer g_o_JMIRvNiaJePwYFyhzQRwsODUdlaGSxH1RwALOiw"

Endpoint

GET https://api.somleng.org/carrier/v1/accounts/:id

GET https://api.somleng.org/carrier/v1/accounts/84276fbb-10de-416d-b705-b795f8325150

Parameters

Name Description
id required The id of the account to be retrieved.

Response


200 OK
{
  "data": {
    "id": "84276fbb-10de-416d-b705-b795f8325150",
    "type": "account",
    "attributes": {
      "created_at": "2021-09-17T01:34:43Z",
      "updated_at": "2021-09-17T01:34:43Z",
      "name": "Rocket Rides",
      "metadata": {
      },
      "status": "enabled",
      "type": "carrier_managed",
      "auth_token": "XdjZQ3p_hbGP7ahaRuqhytVzVg7Fs99ilDY6fbnBBjM"
    }
  }
}

Update an account

Request

curl "https://api.somleng.org/carrier/v1/accounts/432e47ef-7cd1-4251-87f2-98ee38e3c239" -d '{
  "data": {
    "attributes": {
      "status": null,
      "name": "Bob Cats",
      "status": "disabled",
      "metadata": {
        "bar": "foo"
      }
    },
    "type": "account",
    "id": "432e47ef-7cd1-4251-87f2-98ee38e3c239"
  }
}' -X PATCH \
    -H "Content-Type: application/vnd.api+json" \
    -H "Authorization: Bearer V0HFZuxiJPpPj-7ZtVkRWmJQl2vEXvn0otcC3Kpyw_o"

Endpoint

PATCH https://api.somleng.org/carrier/v1/accounts/:id

PATCH https://api.somleng.org/carrier/v1/accounts/432e47ef-7cd1-4251-87f2-98ee38e3c239

Parameters

{
  "data": {
    "attributes": {
      "status": null,
      "name": "Bob Cats",
      "status": "disabled",
      "metadata": {
        "bar": "foo"
      }
    },
    "type": "account",
    "id": "432e47ef-7cd1-4251-87f2-98ee38e3c239"
  }
}
Name Description
data[attributes][status] Update the status of the account. One of either enabled or disabled.

Response


200 OK
{
  "data": {
    "id": "432e47ef-7cd1-4251-87f2-98ee38e3c239",
    "type": "account",
    "attributes": {
      "created_at": "2021-09-17T01:34:43Z",
      "updated_at": "2021-09-17T01:34:43Z",
      "name": "Bob Cats",
      "metadata": {
        "foo": "bar",
        "bar": "foo"
      },
      "status": "disabled",
      "type": "carrier_managed",
      "auth_token": "0Bk5qprIM3xf3rQB0yXIM4aq5ZZdLHF13JLAlocdqiU"
    }
  }
}