Skip to content

Add a New DID

This guide walks through provisioning a new DID (Direct Inward Dialing) number on the Astradial platform, from database entry to verified call routing.

Prerequisites

Before starting, gather the following:

Item Example Where to find it
Organization ID org_mna9x47k AstraPBX admin panel or database
DID number (E.164) +914471234567 Tata Communications allocation
Routing destination Extension, ring group, or IVR ID Organization's PBX config

Tata DID activation

The DID must already be activated on the Tata SBC side. If the number is newly assigned by Tata, confirm with their NOC that routing to NNI IP 10.54.225.90 is live before proceeding.


Step 1: Add DID to database via API

curl -X POST https://devsip.astradial.com/api/v1/dids \
  -H "Authorization: Bearer $ASTRAPBX_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "+914471234567",
    "organizationId": "org_mna9x47k",
    "routeTo": "1001",
    "routeType": "extension",
    "description": "Chennai office main line"
  }'

Expected response:

{
  "id": "did_abc123",
  "number": "+914471234567",
  "organizationId": "org_mna9x47k",
  "status": "active"
}
SQL alternative for Step 1

If the API is unavailable, insert directly into the database on the cloud server:

INSERT INTO did_numbers (number, organization_id, route_to, route_type, description, created_at)
VALUES (
  '+914471234567',
  'org_mna9x47k',
  '1001',
  'extension',
  'Chennai office main line',
  NOW()
);

Connect to the database from the cloud server:

psql -U astrapbx -d astrapbx_db

Step 2: Add route in Asterisk dialplan

Edit the NUC gateway dialplan to route the DID to the correct organization context.

sudo nano /etc/asterisk/ext_tata_gateway.conf

Under the [tata-did-route] section, add a new entry:

[tata-did-route]
; ... existing routes ...

; Chennai office main line
exten => +914471234567,1,NoOp(Incoming call to Chennai office)
 same => n,Set(ORGANIZATION=org_mna9x47k)
 same => n,Goto(org_mna9x47k-inbound,${EXTEN},1)

Tip

Keep routes in the [tata-did-route] section sorted by organization for readability. Add a comment with the organization name above each block.


Step 3: Regenerate organization config

Trigger a config regeneration so the cloud Asterisk picks up the new DID mapping:

curl -X POST https://devsip.astradial.com/api/v1/organizations/org_mna9x47k/regenerate \
  -H "Authorization: Bearer $ASTRAPBX_TOKEN"

Expected response:

{
  "status": "ok",
  "message": "Configuration regenerated for org_mna9x47k"
}

Step 4: Reload Asterisk dialplan

On the NUC, reload the dialplan so the new route takes effect without dropping active calls:

asterisk -rx 'dialplan reload'

If the org config was regenerated on the cloud, reload there as well:

asterisk -rx 'dialplan reload'

Info

dialplan reload is non-disruptive. Active calls are not affected.


Step 5: Verify the route is loaded

asterisk -rx 'dialplan show tata-did-route'

Confirm the new DID appears in the output:

[ Context 'tata-did-route' created by 'pbx_config' ]
  '+914471234567' =>     1. NoOp(Incoming call to Chennai office)    [extensions.conf:42]
                         2. Set(ORGANIZATION=org_mna9x47k)          [extensions.conf:43]
                         3. Goto(org_mna9x47k-inbound,${EXTEN},1)   [extensions.conf:44]

Step 6: Test call

  1. Call the DID number from a mobile phone or external line.
  2. Watch the Asterisk CLI on the NUC for the incoming INVITE:
    asterisk -rvvvv
    
  3. Confirm the call routes through [tata-did-route] to the correct organization context.
  4. Verify the call reaches the intended extension or ring group.

Call not arriving?

  • Check that Tata has activated the DID and is routing to 10.54.225.90.
  • Verify the NUC NNI interface (enp86s0) is up: ip addr show enp86s0.
  • Check SIP traffic: sngrep -d enp86s0.
  • Review /var/log/asterisk/full for errors.