### Description
Hi. Seems lime that after WSS in the VIA kamailio adds double SPACE
It makes kamailio incompatable with jssip.net (tried 5.1.2 and 5.0.6 versions)
Looks like this happens with advertise address added on the interface
#### Reproduction
Just connect to kamailio via WSS with advertized address and try to make incoming call into WSS client
#### Debugging Data
I just put this link to JsSIP.net here
https://groups.google.com/forum/#!topic/jssip/2lDyqgvZgrY
Also here is a string of my VIA header that gives issue
SIP/2.0/WSS 1.2.3.4:5061;branch=z9hG4bKd302.4c862421515641e7b59b9f3ba7f8eab4.1
Thant can be checked here
https://www.textmagic.com/free-tools/unicode-detector
Log INVITE from the browser (only added \r\n at the end of the each string because of notepad++ not shows it after copying):
INVITE sip:2hsq8ob4@daotd6p7hil4.invalid;transport=ws SIP/2.0\r\n
Record-Route: <sip:1.2.3.4:5061;transport=ws;r2=on;lr;ftag=as7c4d457d;nat=yes>\r\n
Record-Route: <sip:1.2.3.4;r2=on;lr;ftag=as7c4d457d;nat=yes>\r\n
Via: SIP/2.0/WSS 1.2.3.4:5061;branch=z9hG4bK110e.476a7e8aa7db8de3a4d7b01aed1e7ef5.1\r\n
Via: SIP/2.0/UDP 10.1.1.138:5060;rport=5060;branch=z9hG4bK7122bcfb\r\n
Max-Forwards: 69\r\n
From: "test" <sip:test@10.1.1.138>;tag=as7c4d457d\r\n
To: <sip:test2@10.1.1.38:5060>\r\n
Contact: <sip:test@10.1.1.138:5060>\r\n
Call-ID: 2ec6d77f5a56ca0f59ab0d2118d2f7d5@10.1.1.138:5060\r\n
CSeq: 102 INVITE\r\n
User-Agent: Asterisk PBX 15.3.0\r\n
Date: Mon, 02 Apr 2018 10:30:57 GMT\r\n
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\n
Supported: replaces, timer\r\n
Content-Type: application/sdp\r\n
Content-Length: 642\r\n
\r\n
v=0\r\n
o=root 1538180518 1538180518 IN IP4 1.2.3.4\r\n
s=Asterisk PBX 15.3.0\r\n
c=IN IP4 1.2.3.4\r\n
t=0 0\r\n
a=group:BUNDLE audio\r\n
m=audio 31858 RTP/SAVPF 8 0 101\r\n
a=maxptime:150\r\n
a=rtpmap:8 PCMA/8000\r\n
a=rtpmap:0 PCMU/8000\r\n
a=rtpmap:101 telephone-event/8000\r\n
a=fmtp:101 0-16\r\n
a=sendrecv\r\n
a=rtcp:31859\r\n
a=rtcp-mux\r\n
a=setup:actpass\r\n
a=mid:audio\r\n
a=fingerprint:sha-1 95:6F:40:F2:76:B3:E3:1E:DA:29:04:60:F1:F7:0A:DA:5E:D4:67:9F\r\n
a=ice-ufrag:eSuU9ztd\r\n
a=ice-pwd:j693abw9QWiaX81TlbvyHBD8FU\r\n
a=candidate:5Qp8pvPCHLmm6iUU 1 UDP 2130706431 1.2.3.4 31858 typ host\r\n
a=candidate:5Qp8pvPCHLmm6iUU 2 UDP 2130706430 1.2.3.4 31859 typ host\r\n
Actually i did not found any information about is it MUST be only one sace at the Grammar of SIP message based on RFC 2234 but I may be wrong.
```
#### 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`
```
(paste your output here)
```
* **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`)
-->
```
(paste your output here)
```
--
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/1491
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests.
If you have questions about using Kamailio or related to its configuration file,
ask on sr-users mailing list:
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing
C code, ask on sr-dev mailing list
* http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the
developers to troubleshoot the issue.
If you submit a feature request (or enhancement), you can delete the text of
the template and only add the description of what you would like to be added.
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
Hi all,
i’m using kamailio 4.4.6 , and when I call the rpc dialog “profile_list_dlgs” , sometimes I have a segmentation fault.
Can you help me to understand why it happened ?
Thanks for your support
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### Debugging Data
<!--
If you got a core dump, use gdb to extract troubleshooting data - full backtrace,
local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile
bt full
info locals
list
If you are familiar with gdb, feel free to attach more of what you consider to
be relevant.
-->
```
This is the dump:
Program terminated with signal 11, Segmentation fault.
#0 0x00007f49ee062e07 in internal_rpc_print_dlg (rpc=0x7f49ed99e9c0, c=0x7f49ed99e960, dlg=0x7f49ef89ba38, with_context=0) at dialog.c:1548
1548 if (pl->profile->has_value) {
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-57.el6.x86_64 libcom_err-1.41.12-22.el6.x86_64 libselinux-2.0.94-7.el6.x86_64 libxml2-2.7.6-21.el6_8.1.x86_64 lua-5.1.4-4.1.el6.x86_64 mysql-libs-5.1.73-7.el6.x86_64 nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64 openssl-1.0.1e-48.el6_8.3.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt full
#0 0x00007f49ee062e07 in internal_rpc_print_dlg (rpc=0x7f49ed99e9c0, c=0x7f49ed99e960, dlg=0x7f49ef89ba38, with_context=0) at dialog.c:1548
rpc_cb = {rpc = 0x3031ea0, c = 0x400}
h = 0x2d21e60
sh = 0x2d1db70
ssh = 0x2d20050
pl = 0x7f49ef18c588
var = 0x0
__FUNCTION__ = "internal_rpc_print_dlg"
#1 0x00007f49ee0637b3 in internal_rpc_profile_print_dlgs (rpc=0x7f49ed99e9c0, c=0x7f49ed99e960, profile_name=0x7fff65fcb1a0, value=0x0)
at dialog.c:1681
profile = 0x7f49ee5aca88
ph = 0x7f49eeb5b670
i = 2
#2 0x00007f49ee063e64 in rpc_profile_print_dlgs (rpc=0x7f49ed99e9c0, c=0x7f49ed99e960) at dialog.c:1785
profile_name = {s = 0x3031e80 "outbound", len = 8}
value = {s = 0x0, len = 0}
#3 0x00007f49ed78960f in jsonrpc_dispatch (msg=0x7fff65fcc5a0, s1=0x0, s2=0x0) at jsonrpc-s_mod.c:1098
rpce = 0x7f4a13212d30
ctx = 0x7f49ed99e960
ret = 0
nj = 0x3031ab0
val = {s = 0x3032030 "dlg.profile_list", len = 16}
__FUNCTION__ = "jsonrpc_dispatch"
#4 0x000000000041f75d in do_action (h=0x7fff65fcc4c0, a=0x7f4a13189e28, msg=0x7fff65fcc5a0) at action.c:1054
```
#### Log Messages
<!--
Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site).
-->
```
the result to the commands p *pl and p *pl->profile
#0 0x00007f49ee062e07 in internal_rpc_print_dlg (rpc=0x7f49ed99e9c0, c=0x7f49ed99e960, dlg=0x7f49ef89ba38, with_context=0) at dialog.c:1548
1548 if (pl->profile->has_value) {
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.192.el6.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-57.el6.x86_64 libcom_err-1.41.12-22.el6.x86_64 libselinux-2.0.94-7.el6.x86_64 libxml2-2.7.6-21.el6_8.1.x86_64 lua-5.1.4-4.1.el6.x86_64 mysql-libs-5.1.73-7.el6.x86_64 nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64 openssl-1.0.1e-48.el6_8.3.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) p *pl
$1 = {hash_linker = {value = {s = 0x113ef180024 <Address 0x113ef180024 out of bounds>, len = -277948848}, dlg = 0x7f49ef18c5b8,
puid = "\n\000\000\000-5a9\303\305\030\357I\177\000\000S\000\000\000\060\062\060\063in_routing\000CR=6@", puid_len = 1598313555,
expires = 3977578104333875508, flags = 876097589, linker = 0x422d30263936313d, next = 0x3d50542c36343d4f, prev = 0x52542c3634303730,
hash = 1028345429}, next = 0x50542c36343d4f42, profile = 0x542c36343037303d}
(gdb) p *pl->profile
Cannot access memory at address 0x542c36343037303d
```
#### 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`
```
(paste your output here)
```
* **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`)
-->
```
(paste your output here)
```
--
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/1482