Browse Source

use the opensips localcache instead of memcache

3.12
K Anderson 14 years ago
parent
commit
0901e4cce6
1 changed files with 13 additions and 12 deletions
  1. +13
    -12
      opensips/opensips.cfg

+ 13
- 12
opensips/opensips.cfg View File

@ -109,7 +109,7 @@ disable_tcp=no
## Module Loading ## Module Loading
###################################################################### ######################################################################
mpath="/usr/lib64/opensips/modules/" mpath="/usr/lib64/opensips/modules/"
loadmodule "memcached.so"
loadmodule "localcache.so"
loadmodule "signaling.so" loadmodule "signaling.so"
loadmodule "sl.so" loadmodule "sl.so"
loadmodule "tm.so" loadmodule "tm.so"
@ -128,9 +128,10 @@ loadmodule "mi_fifo.so"
# loadmodule "xlog.so" # loadmodule "xlog.so"
###################################################################### ######################################################################
## Memcached Module Parameters
## Localcache Module Parameters
###################################################################### ######################################################################
modparam("memcached", "server", "callid_hash = 127.0.0.1:11211")
modparam("localcache", "cache_table_size", 10)
modparam("localcache", "cache_clean_period", 120)
###################################################################### ######################################################################
## Stateless UA Module Parameters ## Stateless UA Module Parameters
@ -367,7 +368,7 @@ route
{ {
xlog("L_INFO", "$ci|log|maintaining contact association to media server $fd"); xlog("L_INFO", "$ci|log|maintaining contact association to media server $fd");
cache_store("memcached_callid_hash", "$tU ", "$fd", 3600);
cache_store("local", "$tU", "$fd", 3600);
} }
xlog("L_INFO", "$ci|log|forwarding based on the route set"); xlog("L_INFO", "$ci|log|forwarding based on the route set");
@ -466,17 +467,17 @@ route
{ {
xlog("L_INFO", "$ci|log|originated from internal source"); xlog("L_INFO", "$ci|log|originated from internal source");
} }
# if the request is not from our media severs but has a contact uri in memcache
# if the request is not from our media severs but has a contact uri in localcache
# then change the routing to go to the server previously associated with it. # then change the routing to go to the server previously associated with it.
else if ($ct.fields(uri) && cache_fetch("memcached_callid_hash", "$(ct.fields(uri){uri.user})", $avp(i:55)))
else if ($ct.fields(uri) && cache_fetch("local", "$(ct.fields(uri){uri.user})", $avp(i:55)))
{ {
$rd = $avp(i:55); $rd = $avp(i:55);
xlog("L_INFO", "$ci|log|contact $(ct.fields(uri){uri.user}) is associated with media server $rd"); xlog("L_INFO", "$ci|log|contact $(ct.fields(uri){uri.user}) is associated with media server $rd");
} }
# if the request is not from our media severs but has a call-id in memcache
# if the request is not from our media severs but has a call-id in localcache
# then change the routing to go to the server previously associated with it. # then change the routing to go to the server previously associated with it.
else if (cache_fetch("memcached_callid_hash", "$ci", $avp(i:55)))
else if (cache_fetch("local", "$ci", $avp(i:55)))
{ {
$rd = $avp(i:55); $rd = $avp(i:55);
@ -486,10 +487,10 @@ route
{ {
xlog("L_INFO", "$ci|log|associated contact $(ct.fields(uri){uri.user}) with media server $rd"); xlog("L_INFO", "$ci|log|associated contact $(ct.fields(uri){uri.user}) with media server $rd");
cache_store("memcached_callid_hash", "$(ct.fields(uri){uri.user})", "$rd", 3600);
cache_store("local", "$(ct.fields(uri){uri.user})", "$rd", 3600);
} }
} }
# if the request is not from our media servers and no associations in memcache
# if the request is not from our media servers and no associations in localcache
# then try to distribute to a media server # then try to distribute to a media server
else if (ds_select_domain("1", "4")) else if (ds_select_domain("1", "4"))
{ {
@ -634,7 +635,7 @@ onreply_route[on_net_reply]
# go to it (IE: the reply to the challenge) # go to it (IE: the reply to the challenge)
if (t_check_status("(407)|(401)")) if (t_check_status("(407)|(401)"))
{ {
cache_store("memcached_callid_hash", "$ci ", "$si", 60);
cache_store("local", "$ci", "$si", 60);
xlog("L_INFO", "$ci|log|associated call-id with media server $si"); xlog("L_INFO", "$ci|log|associated call-id with media server $si");
} }
@ -684,7 +685,7 @@ failure_route[on_net_fault]
{ {
xlog("L_INFO", "$ci|log|associated contact $(ct.fields(uri){uri.user}) with media server $rd"); xlog("L_INFO", "$ci|log|associated contact $(ct.fields(uri){uri.user}) with media server $rd");
cache_store("memcached_callid_hash", "$(ct.fields(uri){uri.user})", "$rd", 3600);
cache_store("local", "$(ct.fields(uri){uri.user})", "$rd", 3600);
} }
xlog("L_INFO", "$ci|pass|$rd"); xlog("L_INFO", "$ci|pass|$rd");


Loading…
Cancel
Save