Jump to content

TuCloudAPI addagent: Difference between revisions

From Wiki 7Kas
TuCloudAPI reference: pbx param help -> FuturePBX (API surface unchanged)
TuCloudAPI reference regenerated from func=help: tenancy rule, pbx notes on every PBX-scoped function, error codes
 
Line 1: Line 1:
''TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: '''SuperRoot, Operator, Client'''.''
''TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: '''SuperRoot, Operator, Client'''.''
{{Note|1=Requires the <code>pbx</code> parameter (the PBX '''name''', e.g. <code>tucall</code>). The server verifies that your <code>ukey</code>'s own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns <code>{"ok":false,"code":"forbidden"}</code>.}}


== Description ==
== Description ==
Line 5: Line 7:


== Call ==
== Call ==
GET https://tucloudapi.7kas.com:9087/tucloud?func=addagent&ukey=YOUR_KEY
  https://tucloudapi.7kas.com:9087/tucloud?func=addagent&ukey=YOUR_KEY&pbx=PBX_NAME
Requires the <code>ukey</code> parameter.
GET, or POST with the parameters form-urlencoded in the body. Requires the <code>ukey</code> parameter. Always HTTP 200; the response is a JSON envelope.


== Parameters ==
== Parameters ==
Line 18: Line 20:
| <code>ext_id</code> || integer || Yes || — || Extension _id (from getagentlookups.extensions).
| <code>ext_id</code> || integer || Yes || — || Extension _id (from getagentlookups.extensions).
|-
|-
| <code>penalty</code> || integer || No || <code>0</code> || Member penalty (0 = highest priority).
| <code>penalty</code> || integer || No || <code>0</code> || Member penalty: whole number 0-100, 0 = highest priority. A non-numeric or out-of-range value is rejected with invalid_param (never silently coerced to 0). Negatives are refused because the engine clamps them to 0 on read, which would display a priority the call does not use.
|}
|}
== Example ==
== Example ==
Line 25: Line 27:
== Response ==
== Response ==
{ok, agent:{_id,queue_id,queue,membername,interface,exten,agent_name,penalty,paused,reason_paused}} or {ok:false,conflict}.
{ok, agent:{_id,queue_id,queue,membername,interface,exten,agent_name,penalty,paused,reason_paused}} or {ok:false,conflict}.
== Errors ==
Always HTTP 200. On failure the body is <code>{"ok":false,"code":"...","message":"..."}</code>. Common codes: <code>missing_pbx</code>, <code>forbidden</code>, <code>invalid_param</code>, <code>not_found</code>, <code>conflict</code>, <code>in_use</code>, <code>db_error</code>, <code>server_busy</code>; the Response section above lists any specific to this function.


----
----
Back to [[TuCloudAPI]]
Back to [[TuCloudAPI]]
[[Category:TuCloudAPI SuperRoot]][[Category:TuCloudAPI Operator]][[Category:TuCloudAPI Client]][[Category:TuCloudAPI]]
[[Category:TuCloudAPI SuperRoot]][[Category:TuCloudAPI Operator]][[Category:TuCloudAPI Client]][[Category:TuCloudAPI]]

Latest revision as of 21:16, 8 October 2026

TuCloudAPI function to manage FuturePBX (the cloud PBX). Available to: SuperRoot, Operator, Client.

ℹ Requires the pbx parameter (the PBX name, e.g. tucall). The server verifies that your ukey's own account owns that PBX, whatever its role; otherwise, and also for a PBX that does not exist, it returns {"ok":false,"code":"forbidden"}.

Description

Add an extension to a queue as a static member. The server derives membername (Agent/<sipuser>), interface (SIP/<sipuser>), name and exten from the extension (ext_id) + queue (queue_id); sipuser = the extension SIP user. Requires a non-readonly ukey. A queue can hold many agents and an agent can be in many queues; the only duplicate is the same agent already in that same queue -> conflict.

Call

https://tucloudapi.7kas.com:9087/tucloud?func=addagent&ukey=YOUR_KEY&pbx=PBX_NAME

GET, or POST with the parameters form-urlencoded in the body. Requires the ukey parameter. Always HTTP 200; the response is a JSON envelope.

Parameters

Parameter Type Required Default Meaning
pbx string Yes — FuturePBX name (tenant boundary).
queue_id integer Yes — Queue _id (from getagentlookups.queues).
ext_id integer Yes — Extension _id (from getagentlookups.extensions).
penalty integer No 0 Member penalty: whole number 0-100, 0 = highest priority. A non-numeric or out-of-range value is rejected with invalid_param (never silently coerced to 0). Negatives are refused because the engine clamps them to 0 on read, which would display a priority the call does not use.

Example

https://tucloudapi.7kas.com:9087/tucloud?func=addagent&ukey=KEY&pbx=tucall&queue_id=1001&ext_id=104081

Response

{ok, agent:{_id,queue_id,queue,membername,interface,exten,agent_name,penalty,paused,reason_paused}} or {ok:false,conflict}.

Errors

Always HTTP 200. On failure the body is {"ok":false,"code":"...","message":"..."}. Common codes: missing_pbx, forbidden, invalid_param, not_found, conflict, in_use, db_error, server_busy; the Response section above lists any specific to this function.


Back to TuCloudAPI