This CLI script provides an implementation of the XML-RPC interface, and allows the user to manage the redirections of his phones.
It is Open Source and given to the users - just like the underlying service - without any warranty whatsoever. Feel free to edit the script according to your requirements.
Installation and Run CLI
In order to use the Snom redirection service command line interface (CLI) you need to have Python installed. Python is preinstalled on many Linux distributions and on Mac OS X. However it is also available for all other major operating systems. You can find the current Python installation for your system here.
- Download the latest version of the cli.py from our Github repository: https://github.com/Snomio/RDS-CLI/releases
Start CLI: In order to execute the CLI call your Python interpreter with the script name
Login to SRAPS
The CLI will ask for your SRAPS credentials. If you do not have yet a user account, you can sign up online at https://sraps.snom.com.
After a successful login the CLI will present the prompt:
with YourUsername being your personal SRAPS user name.
Working with the CLI
The CLI provides a help command which can be used in two different ways:
- Print available commands
- Get command specific help
Listing available commands
In order to list all available commands type:
If you want to get a short description of the command, type help <command>:
The list of commands might change without further notice. Please check for new or updated commands on any script updates.
The actions you can execute to manage redirections are the following:
Create a new redirection
- Delete a redirection
- Change the URL for a redirection for a specific phone
- Change the URL for a redirection for all phones redirecting to a specific URL (XXX)
- Check if a redirection for a specific phone exists
- Check if redirections for a list of phones exist (XXX)
- List the redirections you have setup
- by phone type
- by URL (XXX -> List all url)
- by phone type & URL
- all redirections
Create a new redirection - the add command
In order to create a new redirection for a given phone use the add command:
Deleting a redirection - the remove command
In order to delete an existing redirection use the remove command:
The system will refuse to remove a redirection if it was not created with your username!!!
Changing redirections - the update command
Changing a redirection is a two-step process:
- Delete the old redirection
- Create a new redirection
Both steps are handled by the update command seamlessly.
Update the redirection for one phone
In order to update the redirection for one phone call the update command with the same syntax as the add command:
Checking redirection status - the check command
In order to check if a redirection for a given phone exists use the
Listing active redirections - the list command
In order to list your active redirections you can use the list command.
Listing all active redirections
Use list all to list all active redirections. Please note that this command takes a couple of seconds to execute as it needs to query all phone types.
Using local variables
The CLI supports basic local variables allowing you to save some typing.
Setting a variable value
In order to assign a variable value use the
Accessing variable values
After you have set a variable value you can use it in all commands:
would be executed as
Showing variable values - the print command
You can use the
- print all shows all variable values
print var_name shows the value of the variable called var_name
As the % sign can also be used in URLs please choose your variable names wisely so they do not conflict with your URL. Like 20 is not a good variable name if your URL contains a whitespace (%20).
Finishing your work
When you are done you can use the exit or logout command to exit the CLI.