F REQUENTLY A SKED Q UESTION - Snom
F REQUENTLY A SKED Q UESTION - Snom
F REQUENTLY A SKED Q UESTION - Snom
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Problem Statement<br />
In some environments, users of the<br />
snom 4S would like to be able to automatically<br />
perform actions such as registering new users<br />
and deactivating accounts. In principle, these<br />
actions are not critical to performance.<br />
The snom 4S software components have<br />
a built-in web server that supports the features<br />
required. It therefore makes sense to have a<br />
“remote control” that uses the web interface<br />
of the Proxy or the Media Server in the same<br />
fashion as real users do. The snom 4S does<br />
not recognize that a shell script controls its<br />
behavior.<br />
Initiating Web Access from the<br />
Command Line Interface<br />
The problem of controlling a remote web<br />
server from a shell is well known. There are<br />
programs available for performing this task -<br />
“curl” is available for Linux and for Windows<br />
and can be integrated into shell scripts and<br />
PHP programs. For more information, see<br />
http://curl.haxx.se. Other web programs work<br />
in a similar way.<br />
The proxy and the media server do not<br />
differentiate between POST and GET with<br />
parameters in the URL.<br />
Parameter values are “url-encoded”. That<br />
means that some special characters have a<br />
particular meaning. For instance, the “&” is<br />
a separator symbol between the parameters,<br />
the “+” means a space character and “=” is<br />
used to indicate an assignment of a value to<br />
a variable. If you want to encode one of these<br />
special characters (and other characters that<br />
are not in the normal character set), you can<br />
use the % followed by the two-digit hex code<br />
of the character to encode the character that<br />
you need. If in doubt, you should use the %xx<br />
notation.<br />
[ F R E Q U E N T L Y A S K E D Q U E S T I O N ]<br />
Proxy Version 2.3x and Higher<br />
In the 3.x versions of the proxy, we use<br />
a scripting language to control the behavior of<br />
the proxy. When the proxy receives a request<br />
to post information to a predefined webpage<br />
(post.htm), it first determines the domain<br />
and the password for this domain. If there is<br />
a match, it sets all variables in the http post<br />
accordingly and calls the subroutine “on_post”.<br />
This function can then perform the necessary<br />
actions (a predefined behavior is available,<br />
see below). Sending information to the proxy<br />
does not require a session context.<br />
For example, if you use “curl http://<br />
myproxy:8080/post.htm?domain=abc.com&p<br />
ass=secret&var1=abc&var2=hello+here%21”<br />
, the proxy will execute the function “on_post”<br />
in the domain context of “abc.com” (if it exists<br />
and the password is “secret”). The variable<br />
“$var1” will be set to “abc” and the variable<br />
“$var2” will be set to “hello here!”.<br />
The Default on_post() Function<br />
The proxy comes with several predefined<br />
default functions. If you load another on_<br />
post() function in the domain, these functions<br />
are overwritten.<br />
The default script uses the variable<br />
“action” to indicate what the proxy should do.<br />
• create_user:<br />
This function uses the variables<br />
“account” (which indicates the account to<br />
use), “username” (which indicates the user<br />
name for challenging) and “password” (the<br />
password for challenging) to create or update<br />
a user account.<br />
• delete_user:<br />
This function deletes a user account<br />
(indicated in the variable “account”).<br />
• disable_user:<br />
This function disables a user account<br />
(indicated in the variable “account”).<br />
• enable_user:<br />
2 snom technology AG