Hi. Well issue already described there :
https://github.com/kamailio/kamailio/issues/2271
I will be really happy if somebody point me what exactly i have to do to route 404 answer from Registar to UA.
If i understand right, in moment when registrar generate 404 i have to see in log message which generated inside onreply_route[REPLYROUTE]
but in current moment i not see it and 404 not transmitted to UA. And it just silently ignored by Kamailio.
In case if i am right and this is a bug in Kamailio please point me what words i have to use to prove that this is really bug.
In current moment routing config looks like :
request_route {
# per request initial checks route(REQINIT);
route(CATCH_CANCEL);
route(RR_PARSE);
route(REGISTRATION);
xlog("L_INFO", "Initial relay packet\n"); $du = "sip:10.34.64.2:5060";
route(FORWARD);
# update $du to set the destination address for proxying exit; }
route[CATCH_CANCEL] { if (is_method("CANCEL") == true) { if (t_check_trans() == true) { route(FORWARD); } sl_reply("500", "Internal Server Error"); drop; } }
route[RR_PARSE] { if(loose_route() == true ) { xlog("L_INFO", "RR-enforced\n"); append_hf("P-hint: rr-enforced\r\n"); route(FORWARD);
} else { xlog("L_INFO", "RR simple\n"); record_route(); } }
route[REGISTRATION] { if(is_method("REGISTER") == true) { add_path_received(); append_hf("Supported: path\r\n"); xlog("L_INFO", "GOT REGISTER\n"); } }
# Per SIP request initial checks route[REQINIT] { if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") { # silent drop for scanners - uncomment next line if want to reply # sl_send_reply("200", "OK"); exit; }
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
if(is_method("OPTIONS") && uri==myself && $rU==$null) { sl_send_reply("200","Keepalive"); exit; }
if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; } }
route[FORWARD] { t_on_failure("FAILROUTE"); t_on_reply("REPLYROUTE"); if(t_relay() <= 0) { sl_reply_error(); }
drop; }
onreply_route[REPLYROUTE] { xlog("Reply SIP message from $si:$sp\n"); if (t_check_trans() == false) { drop; } }
failure_route[FAILROUTE] { xlog("Reply Fail SIP message from $si:$sp\n");
}
I will be really happy if somebody point me what exactly i have to do
to route 404 answer from Registar to UA
Do exactly this: *nothing*. They'll be route back based on VIA, may be set contact alias for certain status codes, if need be.
Good luck.
On Sat, Apr 4, 2020 at 2:37 AM fuxfwgc4a2i1gr fuxfwgc4a2i1gr@gmail.com wrote:
Hi. Well issue already described there :
https://github.com/kamailio/kamailio/issues/2271
I will be really happy if somebody point me what exactly i have to do to route 404 answer from Registar to UA.
If i understand right, in moment when registrar generate 404 i have to see in log message which generated inside onreply_route[REPLYROUTE]
but in current moment i not see it and 404 not transmitted to UA. And it just silently ignored by Kamailio.
In case if i am right and this is a bug in Kamailio please point me what words i have to use to prove that this is really bug.
In current moment routing config looks like :
request_route {
# per request initial checks route(REQINIT); route(CATCH_CANCEL); route(RR_PARSE); route(REGISTRATION); xlog("L_INFO", "Initial relay packet\n"); $du = "sip:10.34.64.2:5060"; route(FORWARD); # update $du to set the destination address for proxying exit;
}
route[CATCH_CANCEL] { if (is_method("CANCEL") == true) { if (t_check_trans() == true) { route(FORWARD); } sl_reply("500", "Internal Server Error"); drop; } }
route[RR_PARSE] { if(loose_route() == true ) { xlog("L_INFO", "RR-enforced\n"); append_hf("P-hint: rr-enforced\r\n"); route(FORWARD);
} else { xlog("L_INFO", "RR simple\n"); record_route(); }
}
route[REGISTRATION] { if(is_method("REGISTER") == true) { add_path_received(); append_hf("Supported: path\r\n"); xlog("L_INFO", "GOT REGISTER\n"); } }
# Per SIP request initial checks route[REQINIT] { if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") { # silent drop for scanners - uncomment next line if want to reply # sl_send_reply("200", "OK"); exit; }
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; } if(is_method("OPTIONS") && uri==myself && $rU==$null) { sl_send_reply("200","Keepalive"); exit; } if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; }
}
route[FORWARD] { t_on_failure("FAILROUTE"); t_on_reply("REPLYROUTE"); if(t_relay() <= 0) { sl_reply_error(); }
drop;
}
onreply_route[REPLYROUTE] { xlog("Reply SIP message from $si:$sp\n"); if (t_check_trans() == false) { drop; } }
failure_route[FAILROUTE] { xlog("Reply Fail SIP message from $si:$sp\n");
}
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Also, as per Daniel’s advice, don’t use
If( is_method(“CANCEL”)==true )
Just use
If( is_method(“CANCEL”) )
Or negating it:
If( !is_method(“CANCEL”) )
Regards,
David
On Sat, 4 Apr 2020 at 16:59, Sergiu Pojoga pojogas@gmail.com wrote:
I will be really happy if somebody point me what exactly i have to do
to route 404 answer from Registar to UA
Do exactly this: *nothing*. They'll be route back based on VIA, may be set contact alias for certain status codes, if need be.
Good luck.
On Sat, Apr 4, 2020 at 2:37 AM fuxfwgc4a2i1gr fuxfwgc4a2i1gr@gmail.com wrote:
Hi. Well issue already described there :
https://github.com/kamailio/kamailio/issues/2271
I will be really happy if somebody point me what exactly i have to do to route 404 answer from Registar to UA.
If i understand right, in moment when registrar generate 404 i have to see in log message which generated inside onreply_route[REPLYROUTE]
but in current moment i not see it and 404 not transmitted to UA. And it just silently ignored by Kamailio.
In case if i am right and this is a bug in Kamailio please point me what words i have to use to prove that this is really bug.
In current moment routing config looks like :
request_route {
# per request initial checks route(REQINIT); route(CATCH_CANCEL); route(RR_PARSE); route(REGISTRATION); xlog("L_INFO", "Initial relay packet\n"); $du = "sip:10.34.64.2:5060"; route(FORWARD); # update $du to set the destination address for proxying exit;
}
route[CATCH_CANCEL] { if (is_method("CANCEL") == true) { if (t_check_trans() == true) { route(FORWARD); } sl_reply("500", "Internal Server Error"); drop; } }
route[RR_PARSE] { if(loose_route() == true ) { xlog("L_INFO", "RR-enforced\n"); append_hf("P-hint: rr-enforced\r\n"); route(FORWARD);
} else { xlog("L_INFO", "RR simple\n"); record_route(); }
}
route[REGISTRATION] { if(is_method("REGISTER") == true) { add_path_received(); append_hf("Supported: path\r\n"); xlog("L_INFO", "GOT REGISTER\n"); } }
# Per SIP request initial checks route[REQINIT] { if($ua =~ "friendly-scanner|sipcli|VaxSIPUserAgent") { # silent drop for scanners - uncomment next line if want to reply # sl_send_reply("200", "OK"); exit; }
if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; } if(is_method("OPTIONS") && uri==myself && $rU==$null) { sl_send_reply("200","Keepalive"); exit; } if(!sanity_check("1511", "7")) { xlog("Malformed SIP message from $si:$sp\n"); exit; }
}
route[FORWARD] { t_on_failure("FAILROUTE"); t_on_reply("REPLYROUTE"); if(t_relay() <= 0) { sl_reply_error(); }
drop;
}
onreply_route[REPLYROUTE] { xlog("Reply SIP message from $si:$sp\n"); if (t_check_trans() == false) { drop; } }
failure_route[FAILROUTE] { xlog("Reply Fail SIP message from $si:$sp\n");
}
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hi, Thanks for your solution.
I tried to use it from early beginning and this is was a reason why i created bug report on github.
When i start tcpdump on proxy. I see 404 reply from REGISTRAR to Proxy. But not see reply from Proxy to UA.
Look like that Kamailio don`t think that 404 reply is a part of transaction.
Hello,
if the device is behind nat router, you have to do the nat traversal logic, because the Via header will be a private IP address, which cannot be used for routing by Kamailio.
To troubleshoot further, set debug=3 in kamailio.cfg and test again. Grab all log messages printed by kamailio in syslog (there should be a lot with DEBUG:...) and send them here. Also, get the pcap file with sip traffic for such case. It helps seeing what addresses are in the SIP headers.
Moreover, remove all those " == false ", as I said in the github issue, that can be something not giving what you would expect.
Cheers, Daniel
On 05.04.20 07:15, fuxfwgc4a2i1gr wrote:
Hi, Thanks for your solution.
I tried to use it from early beginning and this is was a reason why i created bug report on github.
When i start tcpdump on proxy. I see 404 reply from REGISTRAR to Proxy. But not see reply from Proxy to UA.
Look like that Kamailio don`t think that 404 reply is a part of transaction.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello. Thanks for your reply .
I understand about nat . Am i right that even without nat traversal logic i have to see on proxy itself attempts to connect to private ip addresses ?
But i not see them.
Ok i changed "== false", to "!= true". I prefer to use long condition forms to have better config file readability.
But i am not sure that even my "==false" which in block onreply_route[REPLYROUTE] can influence on something because xlog operator stay before condition and i have to see a least message that packet reached onreply_route .
To make capture i using "ngrep -d any -qt -W byline port 7060" it listen on all interfaces and result exactly same as bug report on github.
I attached debug log from kamailio on system where issue persist. Well i replaced some private information inside it to avoid voip frauders to collect information. But privately i can send original ones if needed.
Affected host does not have firewall configured.
It have two ip addresses(two physical interfaces) . One of them assigned public address, another private (10.34.79.254/20). REGISTRAR in same LAN segment with proxy private ip address.
On 2020-04-05 09:03, Daniel-Constantin Mierla wrote:
Hello,
if the device is behind nat router, you have to do the nat traversal logic, because the Via header will be a private IP address, which cannot be used for routing by Kamailio.
To troubleshoot further, set debug=3 in kamailio.cfg and test again. Grab all log messages printed by kamailio in syslog (there should be a lot with DEBUG:...) and send them here. Also, get the pcap file with sip traffic for such case. It helps seeing what addresses are in the SIP headers.
Moreover, remove all those " == false ", as I said in the github issue, that can be something not giving what you would expect.
Cheers, Daniel
On 05.04.20 07:15, fuxfwgc4a2i1gr wrote:
Hi, Thanks for your solution.
I tried to use it from early beginning and this is was a reason why i created bug report on github.
When i start tcpdump on proxy. I see 404 reply from REGISTRAR to Proxy. But not see reply from Proxy to UA.
Look like that Kamailio don`t think that 404 reply is a part of transaction.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
looking at the log messages, Kamailio is receiving only the REGISTER request, not the reply to it. If you see it on the network, then some system filtering (firewall, conntrack, selinux, ...) is dropping it and is not passed to the application layer.
Can you check if you have any of those tools enabled and having rules to drop packages?
Also, maybe you can send the pcap with such sip traffic so we can check if something is wrong at the ip layer (udp checksum, etc...).
Regarding the conditions, doing "!= true" is not better at all. I understand that you are used to and prefer some specific style, just that kamailio config interpreter is not like the common scripting languages interpreters. It doesn't really have support for "bool" as a type, only evaluation of the code returned by functions is evaluate to true/false for IF conditions, however that is done in a very particular way that negative return codes are considered to be a "false" expression evaluation in IF and positive value is considered to be a "positive" expression evaluation in IF. Comparing with the token 'false' (which is value 0) or token 'true' (which is value 1) is not going to give the results you expect in most of the cases.
Better to stick to if(!function()) or if(!function()), otherwise try to play with <0 or >0 conditions, but careful on how you build the expressions and use surrounding parenthesis.
Look also at KEMI interpreters, there you can use Lua, Python, JS, ... to build the kamailio config routing logic and there you can use a style specific for those languages, see:
* http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/
Cheers, Daniel
On 06.04.20 12:32, fuxfwgc4a2i1gr wrote:
Hello. Thanks for your reply .
I understand about nat . Am i right that even without nat traversal logic i have to see on proxy itself attempts to connect to private ip addresses ?
But i not see them.
Ok i changed "== false", to "!= true". I prefer to use long condition forms to have better config file readability.
But i am not sure that even my "==false" which in block onreply_route[REPLYROUTE] can influence on something because xlog operator stay before condition and i have to see a least message that packet reached onreply_route .
To make capture i using "ngrep -d any -qt -W byline port 7060" it listen on all interfaces and result exactly same as bug report on github.
I attached debug log from kamailio on system where issue persist. Well i replaced some private information inside it to avoid voip frauders to collect information. But privately i can send original ones if needed.
Affected host does not have firewall configured.
It have two ip addresses(two physical interfaces) . One of them assigned public address, another private (10.34.79.254/20). REGISTRAR in same LAN segment with proxy private ip address.
On 2020-04-05 09:03, Daniel-Constantin Mierla wrote:
Hello,
if the device is behind nat router, you have to do the nat traversal logic, because the Via header will be a private IP address, which cannot be used for routing by Kamailio.
To troubleshoot further, set debug=3 in kamailio.cfg and test again. Grab all log messages printed by kamailio in syslog (there should be a lot with DEBUG:...) and send them here. Also, get the pcap file with sip traffic for such case. It helps seeing what addresses are in the SIP headers.
Moreover, remove all those " == false ", as I said in the github issue, that can be something not giving what you would expect.
Cheers, Daniel
On 05.04.20 07:15, fuxfwgc4a2i1gr wrote:
Hi, Thanks for your solution.
I tried to use it from early beginning and this is was a reason why i created bug report on github.
When i start tcpdump on proxy. I see 404 reply from REGISTRAR to Proxy. But not see reply from Proxy to UA.
Look like that Kamailio don`t think that 404 reply is a part of transaction.
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users