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
| Property | Value |
|---|---|
| Object | provider |
| Primary path | /providers |
| ID field | pr_id |
| Label field | pr_name |
| Primary source table | pr_providers |
| Required on create | pr_name |
| Path aliases | /provider, /providers |
Endpoint Patterns
| Action | Example pattern |
|---|---|
| List | GET https://pbx.example.com/pbx/openapi.php/providers |
| Get by ID | GET https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID |
| Create | POST https://pbx.example.com/pbx/openapi.php/providers |
| Update | PATCH https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID |
| Delete | DELETE https://pbx.example.com/pbx/openapi.php/providers/OBJECT_ID |
Accepted Field Aliases
| Request field | Source field |
|---|---|
name | pr_name |
peername | pr_peername |
peer_name | pr_peername |
tech | pr_tech |
host | pr_host |
disabled | pr_disabled |
penalty | pr_penalty |
realtime | pr_userealtime |
use_realtime | pr_userealtime |
calleridmod_id | pr_ca_id |
callerid | pr_callerid |
caller_id | pr_callerid |
callerid_number | pr_callerid |
caller_id_number | pr_callerid |
calleridname | pr_calleridname |
callerid_name | pr_calleridname |
caller_id_name | pr_calleridname |
did_mod_id | pr_did_ca_id |
max_out_channels | pr_maxoutchannels |
ignore_sip_cause | pr_ignoresipcause |
ignore_busy | pr_ignorebusy |
sms_protocol | pr_smsprotocol |
sms_url | pr_smsurl |
sms_user | pr_smsuser |
sms_password | pr_smspassword |
canreinvite | sipfriends.canreinvite for chan_sip direct media |
direct_media | ps_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
| Error | Meaning |
|---|---|
missing_api_key | No API key was supplied in the query string, X-API-Key, or bearer token. |
invalid_api_key | The supplied key does not match the tenant or global API key. |
tenant_required | A tenant code is required for tenant-scoped writes or tenant-key reads. |
read_only_api_key | The key can read data but cannot create, update, or delete objects. |
missing_required_field | A required create field is missing. |
No comments to display
No comments to display