1. Speedial Module

Elena-Ramona Modroiu

Voice Sistem
Revision History
Revision $Revision$ $Date$

1.1. Overview
1.2. Dependencies
1.3. Installation And Running
1.3.1. Database setup
1.3.2. Example SER Configuration FIle
1.4. Parameters
1.4.1. db_url (string)
1.4.2. user_column (string)
1.4.3. domain_column (string)
1.4.4. sd_user_column (string)
1.4.5. sd_domain_column (string)
1.4.6. new_uri_column (string)
1.4.7. domain_prefix (string)
1.4.8. use_domain (int)
1.5. Functions
1.5.1. sd_lookup(table)
1.6. Frequently Asked Questions

1.1. Overview

This module provides on-server speed dial facilities. An user can store records consisting of pairs short numbers (2 digits) and SIP addresses into a table of SER. Then it can dial the two digits whenever he wants to call the SIP address associated with those digits.

1.2. Dependencies

The following modules must be loaded before this module:

  • database module (mysql, dbtext, ...).

  • sl - stateless module.

1.3. Installation And Running

1.3.1. Database setup

Before using speeddial module, you have to create the database table where the short dial addresses are stored. If the table was not created at the installation time, you can use the following SQL script (tested with MySQL) as template. Database, the table name, and column names can be set with module parameters so they can be changed.

Example 1. speeddial sql script

CREATE TABLE speed_dial (
  username varchar(64) NOT NULL default '',
  domain varchar(128) NOT NULL default '',
  sd_username varchar(64) NOT NULL default '',
  sd_domain varchar(128) NOT NULL default '',
  new_uri varchar(192) NOT NULL default '',
  description varchar(64) NOT NULL default '',
  PRIMARY KEY (username, domain, sd_domain, sd_username)
);

1.3.2. Example SER Configuration FIle

Example 2. SER Configuration File

#
# $Id$
#
# sample config script to use speeddial module
#

# ----------- global configuration parameters ------------------------

check_via=no	# (cmd. line: -v)
dns=no          # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/speeddial.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

modparam("usrloc", "db_mode",   0)

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -------------------------  request routing logic -------------------

# main routing logic
route{

	# initial sanity checks 
	if (!mf_process_maxfwd_header("10"))
	{
		sl_send_reply("483","Too Many Hops");
		break;
	};
	if (msg:len >=  max_len )
	{
		sl_send_reply("513", "Message too big");
		break;
	};

	if (!method=="REGISTER") record_route();	

	if (loose_route())
	{
		if (!t_relay())
		{
			sl_reply_error();
		};
		break;
	};

	if (!uri==myself)
	{
		if (!t_relay())
		{
			sl_reply_error();
		};
		break;
	};

	if (uri==myself)
	{
		if (method=="REGISTER")
		{
			save("location");
			break;
		};

		if(uri=~"sip:[0-9]{2}@.*")
			sd_lookup("speeddial");

		lookup("aliases");
		if (!uri==myself)
		{
			if (!t_relay())
			{
				sl_reply_error();
			};
			break;
		};

		if (!lookup("location"))
		{
			sl_send_reply("404", "Not Found");
			break;
		};
	};

	if (!t_relay())
	{
		sl_reply_error();
	};
}


1.4. Parameters

Revision History
Revision $Revision$ $Date$

1.4.1. db_url (string)

The URL of database where the table containing speed dial records.

Default value is DEFAULT_RODB_URL.

Example 3. Set db_url parameter

...
modparam("speeddial", "db_url", "mysql://ser:xxx@localhost/ser")
...

1.4.2. user_column (string)

The name of column storing the user name of the owner of the speed dial record.

Default value is "username".

Example 4. Set user_column parameter

...
modparam("speeddial", "user_column", "userid")
...

1.4.3. domain_column (string)

The name of column storing the domain of the owner of the speed dial record.

Default value is "domain".

Example 5. Set domain_column parameter

...
modparam("speeddial", "domain_column", "userdomain")
...

1.4.4. sd_user_column (string)

The name of the column storing the user part of the short dial address.

Default value is "sd_username".

Example 6. Set sd_user_column parameter

...
modparam("speeddial", "sd_user_column", "short_user")
...

1.4.5. sd_domain_column (string)

The name of the column storing the domain of the short dial address.

Default value is "sd_domain".

Example 7. Set sd_domain_column parameter

...
modparam("speeddial", "sd_domain_column", "short_domain")
...

1.4.6. new_uri_column (string)

The name of the column containing the URI that will be use to replace the short dial URI.

Default value is "new_uri".

Example 8. Set new_uri_column parameter

...
modparam("speeddial", "new_uri_column", "real_uri")
...

1.4.7. domain_prefix (string)

If the domain of the owner (From URI) starts with the value of this parameter, then it is stripped before performing the lookup of the short number.

Default value is NULL.

Example 9. Set domain_prefix parameter

...
modparam("speeddial", "domain_prefix", "tel.")
...

1.4.8. use_domain (int)

The parameter specifies wheter or not to use the domain when searching a speed dial record (0 - no domain, 1 - use domain from From URI, 2 - use both domains, from From URI and from request URI).

Default value is 0.

Example 10. Set use_domain parameter

...
modparam("speeddial", "use_domain", 1)
...

1.5. Functions

Revision History
Revision $Revision$ $Date$

1.5.1.  sd_lookup(table)

Print a formated message using LOG function.

Meaning of the parameters is as follows:

  • table - The name of the table storing the speed dial records.

Example 11. sd_lookup usage

...
if (uri =~ "sip:[0-9]{2}@.*") {
    sd_lookup("speeddial");
}
...

1.6. Frequently Asked Questions

Revision History
Revision $Revision$ $Date$
1.6.1. Where can I post a question about this module?
1.6.2. How can I report a bug?

1.6.1.

Where can I post a question about this module?

Sent an email to or, if you want to keep the mail private, send it to .

Remember: first at all, check if your question was already answered on one of SER mailing lists:

1.6.2.

How can I report a bug?

Accumulate as much as possible information (SER version, ser -V output, your OS (uname -a), SER logs, network dumps, core dump files, configuration file) and send a mail to