Skip to main content

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
ParameterRequiredDescription
tenantYesTenant code or tenant name.
keyNo, if using headersFull API key. The key can also be sent with X-API-Key or Authorization: Bearer.

Request Body

FieldRequiredDescription
sourceYesSource extension. Compatibility aliases are exten and ?exten.
destYesDestination number. Compatibility alias is phone.
dialtimeoutNoOriginate timeout in seconds. Defaults to 30.
timeoutNoSets the dialplan variable SETTIMEOUT.
sourceclidNoSets SETSOURCECLID.
destclidNoSets SETDESTCLID.
logqueueoutboundNoSets SETLOGQUEUEOUTBOUND.
recordingNoSets SETRECORDING.
autoanswerNoSets AUTOANSWER.
nofollowNoSets SETNOFOLLOWEXTENSION.
accountNoPeer account name to set as SETPEERNAME. Use SOURCE to resolve it from the source extension.
serverNoPBX node peer name to use when the source or destination registration server cannot be found.
varNoComma-separated custom variables, for example campaign=summer,lead=42.
varsNoCustom 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"
}

Compatibility Notes

  • source=ACCOUNT resolves the source extension number from the account peer name.
  • account=SOURCE resolves the peer name from the source extension and sets SETPEERNAME.
  • If a source or destination registration server is found, that node is used. If no registration server is found, pass server with the node peer name.
  • The endpoint returns JSON only.