<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please
use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on
sr-users mailing list:
*
https://lists.kamailio.org/mailman3/postorius/lists/sr-users.lists.kamailio…
If you have questions about developing extensions to Kamailio or its existing C code, ask
on sr-dev mailing list:
*
https://lists.kamailio.org/mailman3/postorius/lists/sr-dev.lists.kamailio.o…
Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.
Note that an issue report may be closed automatically after about 2 months
if there is no interest from developers or community users on pursuing it, being
considered expired. In such case, it can be reopened by writing a comment that includes
the token `/notexpired`. About two weeks before considered expired, the issue is
marked with the label `stale`, trying to notify the submitter and everyone else
that might be interested in it. To remove the label `stale`, write a comment that
includes the token `/notstale`. Also, any comment postpone the `expire` timeline,
being considered that there is interest in pursuing the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
The uri parser seems to fail in multiple ways on username-parameters. The ways it fails
depends on the presence of user-params in the incoming request and on adjustments to $ru,
$rd and $rU in the script.
My expectation is that the whole username, including user-params is *always* visible in
$rU. In reality, the user-params are absent or present depending on manipulations to the
uri in the script.
When setting $rU to a value with a user-param, that user-param is represented when reading
$ru, but not in $rU.
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
I used below config script to test various scenario's.
```
debug=2
memlog=4
#fork=no # This option should not be present to enable forking but disable daemonize,
also -D commandline parameter is needed
log_stderror=yes
log_name="kamailio-test"
log_facility=LOG_LOCAL5
sip_warning=no
children=2
shm_mem_size=128
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
dns_use_search_list=no
use_dns_failover=yes
dns_srv_lb=yes
disable_tcp=yes
auto_aliases=no
listen=172.16.1.19:7060
loadmodule "sl.so"
loadmodule "pv.so"
loadmodule "xlog.so"
modparam("xlog", "prefix", "")
route {
xnotice("Incoming $rm to $rU\n");
xinfo("$$ru = $ru\n");
switch ($rU) {
case "100":
xnotice("Set $$rU = \"1234;first=yes\"\n");
$rU = "1234;first=yes";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
if ($rU != "1234;first=yes") {
xerr("Fail!\n");
} else {
xinfo("Success!\n");
}
break;
case "200":
xnotice("Set $$rd = \"example.com;transport=udp\"\n");
$rd = "example.com;transport=udp";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
xnotice("Set $$rU = \"1234;first=yes\"\n");
$rU = "1234;first=yes";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
if ($rU != "1234;first=yes") {
xerr("Fail!\n");
} else {
xinfo("Success!\n");
}
break;
case "300":
xnotice("Set $$ru = \"sip:1234@example.com;transport=udp\"\n");
$ru = "sip:1234@example.com;transport=udp";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
xnotice("Set $$rU = \"1234;first=yes\"\n");
$rU = "1234;first=yes";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
if ($rU != "1234;first=yes") {
xerr("Fail!\n");
} else {
xinfo("Success!\n");
}
break;
case "400":
xnotice("Set $$ru =
\"sip:1234;first=yes@example.com;transport=udp\"\n");
$ru = "sip:1234;first=yes@example.com;transport=udp";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
if ($rU != "1234;first=yes") {
xerr("Fail!\n");
} else {
xinfo("Success!\n");
}
xnotice("Set $$rU = \"1234;second=yes\"\n");
$rU = "1234;second=yes";
xinfo("$$ru: $ru\n");
xinfo("$$rU: $rU\n");
if ($rU != "1234;second=yes") {
xerr("Fail!\n");
} else {
xinfo("Success!\n");
}
break;
}
sl_send_reply(500, "Done");
exit;
}
```
Outputs:
---
```
1(2206122) NOTICE: Incoming INVITE to 100
1(2206122) INFO: $ru = sip:100@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $rU = "1234;first=yes"
1(2206122) INFO: $ru: sip:1234;first=yes@172.16.1.19:7060;user=phone
1(2206122) INFO: $rU: 1234
1(2206122) ERROR: Fail!
```
Setting $rU with a user-param sets it correctly in $ru, but reading $rU back fails.
---
```
1(2206122) NOTICE: Incoming INVITE to 200
1(2206122) INFO: $ru = sip:200@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $rd = "example.com;transport=udp"
1(2206122) INFO: $ru: sip:200@example.com;transport=udp:7060;user=phone
1(2206122) INFO: $rU: 200
1(2206122) NOTICE: Set $rU = "1234;first=yes"
1(2206122) INFO: $ru: sip:1234;first=yes@example.com;transport=udp:7060;user=phone
1(2206122) INFO: $rU: 1234
1(2206122) ERROR: Fail!
```
Same when setting $rd in advance.
---
```
1(2206122) NOTICE: Incoming INVITE to 300
1(2206122) INFO: $ru = sip:300@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $ru = "sip:1234@example.com;transport=udp"
1(2206122) INFO: $ru: sip:1234@example.com;transport=udp
1(2206122) INFO: $rU: 1234
1(2206122) NOTICE: Set $rU = "1234;first=yes"
1(2206122) INFO: $ru: sip:1234;first=yes@example.com;transport=udp
1(2206122) INFO: $rU: 1234;first=yes
1(2206122) INFO: Success!
```
When setting $ru first with no user-param lets a later asssignment to $rU with user-param
succeed.
---
```
1(2206122) NOTICE: Incoming INVITE to 400
1(2206122) INFO: $ru = sip:400@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $ru = "sip:1234;first=yes@example.com;transport=udp"
1(2206122) INFO: $ru: sip:1234;first=yes@example.com;transport=udp
1(2206122) INFO: $rU: 1234;first=yes
1(2206122) INFO: Success!
1(2206122) NOTICE: Set $rU = "1234;second=yes"
1(2206122) INFO: $ru: sip:1234;second=yes@example.com;transport=udp
1(2206122) INFO: $rU: 1234;second=yes
1(2206122) INFO: Success!
```
Setting $ru with a user-params succeeds. Subsequently overwriting the user part with $rU
with a user-param also succeeds.
---
```
1(2206122) NOTICE: Incoming INVITE to 400
1(2206122) INFO: $ru = sip:400;existing=yes@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $ru = "sip:1234;first=yes@example.com;transport=udp"
1(2206122) INFO: $ru: sip:1234;first=yes@example.com;transport=udp
1(2206122) INFO: $rU: 1234;first=yes
1(2206122) INFO: Success!
1(2206122) NOTICE: Set $rU = "1234;second=yes"
1(2206122) INFO: $ru: sip:1234;second=yes@example.com;transport=udp
1(2206122) INFO: $rU: 1234;second=yes
1(2206122) INFO: Success!
```
Same as previous, but with incoming user-param.
---
```
1(2206122) NOTICE: Incoming INVITE to 100
1(2206122) INFO: $ru = sip:100;existing=yes@172.16.1.19:7060;user=phone
1(2206122) NOTICE: Set $rU = "1234;first=yes"
1(2206122) INFO: $ru: sip:1234;first=yes;existing=yes@172.16.1.19:7060;user=phone
1(2206122) INFO: $rU: 1234
1(2206122) ERROR: Fail!
```
This one fails in an interesting way. The incoming uri has a user-param. When overwriting
$rU with a user-param, the user-param from the incoming request is kept in addition to the
new one instead of being overwritten. $rU still misses (both) user-params.
#### Debugging Data
I have no build (yet) with EXTRA_DEBUG enabled.
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3762
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3762(a)github.com>