Using simple PHP code and configurations files, you can easily enhance options and create custom modules that will be displayed on the ScopServ GUI.
Please note that some PHP programming knowledge are required.
Directories and Files
All Addons must be installed under ScopServ configuration directory.
The base directory is
/var/www/scopserv/telephony/config/addons/
{module}
where
{module} is the directory name of the module/addon.
A skeleton with examples is available under skeleton/ directory.
| Filename | Description |
|---|
| info.php | This is a mandatory file and contain Name and Description of the addon. |
| tabs.php | Tabs structure. |
| columns.php | Columns definitions for each List and Multi List. |
| params.php | Form parameters. |
| commit.php | Commit functions/procedures. |
If you want to add extra parameters to system sections, you must create the file {section}_extra.php where {section} is the section name. Here some examples:
| Filename | Section | Description |
|---|
| phone_extra.php | phone | Phones -> Extensions |
| line_in_extra.php | line_in | Lines -> Incoming Lines |
| line_out_extra.php | line_out | Lines -> Outgoing Lines |
Functions
Theses functions are
exclusivly available on the commit.php script. Please refer to
ScopServ API for more details on available functions.
getInfos (
string $type )
Get informations from database for the specified type/section.
getConfig ( )
Get configurations from database for the current addon.
addToDialplan (
string $tenant,
string $context,
string $exten,
int $prio,
array $cmd )
This function will add new extension into
context for a specific
Tenant. If there is an existence of extension with the same priority we simply replace this extension.
removeFromDialplan (
string $tenant,
string $context [,
string $exten [,
int $prio [,
array $cmd ]]] )
Remove an dialplan from a given context. If an extension is given, only that specific extension from the given context will be removed.
addToDatabase (
string $family,
string $key,
string $value )
Adds or updates an entry in the Asterisk database for a given family, key, and value.
removeFromDatabase (
string $family [,
string $key ] )
Deletes a family or specific keytree within a family in the Asterisk database.
Predefined Variables
Theses
read-only variables are
exclusivly available on the commit.php script.
| Name | Type | Description |
|---|
| $tenants | array | List of Tenants |
| $addon | string | Name of the Addon |
| $addon_name | string | Description of the Addon |
| $data | array | Internal Data container (Reserved Variable) |