From 5751b92a7b40b9de0a67eaacd5d6c97e1382de91 Mon Sep 17 00:00:00 2001 From: "SIPLABS, LLC" Date: Thu, 2 Apr 2015 19:22:57 +0700 Subject: [PATCH 1/2] empty responder role --- kamailio/responder-role.cfg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 kamailio/responder-role.cfg diff --git a/kamailio/responder-role.cfg b/kamailio/responder-role.cfg new file mode 100644 index 0000000..ee957a8 --- /dev/null +++ b/kamailio/responder-role.cfg @@ -0,0 +1,4 @@ +####### Responder Logic ######## +route[HANDLE_RESPOND] +{ +} \ No newline at end of file From 75d316f56bb6e6eefc236bdb7f8d606e832e9230 Mon Sep 17 00:00:00 2001 From: "SIPLABS, LLC" Date: Tue, 7 Apr 2015 20:39:26 +0700 Subject: [PATCH 2/2] responder role --- kamailio/default.cfg | 6 ++++++ kamailio/local.cfg | 1 + kamailio/responder-role.cfg | 10 +++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 1e931c3..f17230c 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -201,6 +201,9 @@ include_file "traffic-filter-role.cfg" #!ifdef PUSHER-ROLE include_file "pusher-role.cfg" #!endif +#!ifdef RESPONDER-ROLE +include_file "responder-role.cfg" +#!endif ####### Permissions module ########## loadmodule "permissions.so" @@ -253,6 +256,9 @@ route route(PREPARE_INITIAL_REQUESTS); if (isflagset(FLAG_INTERNALLY_SOURCED)) { + #!ifdef RESPONDER-ROLE + route(HANDLE_RESPOND); + #!endif route(INTERNAL_TO_EXTERNAL_RELAY); exit(); } diff --git a/kamailio/local.cfg b/kamailio/local.cfg index 530b1d0..51b7ee7 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -11,6 +11,7 @@ debug = L_INFO #!trydef NAT-TRAVERSAL-ROLE #!trydef REGISTRAR-ROLE #!trydef PRESENCE-ROLE +#!trydef RESPONDER-ROLE ## Disabled Roles - remove all but the last '#' to enable # # #!trydef TRAFFIC-FILTER-ROLE diff --git a/kamailio/responder-role.cfg b/kamailio/responder-role.cfg index ee957a8..353b6c9 100644 --- a/kamailio/responder-role.cfg +++ b/kamailio/responder-role.cfg @@ -1,4 +1,12 @@ ####### Responder Logic ######## route[HANDLE_RESPOND] { -} \ No newline at end of file + $var(header) = $hdr(X-KAZOO-Respond-With); + if (not_empty("$var(header)")) { + $var(code) = $(var(header){s.substr,0,3}{s.int}); + $var(msg) = $(var(header){s.substr,4,0}); + xlog("L_INFO", "$ci|end|Responding with [$var(code)/$var(msg)]"); + sl_send_reply("$var(code)", "$var(msg)"); + exit(); + } +}