OpenSIPS: dispatcher

From SpeedyWiki

Jump to: navigation, search


1.4.1. ds_select_dst(set, alg)

The method selects a destination from addresses set.

Meaning of the parameters is as follows:

  • set - the id of the set from where to pick up destination address. It is the first column in destination list file.
  • alg - the algorithm used to select the destination address.
“0” - hash over callid
“1” - hash over from uri.
“2” - hash over to uri.
“3” - hash over request-uri.
“4” - round-robin (next destination).
"5” - hash over authorization-username (Proxy-Authorization or "normal" authorization). If no username is found, round robin is used.
“6” - random (using rand()).
“7” - hash over the content of PVs string. Note: This works only when the parameter hash_pvar is set.
“8” - the first entry in set is chosen.
“X” - if the algorithm is not implemented, the first entry in set is chosen. 

If the bit 2 in 'flags' is set, the rest of the addresses from the destination set is stored in AVP list. You can use 'ds_next_dst()' to use next address to achieve serial forking to all possible destinations.

This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.

Example 1.26. ds_select_dst usage

ds_select_dst("1", "0");

1.6.1. Destination List File

Each destination point must be on one line. First token is the set id, followed by destination address. Optionally, the third field can be flags value (1 - destination inactive, 2 - destination in probing mod -- you can do bitwise OR to set both flags). The set id must be an integer value. Destination address must be a valid SIP URI. Empty lines or lines starting with “#” are ignored.

Example 1.28. dispatcher list file

# $Id: dispatcher.list 5901 2009-07-21 07:45:05Z bogdan_iancu $
# dispatcher destination sets

# line format
# setit(integer) destination(sip uri) flags (integer, optional)

# proxies
2 sip:
2 sip:

# gateways
1 sip:
1 sip:
1 sip:


1.6.2. OpenSIPS config file

Next picture displays a sample usage of dispatcher.

Example 1.29. OpenSIPS config script - sample dispatcher usage


# $Id: dispatcher.cfg 5901 2009-07-21 07:45:05Z bogdan_iancu $
# sample config file for dispatcher module

debug=9          # debug level (cmd line: -dddddddddd)
log_stderror=yes  # (cmd line: -E)

check_via=no      # (cmd. line: -v)
dns=off           # (cmd. line: -r)
rev_dns=off       # (cmd. line: -R)

# for more info: sip_router -h

# ------------------ module loading ----------------------------------
loadmodule ""
loadmodule ""
loadmodule ""

# loadmodule "modules/tm/"

# ----------------- setting module-specific parameters ---------------
# -- dispatcher params --

modparam("dispatcher", "list_file", "../etc/dispatcher.list")
# modparam("dispatcher", "force_dst", 1)

	if ( !mf_process_maxfwd_header("10") )
	 	sl_send_reply("483","To Many Hops");
	ds_select_dst("2", "0");
	# t_relay();


loadmodule ""

changed route to use dispatcher

   if (uri =~ "sip:001[0-9]@*"){
       log(1, "Forwarding to Asterisk \n");

My dispatcher Config Looks like below

2 sip:a2b-asterisk-ip:5062
2 sip:a2b-asterisk-ip2:5062


[edit] Lebih Dalam

[edit] Asterisk Round Robin

[edit] OpenSIPS

[edit] OpenSIPS round robin

  • OpenSIPS: dispatcher

[edit] Referensi

[edit] Pranala Menarik

[edit] Persiapan

[edit] Script

[edit] OpenBTS 2.6

[edit] OpenBTS 2.8

[edit] Multi OpenBTS 2.8

[edit] OpenBTS 3.1.x

[edit] Ettus E110

[edit] Ettus N210

[edit] RangeNetworks

[edit] GPRS

[edit] Briker OpenBTS

[edit] FreeSWITCH OpenBTS

[edit] Power Amplifier

[edit] Lain Lain

[edit] Catatan Legal dan Pendukung

[edit] Catatan Sejarah

[edit] Dokumentasi Video

[edit] Perjuangan OpenBTS

Personal tools