Dial
The Dial endpoint originates a call between a source extension and a destination number. It is the OpenAPI equivalent of proxyapi.php?reqtype=DIAL and uses the same PBX dialplan contexts.
The endpoint requires a tenant context and a full API key. Read-only API keys cannot originate calls.
Endpoint
POST https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI
| Parameter | Required | Description |
|---|---|---|
tenant | Yes | Tenant code or tenant name. |
key | No, if using headers | Full API key. The key can also be sent with X-API-Key or Authorization: Bearer. |
Request Body
| Field | Required | Description |
|---|---|---|
source | Yes | Source extension. Compatibility aliases are exten and ?exten. |
dest | Yes | Destination number. Compatibility alias is phone. |
dialtimeout | No | Originate timeout in seconds. Defaults to 30. |
timeout | No | Sets the dialplan variable SETTIMEOUT. |
sourceclid | No | Sets SETSOURCECLID. |
destclid | No | Sets SETDESTCLID. |
logqueueoutbound | No | Sets SETLOGQUEUEOUTBOUND. |
recording | No | Sets SETRECORDING. |
autoanswer | No | Sets AUTOANSWER. |
nofollow | No | Sets SETNOFOLLOWEXTENSION. |
account | No | Peer account name to set as SETPEERNAME. Use SOURCE to resolve it from the source extension. |
server | No | PBX node peer name to use when the source or destination registration server cannot be found. |
var | No | Comma-separated custom variables, for example campaign=summer,lead=42. |
vars | No | Custom variables as a JSON object. Variables are tenant-prefixed and listed in VARLIST. |
Example
curl -X POST "https://pbx.example.com/pbx/openapi.php/dial?tenant=CANISTRACCI" \
-H "X-API-Key: TENANT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "100",
"dest": "39055123456",
"dialtimeout": 30,
"sourceclid": "100",
"recording": "yes",
"vars": {
"campaign": "summer",
"lead": "42"
}
}'
Response
The response includes the Asterisk manager originate result, the generated originate ID, and the selected PBX node.
{
"Response": "Success",
"Message": "Originate successfully queued",
"ID": "6867c1c5.12345678",
"source": "100",
"dest": "39055123456",
"server": "pbx-node-1",
"node": "PBX Node 1"
}
Extension Dial API Key
Besides a tenant or global full API key, POST /dial accepts a Dial API Key configured on a SIP/PJSIP, Custom or Virtual extension. Enter a strong unique value in the extension's Dial API Key field and save the extension. The tenant and extension are inferred from the key, so tenant can be omitted. The key can originate calls and read the caller ID choices of its own tenant with GET /outbounddids; it cannot access any other object. Read-only API keys cannot originate calls.
One call leg is always the extension associated with the key, and the tenant and peer account are derived from that extension. A Dial API Key therefore cannot connect two unrelated numbers or select another extension's account. Use a different key on each extension: authentication is rejected as ambiguous if several extensions match the key.
| Field | Description |
|---|---|
external | External number to call. Aliases: dest, phone, destination and number. |
dialfirst | extension (default) dials the key's extension first and then the external number; external dials the external number first. Aliases: dial_order and order. |
Existing integrations can still send both source and dest; their order is honored when exactly one of them is the key's extension.
curl -X POST \
-H "X-API-Key: EXTENSION_DIAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"external":"15551234567","dialfirst":"extension"}' \
"https://pbx.example.com/pbx/openapi.php/dial"
Outbound Caller IDs
GET /outbounddids lists the caller IDs a click-to-call client can offer. Full and read-only keys must supply one exact tenant code or name; a global key receives 409 ambiguous_tenant when the value matches several tenants. An extension Dial API Key uses its own tenant when tenant is omitted.
curl -H "X-API-Key: TENANT_READONLY_API_KEY" \
"https://pbx.example.com/pbx/openapi.php/outbounddids?tenant=CANISTRACCI"
[
{"number":"+12025550123","description":"Reception","can_receive_sms":true},
{"number":"0012345","description":"Sales","can_receive_sms":false}
]
Tenant DIDs follow the GUI caller ID format settings; verified outbound DIDs appear as entered. Each distinct number is returned once, including leading zeros or plus sign. A tenant without choices returns an empty array.
can_receive_sms is true when a DID of the tenant with inbound SMS configured matches the number, using the PBX prefixes. Spaces and hyphens are significant. The outbound DID option Allow SMS permits the number as an SMS sender and does not establish inbound capability.
Compatibility Notes
source=ACCOUNTresolves the source extension number from theaccountpeer name.account=SOURCEresolves the peer name from the source extension and setsSETPEERNAME.- If a source or destination registration server is found, that node is used. If no registration server is found, pass
serverwith the node peer name. - The endpoint returns JSON only.
No comments to display
No comments to display