optimized code calls word both ways and options - failover and logs needed - ALMOST DONE
This commit is contained in:
62
kamailio.cfg
62
kamailio.cfg
@@ -5,7 +5,7 @@ loadmodule "rr.so"
|
|||||||
loadmodule "maxfwd.so"
|
loadmodule "maxfwd.so"
|
||||||
loadmodule "textops.so"
|
loadmodule "textops.so"
|
||||||
loadmodule "rtpengine.so"
|
loadmodule "rtpengine.so"
|
||||||
loadmodule "dispatcher.so"
|
#loadmodule "dispatcher.so"
|
||||||
loadmodule "nathelper.so"
|
loadmodule "nathelper.so"
|
||||||
loadmodule "ctl"
|
loadmodule "ctl"
|
||||||
loadmodule "pv"
|
loadmodule "pv"
|
||||||
@@ -25,14 +25,14 @@ log_facility=LOG_LOCAL0
|
|||||||
# RTPProxy settings
|
# RTPProxy settings
|
||||||
modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223")
|
modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:2223")
|
||||||
# Dispatcher settings
|
# Dispatcher settings
|
||||||
modparam("dispatcher", "db_url", "mysql://kamailio:kamailiow@localhost/kamailio")
|
#modparam("dispatcher", "db_url", "mysql://kamailio:kamailiow@localhost/kamailio")
|
||||||
modparam("dispatcher", "ds_ping_interval", 10)
|
#modparam("dispatcher", "ds_ping_interval", 10)
|
||||||
modparam("dispatcher", "ds_ping_method", "OPTIONS")
|
#modparam("dispatcher", "ds_ping_method", "OPTIONS")
|
||||||
modparam("dispatcher", "ds_probing_threshold", 10)
|
#modparam("dispatcher", "ds_probing_threshold", 10)
|
||||||
modparam("dispatcher", "ds_inactive_threshold", 10)
|
#modparam("dispatcher", "ds_inactive_threshold", 10)
|
||||||
modparam("dispatcher", "ds_ping_latency_stats", 1)
|
#modparam("dispatcher", "ds_ping_latency_stats", 1)
|
||||||
modparam("dispatcher", "ds_ping_from", "sip:kam@10.0.5.6")
|
#modparam("dispatcher", "ds_ping_from", "sip:kam@10.0.5.6")
|
||||||
modparam("dispatcher", "ds_probing_mode", 1) #Keeps pinging gateways when state is known (to detect change in state)
|
#modparam("dispatcher", "ds_probing_mode", 1) #Keeps pinging gateways when state is known (to detect change in state)
|
||||||
# KAMCTL config
|
# KAMCTL config
|
||||||
modparam("ctl", "binrpc", "/var/run/kamailio/kamailio_ctl")
|
modparam("ctl", "binrpc", "/var/run/kamailio/kamailio_ctl")
|
||||||
# UAC settings
|
# UAC settings
|
||||||
@@ -86,18 +86,6 @@ request_route {
|
|||||||
sl_send_reply("484", "Address Incomplete");
|
sl_send_reply("484", "Address Incomplete");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
# Force RTPENGINE
|
|
||||||
if (is_method("INVITE")) {
|
|
||||||
rtpengine_manage("replace-origin replace-session-connection force-relay");
|
|
||||||
}
|
|
||||||
# update $du to set the destination address for proxying
|
|
||||||
if ($siz=="10.0.5.7") {
|
|
||||||
xlog("Incomming call from SIP provider");
|
|
||||||
$du = "sip:" + "10.0.5.4";
|
|
||||||
} else {
|
|
||||||
xlog("Incomming call from Customer PBX");
|
|
||||||
$du = "sip:" + "10.0.5.7";
|
|
||||||
}
|
|
||||||
route(RELAY);
|
route(RELAY);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -116,7 +104,26 @@ route[RELAY] {
|
|||||||
if (is_method("INVITE")) {
|
if (is_method("INVITE")) {
|
||||||
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
|
if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
|
||||||
}
|
}
|
||||||
|
# Force RTPENGINE
|
||||||
|
if (is_method("INVITE")) {
|
||||||
|
rtpengine_manage("replace-origin replace-session-connection force-relay");
|
||||||
|
}
|
||||||
|
|
||||||
|
# update $du to set the destination address for proxying based on caller IP
|
||||||
|
if ($siz=="10.0.5.7") {
|
||||||
|
xlog("Incomming call from SIP provider");
|
||||||
|
$du = "sip:" + "10.0.5.4";
|
||||||
|
} else {
|
||||||
|
xlog("Incomming call from Customer PBX");
|
||||||
|
$du = "sip:" + "10.0.5.7";
|
||||||
|
}
|
||||||
|
if ($siz=="10.0.5.5") {
|
||||||
|
xlog("Incomming call from SIP provider2");
|
||||||
|
$du = "sip:" + "10.0.5.4";
|
||||||
|
}
|
||||||
|
# If auth is required perform it
|
||||||
t_on_failure("TRUNKAUTH");
|
t_on_failure("TRUNKAUTH");
|
||||||
|
# Relay
|
||||||
t_relay();
|
t_relay();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -143,7 +150,6 @@ failure_route[TRUNKAUTH] {
|
|||||||
route[REQINIT] {
|
route[REQINIT] {
|
||||||
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
|
if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") {
|
||||||
# silent drop for scanners - uncomment next line if want to reply
|
# silent drop for scanners - uncomment next line if want to reply
|
||||||
# sl_send_reply("200", "OK");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,17 +159,7 @@ route[REQINIT] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
|
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
|
||||||
# sl_send_reply("200", "Keepalive");
|
route(RELAY);
|
||||||
# update $du to set the destination address for proxying
|
|
||||||
if ($siz=="10.0.5.7") {
|
|
||||||
xlog("Incomming call from SIP provider");
|
|
||||||
$du = "sip:" + "10.0.5.4";
|
|
||||||
} else {
|
|
||||||
xlog("Incomming call from Customer PBX");
|
|
||||||
$du = "sip:" + "10.0.5.7";
|
|
||||||
}
|
|
||||||
t_on_failure("TRUNKAUTH");
|
|
||||||
t_relay();
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user