Skip to main content

Provider

The Provider object is supported by the MiRTA PBX OpenAPI endpoint. This object is managed at system scope and requires a global API key.

Object Summary

PropertyValue
Objectprovider
Primary path/providers
ID fieldpr_id
Label fieldpr_name
Primary source tablepr_providers
Required on createpr_name
Path aliases/provider, /providers

Endpoint Patterns

ActionExample pattern
ListGET https://pbx.example.com/pbx/openapi.php/providers
Get by IDGET https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID
CreatePOST https://pbx.example.com/pbx/openapi.php/providers
UpdatePATCH https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID
DeleteDELETE https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID

Accepted Field Aliases

Request fieldSource field
namepr_name
peernamepr_peername
peer_namepr_peername
techpr_tech
hostpr_host
disabledpr_disabled
penaltypr_penalty
realtimepr_userealtime
use_realtimepr_userealtime
calleridmod_idpr_ca_id
calleridpr_callerid
caller_idpr_callerid
callerid_numberpr_callerid
caller_id_numberpr_callerid
calleridnamepr_calleridname
callerid_namepr_calleridname
caller_id_namepr_calleridname
did_mod_idpr_did_ca_id
max_out_channelspr_maxoutchannels
ignore_sip_causepr_ignoresipcause
ignore_busypr_ignorebusy
sms_protocolpr_smsprotocol
sms_urlpr_smsurl
sms_userpr_smsuser
sms_passwordpr_smspassword
canreinvitesipfriends.canreinvite for chan_sip direct media
direct_mediaps_endpoints.direct_media for PJSIP direct media

Important Notes

  • Providers are global system objects and always require a global API key.
  • Readonly global API keys can list and read providers, but create, update, and delete require the full global API key.
  • SIP providers manage the related sipfriends realtime row when realtime is enabled.
  • PJSIP providers manage the related ps_endpoints, ps_aors, ps_auths, and ps_endpoint_id_ips rows when realtime is enabled.
  • When a provider changes technology, the API removes old realtime rows before creating rows for the new technology.
  • Provider callerid and callerid_name values are optional. When set, calls routed through the provider use those caller ID values instead of extension-derived caller ID.
  • Use canreinvite for chan_sip direct media values. Use direct_media for PJSIP direct media values.

Examples

List Providers

Returns the providers visible to the key and scope.

curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers"

Get Provider

Reads one object by its internal ID.

curl -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"

Create Provider

Creates a new object. Use the short aliases shown above or the source field names.

curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API PJSIP Provider",
  "peername": "docs-pjsip-provider",
  "tech": "PJSIP",
  "realtime": "on",
  "host": "198.51.100.20",
  "username": "docs-trunk",
  "password": "change-this-secret",
  "transport": "UDP",
  "codecs": [
    "ulaw",
    "alaw"
  ],
  "qualify": "yes",
  "qualifyfreq": 60,
  "direct_media": "no",
  "callerid": "+15551230000",
  "callerid_name": "Docs API Provider"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers"

Edit Provider

Updates only the supplied fields.

curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "disabled": "",
  "penalty": 10,
  "max_out_channels": 25,
  "callerid": "+15551230001",
  "callerid_name": "Docs API Main"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"

Delete Provider

Deletes the object. Check references before deleting configuration used by routing or reporting.

curl -X DELETE \
  -H "X-API-Key: GLOBAL_API_KEY" \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"

Create SIP Provider

Creates a chan_sip provider and the related sipfriends realtime peer.

curl -X POST \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Docs API SIP Provider",
  "peername": "docs-sip-provider",
  "tech": "SIP",
  "realtime": "on",
  "host": "198.51.100.10",
  "username": "docs-sip-trunk",
  "password": "change-this-secret",
  "transport": "UDP",
  "nat": "force_rport,comedia",
  "codecs": [
    "ulaw",
    "alaw"
  ],
  "canreinvite": "no"
}' \
  "https://pbx.example.com/pbx/openapi.php/providers"

Edit PJSIP Realtime Settings

Updates provider fields and related PJSIP endpoint, AOR, auth, and endpoint identification rows.

curl -X PATCH \
  -H "X-API-Key: GLOBAL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "host": "198.51.100.21",
  "password": "new-secret",
  "direct_media": "no",
  "sendrpid": "pai",
  "codecs": [
    "ulaw",
    "alaw",
    "opus"
  ]
}' \
  "https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID"

Common Errors

ErrorMeaning
missing_api_keyNo API key was supplied in the query string, X-API-Key, or bearer token.
invalid_api_keyThe supplied key does not match the tenant or global API key.
tenant_requiredA tenant code is required for tenant-scoped writes or tenant-key reads.
read_only_api_keyThe key can read data but cannot create, update, or delete objects.
missing_required_fieldA required create field is missing.