### Description
In following configuration :
UA -> KAMALIO PROXY -> REGISTRAR
In case if REGISTRAR answer 404 on first REGISTER kamailio just ignore it and reply not passed to onreply_route. ie 404 just dropped and not passed to UA. In case if REGISTRAR answer 401 on first REGISTER kamailio works like it have to be.
Grepped example :
``` 77.77.77.77 - UA 88.88.88.88 - Kamailio 10.34.64.2 - registrar
U 2020/04/02 10:47:02.345372 77.77.77.77:5060 -> 88.88.88.88:7060 #26887 REGISTER sip:proxy.domain.com:7060 SIP/2.0. Via: SIP/2.0/UDP 10.32.0.9:5060;branch=z9hG4bK4153798595. From: "999100044" sip:999100044@proxy.domain.com:7060;tag=3123330837. To: "999100044" sip:999100044@proxy.domain.com:7060. Call-ID: 2_912627073@10.32.0.9. CSeq: 1 REGISTER. Contact: sip:999100044@10.32.0.9:5060. Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE. Max-Forwards: 70. User-Agent: Yealink SIP-T46G 28.81.188.7 001565b577b2. Expires: 3600. Allow-Events: talk,hold,conference,refer,check-sync. Content-Length: 0. ..
U 2020/04/02 10:47:04.289850 88.88.88.88:7060 -> 10.34.64.2:5060 #26888 REGISTER sip:proxy.domain.com:7060 SIP/2.0. Record-Route: sip:88.88.88.88:7060;lr. Via: SIP/2.0/UDP 88.88.88.88:7060;branch=z9hG4bK0636.d927d7e86ebc02302d9ad6ae7d778817.0. Via: SIP/2.0/UDP 10.32.0.9:5060;received=77.77.77.77;branch=z9hG4bK4153798595. From: "999100044" sip:999100044@proxy.domain.com:7060;tag=3123330837. To: "999100044" sip:999100044@proxy.domain.com:7060. Call-ID: 2_912627073@10.32.0.9. CSeq: 1 REGISTER. Contact: sip:999100044@10.32.0.9:5060. Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE, REFER, PUBLISH, UPDATE, MESSAGE. Max-Forwards: 69. User-Agent: Yealink SIP-T46G 28.81.188.7 001565b577b2. Expires: 3600. Allow-Events: talk,hold,conference,refer,check-sync. Content-Length: 0. Path: sip:88.88.88.88:7060;lr;received=sip:77.77.77.77:5060. Supported: path. ..
U 2020/04/02 10:47:04.290295 10.34.64.2:5060 -> 88.88.88.88:7060 #26889 SIP/2.0 404 Not Found. Via: SIP/2.0/UDP 88.88.88.88:7060;branch=z9hG4bK0636.d927d7e86ebc02302d9ad6ae7d778817.0. Via: SIP/2.0/UDP 10.32.0.9:5060;received=77.77.77.77;branch=z9hG4bK4153798595. From: "999100044" sip:999100044@proxy.domain.com:7060;tag=3123330837. To: "999100044" sip:999100044@proxy.domain.com:7060;tag=1598650872. Call-ID: 2_912627073@10.32.0.9. CSeq: 1 REGISTER. Content-Length: 0. Date: Thu, 02 Apr 2020 10:47:03 GMT. Warning: Not maintaining bindings for domain. .. ```
### Troubleshooting
After checking RFC 3261 i found that ``` 5. The registrar extracts the address-of-record from the To header field of the request. If the address-of-record is not valid for the domain in the Request-URI, the registrar MUST send a 404 (Not Found) response and skip the remaining steps. ```
#### Reproduction following schema : UA -> KAMALIO PROXY -> REGISTRAR
modules related to issue: in kamailio.cfg
loadmodule "tm.so" loadmodule "tmx.so" loadmodule "sl.so" loadmodule "rr.so" loadmodule "db_mysql" loadmodule "domain" loadmodule "outbound" loadmodule "path"
simple conception route config which illustrate issue : ``` 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"); } }
route[FORWARD] { if(t_relay() == false) { sl_reply_error(); }
drop; }
onreply_route { xlog("Reply SIP message from $si:$sp\n"); if (t_check_trans() == false) { drop; } } ```
#### Debugging Data
#### Log Messages
``` Apr 2 11:05:26 fsinnosbc /usr/sbin/kamailio[16037]: INFO: {1 1 REGISTER 2_1386563412@10.32.0.9} <script>: RR simple Apr 2 11:05:26 fsinnosbc /usr/sbin/kamailio[16037]: INFO: {1 1 REGISTER 2_1386563412@10.32.0.9} <script>: GOT REGISTER Apr 2 11:05:26 fsinnosbc /usr/sbin/kamailio[16037]: INFO: {1 1 REGISTER 2_1386563412@10.32.0.9} <script>: Initial relay packet ```
#### SIP Traffic
<!-- If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` (paste your sip traffic here) ```
### Possible Solutions
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.3.3 (x86_64/linux) flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: unknown compiled with gcc 8.3.0 ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` root@fsinnosbc:~# lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster root@fsinnosbc:~# ```
`false` is an alias to `0`, but the return code of functions is different.
Use `if(!function())` to test for its `false` meaning or `if(function())` for its `true` meaning. See core cookbook in the wiki for more details about the return code interpretation.
If you have more questions, write email to sr-users@lists.kamailio.org, that's the forum to discuss about using kamailio. The tracker here is used to report only bugs to source code. If it proves to be something related to code, it can be reopened, but now it seems to be a config issue.
Closed #2271.
Did even read the issue ?
Apparently I did it if I saw the wrong use of true and false. The config is not built as it should, so it is nothing that can be troubleshooted.
Ok i ll recreate example like you want.
Have in mind that kamailio is not dropping replies internally if the Via stack is correct and no explicit drop or module function that triggers drop is used. I am even right working on a system were routing of negative responses for REGISTER are just routed fine.
As I said, use the mailing list for further discussions.
Issue i reported is about that kamailio don`t relay 404 from upstream on 1st REGISTER.
``` route[FORWARD] { t_on_failure("FAILROUTE"); if(!t_relay()) { sl_reply_error(); }
drop; }
```
Have exactly same behavior reported. I still sure that this is a bug.
As Daniel already replied you, SIP replies are handled in reply routes based on Via. You are posting a request route snippet which doesn't handle at all replies. Please do what has been asked to you, write on the users mailing list and there people will tell you if it is a bug or not.
On Thu, Apr 2, 2020 at 1:57 PM jpVm5jYYRE1VIKL notifications@github.com wrote:
Issue i reported is about that kamailio don`t relay 404 from upstream on 1st REGISTER.
route[FORWARD] { t_on_failure("FAILROUTE"); if(!t_relay()) { sl_reply_error(); }
drop;
}
Have exactly same behavior reported. I still sure that this is a bug.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kamailio/kamailio/issues/2271#issuecomment-607800804, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4KTY25D4AIXLZTUDUAJE3RKR4SZANCNFSM4L2FVCCA .