SpeedDial Module


Table of Contents

1. Admin Guide
1.1. Overview
1.2. Dependencies
1.2.1. OpenSIPS Modules
1.2.2. External Libraries or Applications
1.3. Exported Parameters
1.3.1. db_url (string)
1.3.2. user_column (string)
1.3.3. domain_column (string)
1.3.4. sd_user_column (string)
1.3.5. sd_domain_column (string)
1.3.6. new_uri_column (string)
1.3.7. domain_prefix (string)
1.3.8. use_domain (int)
1.4. Exported Functions
1.4.1. sd_lookup(table [, owner])
1.5. Installation and Running
1.5.1. OpenSIPS config file
2. Contributors
2.1. By Commit Statistics
2.2. By Commit Activity
3. Documentation
3.1. Contributors

List of Tables

2.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)
2.2. Most recently active contributors(1) to this module

List of Examples

1.1. Set db_url parameter
1.2. Set user_column parameter
1.3. Set domain_column parameter
1.4. Set sd_user_column parameter
1.5. Set sd_domain_column parameter
1.6. Set new_uri_column parameter
1.7. Set domain_prefix parameter
1.8. Set use_domain parameter
1.9. sd_lookup usage
1.10. OpenSIPS config script - sample speeddial usage

Chapter 1. Admin Guide

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 OpenSIPS. Then it can dial the two digits whenever it wants to call the SIP address associated with them.

1.2. Dependencies

1.2.1. OpenSIPS Modules

The following modules must be loaded before this module:

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

1.2.2. External Libraries or Applications

The following libraries or applications must be installed before running OpenSIPS with this module loaded:

  • None.

1.3. Exported Parameters

1.3.1. db_url (string)

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

Default value is mysql://opensipsro:opensipsro@localhost/opensips.

Example 1.1. Set db_url parameter

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

1.3.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 1.2. Set user_column parameter

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

1.3.3. domain_column (string)

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

Default value is domain.

Example 1.3. Set domain_column parameter

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

1.3.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 1.4. Set sd_user_column parameter

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

1.3.5. sd_domain_column (string)

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

Default value is sd_domain.

Example 1.5. Set sd_domain_column parameter

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

1.3.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 1.6. Set new_uri_column parameter

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

1.3.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 1.7. Set domain_prefix parameter

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

1.3.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 1.8. Set use_domain parameter

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

1.4. Exported Functions

1.4.1.  sd_lookup(table [, owner])

The function lookups the short dial number from R-URI in 'table' and replaces the R-URI with associated address.

Meaning of the parameters is as follows:

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

  • owner (string) - The SIP URI of the owner of short dialing codes. If not pressent, URI of From header is used.

This function can be used from REQUEST_ROUTE.

Example 1.9. sd_lookup usage

...
# 'speed_dial' is the default table name created by opensips db script
if($ru=~"sip:[0-9]{2}@.*")
	sd_lookup("speed_dial");
# use auth username
if($ru=~"sip:[0-9]{2}@.*")
	sd_lookup("speed_dial", "sip:$au@$fd");
...

1.5. Installation and Running

1.5.1. OpenSIPS config file

Next picture displays a sample usage of speeddial.

Example 1.10. OpenSIPS config script - sample speeddial usage

...
# 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)

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

mpath="/usr/local/lib/opensips/modules"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mysql.so"
loadmodule "speeddial.so"
loadmodule "mi_fifo.so"

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

# -- mi_fifo params --

modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")

# -- usrloc params --

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

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

# main routing logic
route{

	# initial sanity checks 
	if (!mf_process_maxfwd_header("10"))
	{
		sl_send_reply(483,"Too Many Hops");
		exit;
	};
	if ($ml >=  65535 )
	{
		sl_send_reply(513, "Message too big");
		exit;
	};

	if (!$rm=="REGISTER") record_route();

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

	if (!is_myself("$rd"))
	{
		if (!t_relay())
		{
			sl_reply_error();
		};
		exit;
	};

	if (is_myself("$rd"))
	{
		if ($rm=="REGISTER")
		{
			save("location");
			exit;
		};

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

		lookup("aliases");
		if (!is_myself("$rd"))
		{
			if (!t_relay())
			{
				sl_reply_error();
			};
			exit;
		};

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

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


...
		

Chapter 2. Contributors

2.1. By Commit Statistics

Table 2.1. Top contributors by DevScore(1), authored commits(2) and lines added/removed(3)

 NameDevScoreCommitsLines ++Lines --
1. Bogdan-Andrei Iancu (@bogdan-iancu)272390147
2. Daniel-Constantin Mierla (@miconda)2116127137
3. Liviu Chircu (@liviuchircu)14123861
4. Elena-Ramona Modroiu12210631
5. Razvan Crainea (@razvancrainea)86118
6. Vlad Patrascu (@rvlad-patrascu)643135
7. Henning Westerholt (@henningw)425041
8. Maksym Sobolyev (@sobomax)4245
9. Elena-Ramona Modroiu4241
10. Sergio Gutierrez4222

All remaining contributors: Walter Doekes (@wdoekes), Anca Vamanu, Andrei Pelinescu-Onciul, Konstantin Bokarius, Julián Moreno Patiño, Peter Lemenkov (@lemenkov), Edson Gellert Schubert.

(1) DevScore = author_commits + author_lines_added / (project_lines_added / project_commits) + author_lines_deleted / (project_lines_deleted / project_commits)

(2) including any documentation-related commits, excluding merge commits. Regarding imported patches/code, we do our best to count the work on behalf of the proper owner, as per the "fix_authors" and "mod_renames" arrays in opensips/doc/build-contrib.sh. If you identify any patches/commits which do not get properly attributed to you, please submit a pull request which extends "fix_authors" and/or "mod_renames".

(3) ignoring whitespace edits, renamed files and auto-generated files

2.2. By Commit Activity

Table 2.2. Most recently active contributors(1) to this module

 NameCommit Activity
1. Liviu Chircu (@liviuchircu)Mar 2014 - May 2024
2. Maksym Sobolyev (@sobomax)Feb 2023 - Feb 2023
3. Walter Doekes (@wdoekes)Apr 2021 - Apr 2021
4. Razvan Crainea (@razvancrainea)Aug 2015 - Jul 2020
5. Bogdan-Andrei Iancu (@bogdan-iancu)Oct 2005 - Mar 2020
6. Vlad Patrascu (@rvlad-patrascu)May 2017 - Apr 2019
7. Peter Lemenkov (@lemenkov)Jun 2018 - Jun 2018
8. Julián Moreno PatiñoFeb 2016 - Feb 2016
9. Sergio GutierrezNov 2008 - Dec 2008
10. Daniel-Constantin Mierla (@miconda)May 2006 - Mar 2008

All remaining contributors: Konstantin Bokarius, Edson Gellert Schubert, Henning Westerholt (@henningw), Anca Vamanu, Elena-Ramona Modroiu, Andrei Pelinescu-Onciul, Elena-Ramona Modroiu.

(1) including any documentation-related commits, excluding merge commits

Chapter 3. Documentation

3.1. Contributors

Last edited by: Liviu Chircu (@liviuchircu), Vlad Patrascu (@rvlad-patrascu), Peter Lemenkov (@lemenkov), Bogdan-Andrei Iancu (@bogdan-iancu), Sergio Gutierrez, Daniel-Constantin Mierla (@miconda), Konstantin Bokarius, Edson Gellert Schubert, Elena-Ramona Modroiu, Elena-Ramona Modroiu.

Documentation Copyrights:

Copyright © 2004 Voice Sistem SRL