OpenSIPS: dispatcher

From OnnoWiki
Revision as of 16:53, 3 February 2014 by Onnowpurbo (talk | contribs) (New page: Referensi http://www.opensips.org/html/docs/modules/1.6.x/dispatcher.html 1.6.1. Destination List File Each destination point must be on one line. First token is the set id, followed by ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Referensi http://www.opensips.org/html/docs/modules/1.6.x/dispatcher.html

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:127.0.0.1:5080
2 sip:127.0.0.1:5082

# gateways
1 sip:127.0.0.1:7070
1 sip:127.0.0.1:7072
1 sip:127.0.0.1:7074

...


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)
fork=no
log_stderror=yes  # (cmd line: -E)

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

# for more info: sip_router -h

# ------------------ module loading ----------------------------------
mpath="/usr/local/lib/opensips/modules/"
loadmodule "maxfwd.so"
loadmodule "sl.so"
loadmodule "dispatcher.so"

# loadmodule "modules/tm/tm.so"

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

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

route{
	if ( !mf_process_maxfwd_header("10") )
	{
	 	sl_send_reply("483","To Many Hops");
	 	drop();
	};
	
	ds_select_dst("2", "0");
	
	forward(); 
	# t_relay();
}


Referensi