Pustaka Taratsa

Baca teks (EPUB): OpenSIPS: dispatcher

1 bagian

Teks ini diambil langsung dari berkas EPUB; tata letak dan gambar tidak disertakan. Untuk tampilan lengkap, silakan merujuk pada dokumen asli.

Daftar isi
  1. OpenSIPS: dispatcher
  2. Lebih Dalam
  3. Asterisk Round Robin
  4. OpenSIPS
  5. OpenSIPS round robin
  6. Referensi
  7. Pranala Menarik
  8. Persiapan
  9. Script
  10. OpenBTS 2.6
  11. OpenBTS 2.8
  12. Multi OpenBTS 2.8
  13. OpenBTS 3.1.x
  14. Ettus E110
  15. Ettus N210
  16. RangeNetworks
  17. GPRS
  18. Briker OpenBTS
  19. FreeSWITCH OpenBTS
  20. Power Amplifier
  21. Lain Lain
  22. Catatan Legal dan Pendukung
  23. Catatan Sejarah
  24. Dokumentasi Video
  25. Perjuangan OpenBTS

OpenSIPS: dispatcher

Sumber: https://onnocenter.or.id/wiki/index.php/OpenSIPS:_dispatcher

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



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: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: http://opensips-open-sip-server.1449251.n2.nabble.com/opensips-dispatcher-asterisk-problem-td3180606.html

loadmodule "dispatcher.so"
.
modparam("dispatcher","list_file","/usr/local/etc/opensips/dispatcher.cfg")
.

changed route to use dispatcher

route[3]{
   if (uri =~ "sip:001[0-9]@*"){
       log(1, "Forwarding to Asterisk \n");
       ds_select_dst("2","4");
       forward();
       route(1);
   exit;
 }



My dispatcher Config Looks like below

dispatcher.cfg
2 sip:a2b-asterisk-ip:5062
2 sip:a2b-asterisk-ip2:5062

Lebih Dalam

Asterisk Round Robin

OpenSIPS

OpenSIPS round robin

Referensi

Pranala Menarik

Persiapan

Script

OpenBTS 2.6

OpenBTS 2.8

Multi OpenBTS 2.8

OpenBTS 3.1.x

Ettus E110

Ettus N210

RangeNetworks

GPRS

Briker OpenBTS

FreeSWITCH OpenBTS

Power Amplifier

Lain Lain

Catatan Sejarah

Dokumentasi Video

Perjuangan OpenBTS