IPbxAdminApi is an interface, which provides administrative access to the PBX. It uses the Websocket/Json interface "PbxAdmin". To be able to use this interface inside an App Service, a Websocket connection from the PBX has to exist. For this connection access to the "PbxAdminApi" has to be granted
File | common/interface/pbx_admin.h |
Classes |
IPbxAdminApi UPbxMonitorAdminObject UPbxMonitorConfig |
class IPbxAdminApi : public UJsonApiContext {
public:
static class IPbxAdminApi * Create(const char * domain, const char * pbx);
virtual ~IPbxAdminApi() {};
virtual void SetPbx(const char * domain, const char * pbx) = 0;
virtual void MonitorAdminObject(class UPbxMonitorAdminObject * monitor) = 0;
virtual void MonitorConfig(class UPbxMonitorConfig * monitor) = 0;
virtual void SendGetConfigObjects() = 0;
virtual void SendGetObject(const char * cn) = 0;
virtual void SendUpdateObject(class json_io& msg, char* buffer, word base) = 0;
virtual void SendGetNodes(ulong64 limit, const char* last) = 0;
virtual void SendGetStun() = 0;
virtual void SendGetBooleans(ulong64 limit, const char* last) = 0;
};
This is the interface class which provides the public functions for the features of the interface after initialization is done.
This functions needs to be called as part of the initialization to create the interface class.
char * domain | The name of the domain, to be used for the Api |
char * pbx | The name of the pbx, to be used for the Api |
For this to work, the AppInstance class needs to use JsonApiContext as base class.
class <Your App Name>> : public AppInstance, ... , public JsonApiContext
After the Create function the interface has to be registered in the JsonApiContext
pbxAdminApi = IPbxAdminApi::Create(domain, pbx);
RegisterJsonApi(pbxAdminApi);
Starts monitoring of the PBX Admin object. The UPbxMonitorAdminObject virtual functions are called on changes
class UPbxMonitorAdminObject * monitor | The virtual class for the callback functions |
Use UPbxMonitorAdminObject as a base class of one of your classes and call this function to start monitoring. Example:
class <Your App Name>> : public AppInstance, ... , public UPbxMonitorAdminObject {
...
pbxAdminApi->MonitorAdminObject(this);
}
Starts monitoring of the PBX for some basic config changes
class UPbxMonitorConfig * monitor | The virtual class for the callback functions |
Use UPbxMonitorConfig as a base class of one of your classes and call this function to start monitoring. Example:
class <Your App Name>> : public AppInstance, ... , public UPbxMonitorConfig {
...
pbxAdminApi->MonitorConfig(this);
}
Requests a list of all the Config Templates
Use SendGetConfigObjects to requests a list of all the Config Templates to the PBX. Example:
pbxAdminApi->SendGetConfigObjects();
Requests a PBX object data
const char* cn | The common name of the requested PBX OBject |
Use SendGetObject to requests a PBX object data to the PBX. Example:
pbxAdminApi->SendGetObject("User0");
Requests a PBX object data
class json_io& msg | |
char* buffer | |
word base |
Use SendUpdateObject to update a PBX object data to the PBX. Example:
char buffer[1024];
json_io msg(buffer);
word base = msg.add_object(JSON_ID_ROOT, 0);
msg.add_string(base, "h323", h323);
msg.add_string(base, "cn", cn);
msg.add_string(base, "guid", guid);
pbxAdminApi->SendUpdateObject(msg, buffer, base);
Requests a list of all the nodes and locs
ulong64 limit | The max number of nodes returned (it cannot be higher than 200) |
const char* last | The name of the last node received (NULL if no nodes have been received yet) |
Use SendGetNodes to requests a list of all the nodes and locs to the PBX. SendGetNodes must be called until an empty array is received. Example:
pbxAdminApi->SendGetNodes(200, "NodeTest");
Requests STUN and TURN information
Use SendGetStun to requests the STUN and TURN data. Example:
pbxAdminApi->SendGetStun();
Requests a list of all the boolean objects
ulong64 limit | The max number of booleans returned (it cannot be higher than 200) |
const char* last | The name of the last boolean object received (NULL if no objects have been received yet) |
Use SendGetBooleans to requests a list of all the boolean objects to the PBX. SendGetBooleans must be called until an empty array is received. Example:
pbxAdminApi->SendGetBooleans(200, "BoolTest");
class UPbxMonitorAdminObject {
public:
virtual void PbxAdminObjectUpdate(const char * pwd, const char * key) = 0;
};
Virtual base class to be used for the callback on Admin object changes
class UPbxMonitorConfig {
public:
virtual void PbxConfigUpdate(const char * domain, const char * pbx, const char * dns) = 0;
};
Virtual base class to be used for the callback on PBX config changes