Redirection CLI

From Snom User Wiki

Jump to: navigation, search

WARNING: This script is Beta and provided as is without any warranty or support!



For a convienient, zero-touch installation of the phones snom offers a free of charge redirection service to its customers.

PLEASE NOTE: This service is free of charge and provided by snom without any Service Level Agreements (SLA). Even though we try to keep the server available at all times there is no guarantee for this. If you require a highly available solution there are several ways to setup an own system and change the snom factory defaults to point to your new server. If you are interested in this process please contact

The snom redirection server can be accessed using a XMLRPC interface. This CLI script provides an implementation of this interface and allows the user to manage his redirections.

This script 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.

Getting and installing snom CLI

In order to use the snom redirection server command line interface (CLI) you need to have Python installed. After successful Python installation you can download and execute snom Redirection Server CLI.

Install Python

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 CLI

Download the CLI script:

  • SRAPS CLI: from here: this version should be used only for SRAPS

Start the CLI

In order to execute the CLI call your Python interpreter with the script name

user@laptop:~/prj/src$ python

Login to the redirection server

The CLI will ask for your redirection server credentials which will be provided after you've signed the Redirection agreement.

# Snom Redirection Server Console     #
# (c) 2010 snom technology AG         #
Username: rds.username

After a successful login the CLI will present the prompt:


where rds.username is replaced by your username.

Working with the CLI

The CLI understands a specific set of commands described below. A command is always composed of a command name and depending on the command parameters, all seperated by spaces.

add 000413123456
remove 000413123456
help add
list all
list snom370

After typing the command press ENTER to execute it.

Getting help

The CLI provides a help command which can be used in two different ways:

  1. Print available commands
  2. Get command specific help

Listing available commands

In order to list all available commands type

rds.username%> help


rds.username%> ?

this will show all commands with a short description:

rds.username%> ?

Available commands:
set      --> Set a variable value
help     --> Get Help. Provide a command name to get command specific help
update   --> Update redirection
logout   --> Exit this application
check    --> Check if a redirection exists
list     --> List registered redirections
remove   --> Remove a redirection
add      --> Add a redirection
exit     --> Exit this application
print    --> Print a variable value. Use 'print all' to show all variables
version --> Show the version
?        --> Get Help. Provide a command name to get command specific help

add 000413123456
remove 000413123456

Getting command specific help

In order to get help on a specific command type

rds.username%> help command_name


rds.username%> ? command_name

Where command_name is the name of the command you need help for.

rds.username%> ? add

add (Add a redirection)

        add [mac address] [redirection URL]

PLEASE NOTE: the list of commands might change without further notice so check for new or updated commands on any script updates.

Managing redirections

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

The following sections describe how these tasks can be accomplished in the CLI.

Create a new redirection - the add command

In order to create a new redirection for a given phone use the add command:

rds.username%> add 000413401D95{mac} 
Adding redirection for 000413401D95 to{mac}.
Redirection to{mac} for snom820 with MAC address 000413401D95 has been successfully registered.

Deleting a redirection - the remove command

In order to delete an existing redirection use the remove command:

rds.username%> remove 000413401D95
Successfully removed redirection for snom820 with MAC address 000413401D95.

NOTE: 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:

rds.username%> update 000413401d95
Updating redirection for 000413401d95 to
Redirection to for snom820 with MAC address 000413401d95 has been successfully updated.

Checking redirection status - the check command

In order to check if a redirection for a given phone exists use the check command.

rds.username%> check 000413401d95
snom820 with MAC address 000413401D95 is registered.
Current redirection target is:

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.

rds.username%> list all
Loading information ...

| MAC address  | URL                                                                                                                                                   |
| 000413401D95 |                                                                                                             |
| 00041341123D |{mac}                                      |

List redirections per phone type

You can also list redirections for a specific phone type using list type where type is one of:

  • snom300
  • snom320
  • snom360
  • snom370
  • snom820
  • snom821
  • snom870
  • snomMP
rds.username%> list snom820
| MAC address      | URL                                                                                                                                               |
| 000413401D95 |                                                                                                             |

Listing all redirections for a specific phone type and URL

By adding an URL to the phone type you can also list all redirections for this specific phone type to the given URL:

rds.username%> list snom820
| MAC address  | URL                                                           |
| 000413401D95 |                                           |
rds.username%> list snom820
No phones of type snom820 are pointing to

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 set command:

set myurl{mac}

Accessing variable values

After you have set a variable value you can use it in all commands:

add 000413123456 %myurl

would be executed as

add 000413123456{mac}

Showing variable values - the print command

You can use the print command to show the values of currently defined variables:

  1. print all shows all variable values
  2. print var_name shows the value of the variable called var_name
rds.username%> print all

Local variables:
a = snom820
b = snom821
myurl ={mac}


rds.username%> print myurl
myurl ={mac}

NOTE: 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.

Personal tools