[sr-dev] [kamailio/kamailio] Matching uri == myself fails when request uri has parameter (#2482)

Daniel-Constantin Mierla notifications at github.com
Tue Sep 22 17:42:21 CEST 2020


While initially I misunderstood what you reported, it still is a matter of the configuration file, either setting r-uri host part to null via uri2tel or other operations, so here I spent some time to prove it.

Next is the diff to master branch default config file:

```
diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index e31d112839..5031062247 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -502,6 +502,11 @@ modparam("debugger", "log_level_name", "exec")
  * - note: this is the same as route { ... } */
 request_route {

+       if(uri==myself) {
+               xinfo("r-uri is myself: $ru\n");
+       } else {
+               xinfo("r-uri is not myself: $ru\n");
+       }
        # per request initial checks
        route(REQINIT);
```

I run kamailio (master and 5.3 branches) in source code folder with:

```
./src/kamailio -w . -f etc/kamailio.cfg -L src/modules/ -a no -n 2 -E -e -dd
```

Then shoot an OPTIONS with sipsak and all is fine (note in the middle the INFO log message printed by the diff added above to default config, no other errors):


```
$ sipsak -vvv -p 127.0.0.1 -s "sip:+4930303030openrcs.com;user=phone"
fqdnhostname: 192.168.188.20
warning: need raw socket (root privileges) to receive all ICMP errors
our Via-Line: Via: SIP/2.0/UDP 192.168.188.20:63827;branch=z9hG4bK.44f4a309;rport;alias

New message with Via-Line:
OPTIONS sip:+4930303030openrcs.com;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.188.20:63827;branch=z9hG4bK.44f4a309;rport;alias
From: sip:sipsak at 192.168.188.20:63827;tag=72dc047d
To: sip:+4930303030openrcs.com;user=phone
Call-ID: 1927021693 at 192.168.188.20
CSeq: 1 OPTIONS
Contact: sip:sipsak at 192.168.188.20:63827
Content-Length: 0
Max-Forwards: 70
User-Agent: sipsak 0.9.7pre
Accept: text/plain



request:
OPTIONS sip:+4930303030openrcs.com;user=phone SIP/2.0
Via: SIP/2.0/UDP 192.168.188.20:63827;branch=z9hG4bK.44f4a309;rport;alias
From: sip:sipsak at 192.168.188.20:63827;tag=72dc047d
To: sip:+4930303030openrcs.com;user=phone
Call-ID: 1927021693 at 192.168.188.20
CSeq: 1 OPTIONS
Contact: sip:sipsak at 192.168.188.20:63827
Content-Length: 0
Max-Forwards: 70
User-Agent: sipsak 0.9.7pre
Accept: text/plain


send to: UDP:127.0.0.1:5060

 1(71486) INFO: {1 1 OPTIONS 1927021693 at 192.168.188.20} <script>: r-uri is not myself: sip:+4930303030openrcs.com;user=phone

message received
received from: UDP:127.0.0.1:5060
SIP/2.0 403 Not relaying
Via: SIP/2.0/UDP 192.168.188.20:63827;branch=z9hG4bK.44f4a309;rport=56671;alias;received=127.0.0.1
From: sip:sipsak at 192.168.188.20:63827;tag=72dc047d
To: sip:+4930303030openrcs.com;user=phone;tag=9dd61ff61e802d8e2bef5f14621ef3c2.76a5bc12
Call-ID: 1927021693 at 192.168.188.20
CSeq: 1 OPTIONS
Server: kamailio (5.5.0-dev2 (x86_64/darwin))
Content-Length: 0



** reply received after 7.553 ms **
   SIP/2.0 403 Not relaying
   final received
```

So again, it should be specific to your config.

If one wants to silent log errors when using functions that require host part in the uri with values without host, then is another scope, it should be an enhancement at least controlled by a parameter, because such errors are useful to alert when one does wrong config operations.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2482#issuecomment-696804344
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200922/695c9020/attachment.htm>


More information about the sr-dev mailing list