How to use the beroNet Gateway API

The beroNet Gateway API

The beroNet Gateway API is a REST API that can simply be accessed by using HTTP + URL.

Basics

The beroNet Gateway API can be accessed by using the URL (the standard username:password are "admin:admin"):

http://IPoftheGateway/app/api/api.php

Under the above mentioned URL you will find documentation about the API, how to use it and an overview about the commands.

Commands have always the following schema: http://<ip_of_beroNet_Gateway_device/app/api/beroFix.php?cmd=[command]&data=[key1]=[value1]:[key2]=[value2]...

You can easily access the API from a console with "wget". If for example you want to read which lineinterfaces are present on your beroNet Gateway card you can execute the following command in a shell

wget -O- --user=admin --password=admin http://berofix/app/api/beroFix.php?cmd=getlif 2>/dev/null

This could for example output the following:

lif:0;type:bf4S0
lif:1;type:bf2GSM

GSM SMS

beroNet Gateway has 3 volatile directories in which SMS are stored:

in        (incoming sms)
out       (outgoing sms queue)
failout   (outgoing sms failed queue)

These 3 Directories can be accessed via the beroNet Gateway API and the 4 Commands:

smsList
smsGet
smsSend
smsDelete

Functionlist and explaination

A complete list of the functions currently supplied by our firmware

SetAPIPWD

Function to set the beroNet Gateway Configuration API Password Usage:

   [command]=setapipwd
   [key]=password
   [value]=[yourpassword]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=setapipwd&data=password=admin

Return values:

   setapipwd:success -> if everthing was ok.
   setapipwd:error -> if an error occured.

SetWebPWD

Function to set the beroNet Gateway Web Password Usage:

   [command]=setwebpwd
   [key1]=oldpassword
   [value1]=[oldpassword]
   [key2]=newpassword
   [value2]=[newpassword]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=setwebpwd&data=oldpassword=admin:newpassword=admin

Return values:

   setwebpwd:success -> if everthing was ok.
   setwebpwd:error -> if an error occured.

SetProvType

Function to set the beroNet Gateway provisioning mode to tftp or http Usage:

   [command]=setprovtype
   [key]=type
   [value]=[tftp|http]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=setprovtype&data=type=tftp

Return values:

   setprovtype:success -> if everthing was ok.
   setprovtype:error -> if an error occured.

SetTFTP

Function to set TFTP Server and URL Usage:

   [command]=settftp
   [key1]=tftphost
   [value1]=[tftphostIP]
   [key2]=tftpurl
   [value2]=[tftURL]
   [key3]=tftponboot
   [value3]=[yes|no]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=settftp&data=tftphost=10.0.0.1:tftpurl=berofix:tftponboot=no

It is possible to use the variables {mac} and {serial} to identify the devices and create seperate directories in the tftp server. An Example could look like this:

   Example: http://172.20.70.43/app/api/{serial}/beroFix.php?cmd=settftp&data=tftphost=10.0.0.1:tftpurl=berofix:tftponboot=no

Return values:

   settftp:success -> if everthing was ok.
   settftp:error -> if an error occured.

SetHTTP

Function to set HTTP Server and URL Usage:

   [command]=sethttp
   [key1]=httphost
   [value1]=[httphostIP]
   [key2]=httpurl
   [value2]=[httpurl]
   [key3]=httponboot
   [value3]=[yes|no]
   [key4]=httpport
   [value4]=[httpport]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=sethttp&data=httphost=10.0.0.1:httpport=81:httpurl=berofix:httponboot=no

It is possible to use the variables {mac} and {serial} to identify a single device in the http server like:

   Example: http://172.20.70.43/app/api/beroFix.php?cmd=sethttp&data=httphost=10.0.0.1:httpport=81:httpurl=berofix/{mac}/:httponboot=no

Return values:

   sethttp:success -> if everthing was ok.
   sethttp:error -> if an error occured.

GetLif

Function to get detected Lineinterfaces. Usage:

   [command]=getlif
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getlif

Return values:

   lif:Lineinterface Number
   type:Lineinterface type
   lif:[0|1];type:[bf4S0|bf1E1|bf2E1|bf2GSM|bf4FXO|bf4FXS]
   Example:
   lif:0;type:bf2E1
   lif:1;type:bf4S0

GetInfo

Function to get Version infos for HW Revison or firmware ... Usage:

   [command]=getinfo
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getinfo

Return values:

   ROOTFSVersion:[number]
   APPFSVersion:[number]
   HWRevision:[number]
   HWSerial:[number]
   FPGAVersion:[number]
   MAC:[macaddress]
   APIVersion:[version]

GetISDNState

Function to get the state of each configured ISDN port Usage:

   [command]=getisdnstate
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getisdnstate

Return values:

   getisdnstate:success -> if everthing was ok
   getisdnstate:error -> if an error occured

GetISDNStats

Function to get ISDN Layer 1 / Layer 2 statistics. Usage:

   [command]=getisdnstats
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getisdnstats

Return values:

   getisdnstats:success -> if everthing was ok
   getisdnstats:error -> if an error occured

GetAnalogState

Function to get the state of each configured analog port Usage:

   [command]=getanalogstate
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getanalogstate

Return values:

   getanalogstate:success -> if everthing was ok
   getanalogstate:error -> if an error occured

GetSIPState

Function to get the state of each SIP Registar Usage:

   [command]=getsipstate
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getsipstate

Return values:

   getsipstate:success -> if everthing was ok
   getsipstate:error -> if an error occured

GetISGWInfo

Function to get the several infos from ISGW (Telnet Wrapper). Usage:

   [command]=getisgwinfo
   [key]=isgwcmd
   [value]=[i |r |l |k |u |bc |ss |ssp | ...]
   i=isdn state
   r=status of registration
   l=status of operation
   k=status of operations (compact)
   u=uptime of isgw
   bc=list bchannel objects
   ss=show call statistics
   ssp=show port specific call statistics
   or any other valid ISGW Telnet command. Press h in the
   telnet interface to get a list of possible commands.
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=getisgwinfo&data=isgwcmd=u

Return values:

   getisgwinfo:success -> if everthing was ok
   getisgwinfo:error -> if an error occured

Logging

Function to control logging features on beroNet Gateway Usage:

   [command]=logging
   [key1]=active
   [value1]=[0|1]
   [key2]=loglevel
   [value2]=[0-9]
   [key3]=logserver
   [value3]=[IP-Address]
   [key4]=logport
   [value4]=[udpport]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=logging&data=active=1:loglevel=5:logserver=172.20.5.51:logport=55555

Return values:

   logging:success -> if everthing was ok
   logging:error -> if an error occured

Config_Update

Function to start Config Update via TFTP or HTTP depending on how setprovtype is set Usage:

   [command]=config_update
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=config_update

Return values:

   config_update:Prov_type:success -> if everthing was ok
   config_update:Prov_type:failed:[comments] ->TFTP / HTTP problem or no Download selected.[comments] for details
   config_update:Prov_type:error -> if an major error occured. Check Config Files.

Firmware_Update

Function to start Firmware update via TFTP or HTTP depending on how setprovtype is set Usage:

   [command]=firmware_update
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=firmware_update

Return values:

   firmware_update:Prov_type:success -> if everthing was ok
   firmware_update:Prov_type:failed:[comments] ->TFTP / HTTP problem or no Download selected.[comments] for details
   firmware_update:Prov_type:error -> if an major error occured.

beroCloud

Function to enable Monitoring for beroNet's Cloud solution Usage:

   [command]=berocloud
   [key1]=cloud_enable
   [value1]=[0|1]
   [key2]=cloud_key
   [value2]=[CLOUDKEY]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=berocloud&data=cloud_enable=0:cloud_key=5555555555

Return values:

   berocloud:success -> if everthing was ok
   berocloud:error -> if an error occured

CreateConfig

Function to create and download config files Usage:

   [command]=createconfig
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=createconfig

Return values:

   createconfig:success -> if everthing was ok
   createconfig:error -> if an error occurred

RestoreOldConfig

Function to Restore the previous provisioning config Usage:

   [command]=restoreoldconfig
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=restoreoldconfig

Return values:

   restoreoldconfig:success -> if everthing was ok
   restoreoldconfig:error -> if an error occured

Fulltrace

Usage:

   [command]=fulltrace
   [key1]=action
   [value1]=[start|stop|download]
   [key2]=sipsig
   [value2]=[yes|no] only set if action=start
   [key3]=sipaudio
   [value3]=[yes|no] only set if action=start
   Examples:
   Start: http://172.20.70.43/app/api/beroFix.php?cmd=fulltrace&data=action=start:sipsig=yes:sipaudio=no
   Stop: http://172.20.70.43/app/api/beroFix.php?cmd=fulltrace&data=action=stop
   Download: http://172.20.70.43/app/api/beroFix.php?cmd=fulltrace&data=action=download

Return values:

   fulltrace:success -> if everthing was ok.
   fulltrace:error -> if an error occurred.

Reload

Function Reload with new settings Usage:

   [command]=reload
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=reload

Return values:

   reload:success -> if everthing was ok
   reload:error ->if an error occured

Reboot

Function to reboot a beroNet Gateway device Usage:

   [command]=reboot
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=reboot

Return values:

   reboot:rebooting... -> if reboot is initiated

SmsList

Function to list SMS Queues Usage:

   [command]=smslist
   [key]=queue
   [value]=[in/out/failout]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=smslist&data=queue=failout

Return values:

   smslist:success -> if everthing was ok.
   smslist:error -> if an error occured.

SmsGet

Function to get SMS Usage:

   [command]=smsget
   [key1]=queue
   [value1]=[queuename]
   [key2]=idx
   [value2]=[smsid]
   [key3]=delete
   [value3]=[yes] just if you want to delete the sms
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=smsget&data=queue=out:idx=000013fb09d06:delete=yes

Return values:

   smsget:success -> if everthing was ok.
   smsget:error -> if an error occured.

SmsSend

Function to send SMS Usage:

   [command]=smssend
   [key1]=num
   [value1]=[phonenumber] HTML special characters have to be replaced
   [key2]=port
   [value2]=[portnumber]
   [key3]=msg
   [value3]=[message] HTML special characters have to be replaced
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=smssend&data=num=%2B123456:port=1:msg=This is the message

Return values:

   smssend:success -> if everthing was ok.
   smssend:error -> if an error occured.

SmsDelete

Function to delete SMS Usage:

   [command]=smsdelete
   [key1]=queue
   [value1]=[queuename]
   [key2]=idx
   [value2]=[smsid]
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=smsdelete&data=queue=out:idx=000013fb09d06

Return values:

   smsdelete:success -> if everthing was ok.
   smsdelete:error -> if an error occured.

HealthCheck

Function to check the health state of the beroNet Gateway Usage:

   [command]=healthcheck
   Example: http://172.20.70.43/app/api/beroFix.php?cmd=healthcheck

Return values:

   CPU Load:[number]
   Free RAM:[number]

Related pages

If you need scheduled remote assistance, you can request our on-demand support services: https://www.beronet.com/support