Jump to content

TuCloudAPI checkextnum

From Wiki 7Kas

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

Is this number free for a NEW extension of this PBX? The same check addextension runs under its lock, so the two never disagree. Rules: a registered extension takes 3-4 digits (^[1-9][0-9]{2,3}$); a send-to extension (toext_id set) 3-8 digits (^[1-9][0-9]{2,7}$) and the number is required; never a leading 0; 112 and 700-703 are reserved; not an extension or a queue of this PBX; the SIP name pbxname+num must be free in the root. "Taken" is an ANSWER, not an error: ok:true, available:false, field:"num", reason (required | format | reserved | extension | queue | unavailable) and a Spanish message to show as is, plus next_free (registered mode; null for send-to or when nothing is free). An absent, empty or over-long num is reason format (required in send-to mode). Errors keep the envelope: missing_pbx, forbidden, invalid_param (toext_id not a number), server_busy, db_error.

Call

https://tucloudapi.7kas.com:9087/tucloud?func=checkextnum&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 (e.g. tucall). The (ukey, pbx) pair is the tenant boundary; the server verifies the ukey owns this PBX.
num string Yes — The number to check (digits).
toext_id integer No 0 The form's mode: 0 or absent = registered extension; any extension id = send-to (3-8 digits, required, no next_free).

Example

https://tucloudapi.7kas.com:9087/tucloud?func=checkextnum&ukey=KEY&pbx=tucall&num=1234

Response

{ok:true, num, available:true} | {ok:true, num, available:false, field:"num", reason, message, next_free:"201"|null}.

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