Skip to content

DID Management

Current DID Assignments

DID Organization Destination Notes
+918065978000 Acme Corp queue:support Test
+918065978001 AstraPrivate ext 1001 (Hari Surya) Production
+918065978002 TechStart queue:tech_support Test
+918065978003 AstraPrivate ext 0986 (Manivel) Production
+918065978004 to +918065978029 -- -- Unassigned

DID Range

Astradial has DIDs from +918065978000 through +918065978029 on the Tata SIP trunk. Only the first four are currently assigned.

Adding a New DID

Follow these steps in order to assign a new DID to an organization.

Step 1: Add to Database via API

curl -X POST https://devpbx.astradial.com/api/v1/dids \
  -H "Content-Type: application/json" \
  -d '{
    "number": "+918065978005",
    "organization_id": "<org-uuid>",
    "destination_type": "extension",
    "destination": "1002",
    "description": "New extension for user"
  }'

Step 2: Add Route in ext_tata_gateway.conf

Add the DID-to-context mapping in the [tata-did-route] context:

exten => +918065978005,1,Goto(<org_prefix>_inbound,1002,1)

Step 3: Regenerate Organization Config

curl -X POST https://devpbx.astradial.com/api/v1/organizations/<org-uuid>/regenerate

Step 4: Reload Dialplan

asterisk -rx "dialplan reload"

Step 5: Verify

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

Confirm the new DID appears in the output with the correct Goto target.

Alternative: Adding DID via SQL

If the API is unavailable, you can insert directly into MariaDB:

USE pbx_api_db;

INSERT INTO dids (number, organization_id, destination_type, destination, description)
VALUES ('+918065978005', '<org-uuid>', 'extension', '1002', 'New extension for user');

SQL Direct Insert

When inserting via SQL, you must still manually add the route in ext_tata_gateway.conf and reload the dialplan. The API method is preferred because it handles config generation automatically.

Verification

To verify DID routing is correctly loaded:

# Show all routes in the tata-did-route context
asterisk -rx "dialplan show tata-did-route"

# Test a specific DID
asterisk -rx "dialplan show +918065978005@tata-did-route"

Expected output should show the Goto to the correct organization inbound context and extension.