Navigation Menu

Skip to content

Commit

Permalink
opensips: nicer-looking debugs
Browse files Browse the repository at this point in the history
  • Loading branch information
shimaore committed Feb 17, 2014
1 parent 36610bf commit a7a85a7
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 143 deletions.
6 changes: 3 additions & 3 deletions common/opensips/fragments/authenticate-disabled.cfg
Expand Up @@ -3,11 +3,11 @@
# Description: replacement module for `authenticate` when no authorization/authentication is desired.

route[authenticate] {
xlog("L_DBG","-- authenticate -- disabled");
xlog("L_DBG","-- authenticate -- disabled\n");
}
route[authenticate_check] {
xlog("L_DBG","-- authenticate_check -- disabled");
xlog("L_DBG","-- authenticate_check -- disabled\n");
}
route[authenticate_register] {
xlog("L_DBG","-- authenticate_register -- disabled");
xlog("L_DBG","-- authenticate_register -- disabled\n");
}
32 changes: 16 additions & 16 deletions common/opensips/fragments/authenticate.cfg
Expand Up @@ -22,7 +22,7 @@ route[authenticate] {
if ignore_static_endpoints
# Only process inbound_sbc
if($json(src_endpoint/inbound_sbc)) {
xlog("L_DBG","-- route(authenticate): inbound_sbc at $si");
xlog("L_DBG","-- route(authenticate): inbound_sbc at $si\n");
} else {
$avp(endpoint) := '{}';
$json(src_endpoint) := $avp(endpoint);
Expand All @@ -39,11 +39,11 @@ route[authenticate] {
# or with a RURI parameter "source" that contains the IP address of the actual originator.
$var(host_info) = null;

xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, RURI $ru, trying header Sock-Info = $(hdr(Sock-Info))");
xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, RURI $ru, trying header Sock-Info = $(hdr(Sock-Info))\n");
$var(host_info) = $(hdr(Sock-Info){uri.host});
xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, host_info = $var(host_info)");
xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, host_info = $var(host_info)\n");
if($var(host_info) == null) {
xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, trying URI param source = $(ru{uri.param,source})");
xlog("L_DBG","-- route(authenticate): Forwarding SBC $si, trying URI param source = $(ru{uri.param,source})\n");
$var(host_info) = $(ru{uri.param,source}); # See client-ocs-sbc.
}
if($var(host_info) == null) {
Expand All @@ -69,11 +69,11 @@ route[authenticate] {
# Other SBCs are trusted (and the record is valid since we got a value for the "sbc" field).
case ${sbc_own_outbound}:
case ${sbc_csr_outbound}:
xlog("L_DBG","-- route(authenticate): Not authenticating an SBC");
xlog("L_DBG","-- route(authenticate): Not authenticating an SBC\n");
break;

default:
xlog("L_DBG","-- route(authenticate): Using socket source IP = $si");
xlog("L_DBG","-- route(authenticate): Using socket source IP = $si\n");
route(authenticate_check); # Authenticate customer
}

Expand All @@ -89,11 +89,11 @@ route[authenticate] {
# -----------------------------------------------------------------

route[authenticate_check] {
xlog("L_DBG","-- route(authenticate_check): Customer device from $si");
xlog("L_DBG","-- route(authenticate_check): Customer device from $si\n");

# Check whether this is a customer-side trunk (S2S).
if(!$json(src_endpoint/endpoint)) {
xlog("L_DBG","-- route(authenticate): Authorizing source $si");
xlog("L_DBG","-- route(authenticate): Authorizing source $si\n");

if authentication is radius
if (!radius_proxy_authorize("${challenge}")) {
Expand All @@ -105,14 +105,14 @@ route[authenticate_check] {
if authentication is database
if (!proxy_authorize("${challenge}","${auth_table}")) {
$var(code) = $retcode;
xlog("L_DBG","-- route(authenticate): proxy_authorize failed: $var(code)");
xlog("L_DBG","-- route(authenticate): proxy_authorize failed: $var(code)\n");
proxy_challenge("${challenge}","0");
exit;
}
end if authentication is database

if($json(src_endpoint/bypass_from_auth) == "true") {
xlog("L_DBG","-- route(authenticate): not checking From username $fu against Authentication ID $aU@$ar");
xlog("L_DBG","-- route(authenticate): not checking From username $fu against Authentication ID $aU@$ar\n");
} else {
if (!db_check_from()) {
t_reply("403", "Use From=Authentication-ID");
Expand Down Expand Up @@ -145,32 +145,32 @@ route[authenticate_check] {

if($json(src_endpoint/require_same_auth) == "true") {
if( $si == $json(src_endpoint/user_ip) ) {
xlog("L_DBG","-- route(authenticate): require_same_auth: $si matches with expected source IP");
xlog("L_DBG","-- route(authenticate): require_same_auth: $si matches with expected source IP\n");
} else {
xlog("L_DBG","-- route(authenticate): require_same_auth: $si does not match with expected $json(src_endpoint/user_ip)");
xlog("L_DBG","-- route(authenticate): require_same_auth: $si does not match with expected $json(src_endpoint/user_ip)\n");
t_reply("403","Incorrect source IP");
exit;
}
}

xlog("L_DBG","-- route(authenticate): Customer device $(json(src_endpoint)).");
xlog("L_DBG","-- route(authenticate): Customer device $(json(src_endpoint)).\n");
}
}

route[authenticate_register] {
xlog("L_DBG","-- authenticate_register -- Customer device from $si");
xlog("L_DBG","-- authenticate_register -- Customer device from $si\n");

if authentication is radius
if (!radius_www_authorize("${challenge}")) {
xlog("L_DBG", "-- authenticate_register -- Device $si ($fu) failed to register");
xlog("L_DBG", "-- authenticate_register -- Device $si ($fu) failed to register\n");
www_challenge("${challenge}","0");
exit;
}
end if authentication is radius

if authentication is database
if (!www_authorize("${challenge}","${auth_table}")) {
xlog("L_DBG", "-- authenticate_register -- Device $si ($fu) failed to register");
xlog("L_DBG", "-- authenticate_register -- Device $si ($fu) failed to register\n");
www_challenge("${challenge}","0");
exit;
};
Expand Down
18 changes: 9 additions & 9 deletions common/opensips/fragments/forwarder.cfg
Expand Up @@ -10,7 +10,7 @@
define has_forwarder

route[cleanup_headers] {
xlog("L_DBG","-- route(cleanup_headers)");
xlog("L_DBG","-- route(cleanup_headers)\n");
remove_hf("X-CCNQ3-Number-Domain");
remove_hf("X-CCNQ3-Extra");
remove_hf("X-CCNQ3-Location");
Expand All @@ -19,7 +19,7 @@ route[cleanup_headers] {
}

route[initial_forwarder] {
xlog("L_DBG","-- route(initial_forwarder) Processing $rm $ru");
xlog("L_DBG","-- route(initial_forwarder) Processing $rm $ru\n");

if do_not_forward_register
if(is_method("REGISTER")) {
Expand All @@ -30,7 +30,7 @@ route[initial_forwarder] {

if not ignore_dest_domain
if($(avp(dest_domain))) {
xlog("L_DBG","-- route(initial_forwarder) Using destination $(avp(dest_domain))");
xlog("L_DBG","-- route(initial_forwarder) Using destination $(avp(dest_domain))\n");
$rd = $(avp(dest_domain));
}
end if not ignore_dest_domain
Expand Down Expand Up @@ -73,7 +73,7 @@ route[initial_forwarder] {
end if not ignore_location

if not ignore_routing_data
xlog("L_DBG","-- route(initial_forwarder) -- Location = $var(location)");
xlog("L_DBG","-- route(initial_forwarder) -- Location = $var(location)\n");

if( $var(location) && avp_db_load("$(var(location))","$(avp(location))") ) {
$json(location) := $avp(location);
Expand Down Expand Up @@ -121,7 +121,7 @@ route[initial_forwarder] {
}

route[forwarder] {
xlog("L_DBG","-- forwarder -- t_relay $rm $ru");
xlog("L_DBG","-- forwarder -- t_relay $rm $ru\n");

if has_dialog_module
if( is_dlg_flag_set("${dflag_cleanup_headers}") ) {
Expand Down Expand Up @@ -154,22 +154,22 @@ route[forwarder] {

route[forwarder_progress]
{
xlog("L_DBG","-- forwarder-progress -- ACK/PRACK/CANCEL/UPDATE Processing $rm $ru");
xlog("L_DBG","-- forwarder-progress -- ACK/PRACK/CANCEL/UPDATE Processing $rm $ru\n");

if(!t_check_trans()) {
xlog("L_DBG", "-- forwarder-progress -- Dropping mis-routed $rm (481)");
xlog("L_DBG", "-- forwarder-progress -- Dropping mis-routed $rm (481)\n");
# Can't send a reply to an ACK
if(!is_method("ACK")) {
t_reply("481", "Call/Transaction Does Not Exist");
}
exit;
}

xlog("L_DBG", "-- forwarder-progress -- t_relay $rm $ru");
xlog("L_DBG", "-- forwarder-progress -- t_relay $rm $ru\n");
if(!t_relay("0x01")) { # Prevent dup 100
# t_relay failed, check if we need to stop mediaproxy
if (is_method("ACK")) {
xlog("L_DBG", "-- forwarder-progress -- t_relay failed, dropping ACK");
xlog("L_DBG", "-- forwarder-progress -- t_relay failed, dropping ACK\n");
if mediaproxy
route(stop_media_proxy); # End media session
end if mediaproxy
Expand Down
4 changes: 2 additions & 2 deletions common/opensips/fragments/generic.cfg
Expand Up @@ -5,7 +5,7 @@
# ROUTING

startup_route {
xlog("L_DBG","-- startup_route()");
xlog("L_DBG","-- startup_route()\n");
if notify
subscribe_event("E_CORE_THRESHOLD","${notify}");
subscribe_event("E_CORE_PKG_THRESHOLD","${notify}");
Expand All @@ -29,7 +29,7 @@ route
{
route(initialize);

xlog("L_DBG","-- route() -- $rm -- From: $fu -- To: $tu -- RURI: $ru");
xlog("L_DBG","-- route() -- $rm -- From: $fu -- To: $tu -- RURI: $ru\n");

if(loose_route()) {
route(loose_route_handler);
Expand Down
8 changes: 4 additions & 4 deletions common/opensips/fragments/invite-outbound-proxy.cfg
Expand Up @@ -10,7 +10,7 @@ define need_avp_db

route[invite_handler]
{
xlog("L_DBG","-- invite-outbound-proxy -- $ru");
xlog("L_DBG","-- invite-outbound-proxy -- $ru\n");

t_on_failure("1");
t_on_reply("1");
Expand All @@ -36,7 +36,7 @@ route[invite_handler]
$avp(number) := null;

if($json(dst_number/inbound_uri)) {
xlog("L_DBG","-- invite-oubound-proxy -- Using local inbound_uri");
xlog("L_DBG","-- invite-oubound-proxy -- Using local inbound_uri\n");
$ru = $json(dst_number/inbound_uri);
setflag(${flag_trunk_routing});
t_on_branch("1");
Expand Down Expand Up @@ -112,7 +112,7 @@ route[lookup_src]
end if not ignore_dest_domain

if( $json(src_endpoint/user_force_mp) == "true" ) {
xlog("L_DBG","-- invite-outbound-proxy -- Force MediaProxy for $(json(src_endpoint/endpoint))");
xlog("L_DBG","-- invite-outbound-proxy -- Force MediaProxy for $(json(src_endpoint/endpoint))\n");
setflag(${flag_request_mp_caller}); # force MP for caller
}

Expand Down Expand Up @@ -165,6 +165,6 @@ route[lookup_src]
$avp(dialog_timer) = $json(src_endpoint/dialog_timer);
}

xlog("L_DBG","-- invite-outbound-proxy -- Customer device $(json(src_endpoint)) with account $(avp(account)).");
xlog("L_DBG","-- invite-outbound-proxy -- Customer device $(json(src_endpoint)) with account $(avp(account)).\n");
}
}
2 changes: 1 addition & 1 deletion common/opensips/fragments/invite-router-local.cfg
Expand Up @@ -4,7 +4,7 @@

route[invite_handler]
{
xlog("L_DBG","-- invite-router-local -- $ru");
xlog("L_DBG","-- invite-router-local -- $ru\n");

t_on_failure("1");
t_on_reply("1");
Expand Down
18 changes: 9 additions & 9 deletions common/opensips/fragments/invite-router.cfg
Expand Up @@ -10,15 +10,15 @@ define need_avp_db

route[invite_handler]
{
xlog("L_DBG","-- invite-router -- $ru");
xlog("L_DBG","-- invite-router -- $ru\n");

t_on_failure("1");
t_on_reply("1");

# Attempt to locate the `number_domain` of the calling number,
# assuming it is a local (on-net) number.
if($json(src_endpoint/number_domain)) {
xlog("L_DBG","-- invite-router -- src_number uses (endpoint) number_domain $json(src_endpoint/number_domain)");
xlog("L_DBG","-- invite-router -- src_number uses (endpoint) number_domain $json(src_endpoint/number_domain)\n");
$var(number_domain) = $json(src_endpoint/number_domain);
}

Expand All @@ -38,7 +38,7 @@ route[invite_handler]
if rate_limit
if( $json(src_number/rate_limit) ) {
if(!rl_check( "number_$json(src_number/number)", "$json(src_number/rate_limit)" )) {
xlog("L_DBG","-- invite-router -- Calling Number Rate Limit Exceeded --");
xlog("L_DBG","-- invite-router -- Calling Number Rate Limit Exceeded --\n");

if notify
$avp(event-names) := null;
Expand All @@ -64,7 +64,7 @@ route[invite_handler]
append_to_reply("Retry-After: ${rate_limit_latency}");
sl_send_reply("503","Calling Endpoint Rate Limit Exceeded");

xlog("L_DBG","-- invite-router -- Calling Endpoint Rate Limit Exceeded --");
xlog("L_DBG","-- invite-router -- Calling Endpoint Rate Limit Exceeded --\n");
$avp(event-names) := null;
$avp(event-values) := null;
$avp(event-names) = "event";
Expand All @@ -87,7 +87,7 @@ route[invite_handler]
if($avp(size) > $json(src_number/max_channels)) {
sl_send_reply("503","Calling Number Out-of-Channels");

xlog("L_DBG","-- invite-router -- Calling Number Out-of-Channels --");
xlog("L_DBG","-- invite-router -- Calling Number Out-of-Channels --\n");
$avp(event-names) := null;
$avp(event-values) := null;
$avp(event-names) = "event";
Expand All @@ -110,7 +110,7 @@ route[invite_handler]
if($avp(size) > $json(src_endpoint/max_channels)) {
sl_send_reply("503","Calling Endpoint Out-of-Channels");

xlog("L_DBG","-- invite-router -- Calling Endpoint Out-of-Channels --");
xlog("L_DBG","-- invite-router -- Calling Endpoint Out-of-Channels --\n");
$avp(event-names) := null;
$avp(event-values) := null;
$avp(event-names) = "event";
Expand Down Expand Up @@ -188,12 +188,12 @@ route[lookup_src]
end if not ignore_dest_domain

if( $json(src_endpoint/user_force_mp) == "true" ) {
xlog("L_DBG","-- invite-router -- Force MediaProxy for $(json(src_endpoint/endpoint))");
xlog("L_DBG","-- invite-router -- Force MediaProxy for $(json(src_endpoint/endpoint))\n");
setflag(${flag_request_mp_caller}); # force MP for caller
}

if( $json(src_endpoint/check_from) == "true" ) {
xlog("L_DBG","-- invite-router -- Checking From username");
xlog("L_DBG","-- invite-router -- Checking From username\n");
if( $json(src_number/endpoint) != $json(src_endpoint/endpoint) ) {
t_reply("403", "From Username is not listed");
exit;
Expand Down Expand Up @@ -222,6 +222,6 @@ route[lookup_src]
$avp(dialog_timer) = $json(src_endpoint/dialog_timer);
}

xlog("L_DBG","-- invite-router -- Customer device $(json(src_endpoint)) with account $(avp(account)).");
xlog("L_DBG","-- invite-router -- Customer device $(json(src_endpoint)) with account $(avp(account)).\n");
}
}
12 changes: 6 additions & 6 deletions common/opensips/fragments/invite-trunk-drouting.cfg
Expand Up @@ -9,7 +9,7 @@ define use_drouting

route[invite_trunk_drouting]
{
xlog("L_DBG","-- route(invite_trunk_drouting)");
xlog("L_DBG","-- route(invite_trunk_drouting)\n");

$var(original_ru) = $ru;

Expand Down Expand Up @@ -81,7 +81,7 @@ route[invite_trunk_drouting]
force_send_socket(${internal_ip});
end if internal_ip

xlog("L_DBG","-- route(invite_trunk_drouting): do_routing was successful: $ru");
xlog("L_DBG","-- route(invite_trunk_drouting): do_routing was successful: $ru\n");
setflag(${flag_trunk_routing});
t_on_branch("1");
route(trunk_attributes);
Expand All @@ -97,14 +97,14 @@ route[invite_trunk_drouting]

route[trunk_attributes]
{
xlog("L_DBG","-- route(trunk_attributes)");
xlog("L_DBG","-- route(trunk_attributes)\n");
if($json(dr_rule_attrs/force_mp)) {
xlog("L_DBG","-- route(trunk_attributes) -- forcing MediaProxy for route");
xlog("L_DBG","-- route(trunk_attributes) -- forcing MediaProxy for route\n");
setflag(${flag_request_mp_callee}); # force MP for callee
}
if not skip_uac_auth
# Per-provider authentication
xlog("L_DBG","-- route(trunk_attributes) -- gathering authentication");
xlog("L_DBG","-- route(trunk_attributes) -- gathering authentication\n");
$avp(uac_realm) = $json(dr_gw_attrs/realm);
$avp(uac_username) = $json(dr_gw_attrs/username);
$avp(uac_password) = $json(dr_gw_attrs/password);
Expand All @@ -114,5 +114,5 @@ route[trunk_attributes]

branch_route[1]
{
xlog("L_DBG","-- branch_route(1) Processing $rm $ru");
xlog("L_DBG","-- branch_route(1) Processing $rm $ru\n");
}

0 comments on commit a7a85a7

Please sign in to comment.