<!-- 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:
* http://lists.kamailio.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.kamailio.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 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
Using xmlrpc command to generate the bye using terminate_dlg request:
<!-- Explain what you did, what you expected to happen, and what actually happened. -->
### Troubleshooting
#### Reproduction
use xmlrpc request to terminate the dialog ``` curl --data @xmlrpc http://13.57.122.212:8080/RPC ``` xmlrpc file will have following things ``` <?xml version="1.0"?> <methodCall> <methodName>dlg.terminate_dlg</methodName> <params> <param><value><string>fe6361a2-52f0-1237-e5a2-06119108e458</string></value></param> <param><value><string>07322vj6a8taa</string></value></param> <param><value><string>gK09f669d8</string></value></param> </params> </methodCall> ``` <!-- 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. -->
``` (paste your debugging data here) ```
#### 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). -->
``` (paste your log messages here) ```
#### 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). -->
``` **Bye message without xmlrpc** BYE sip:gw+plivo.com@13.57.90.158:5080;transport=tcp;transport=tcp;gw=plivo.com;alias=13.57.90.158~49325~2 SIP/2.0. Record-Route: sip:13.57.122.212;lr;ftag=gK07d4ffc2. Record-Route: sip:18.214.109.132:5060;lr;ftag=gK07d4ffc2. Via: SIP/2.0/UDP 13.57.122.212:5060;branch=z9hG4bK154c.8fa2a8729a68989c41230f0906bcd2bd.0. Via: SIP/2.0/UDP 18.214.109.132:5060;rport=5060;branch=z9hG4bK154c.44759fe4.0. Via: SIP/2.0/UDP 81.52.176.68:5060;branch=z9hG4bK07Badb05d2bebab0ac9. From: sip:+919967609476@81.52.176.68;tag=gK07d4ffc2. To: "919967609476" sip:+919967609476@54.183.206.134;tag=5SDBNUapcZv5m. Call-ID: 237f21f0-52db-1237-e5a2-06119108e458. CSeq: 29061 BYE. Max-Forwards: 68. Route: sip:54.183.206.134:5060;r2=on;lr;ftag=5SDBNUapcZv5m;nat=yes. Route: sip:54.183.206.134:5060;transport=tcp;r2=on;lr;ftag=5SDBNUapcZv5m;nat=yes. Reason: Q.850;cause=16. Content-Length: 0. ..
**Bye message using xmlrpc request** U 172.31.4.160:5060 -> 54.183.206.134:5060 BYE sip:gw+plivo.com@13.57.90.158:5080;transport=tcp;transport=tcp;gw=plivo.com SIP/2.0. Via: SIP/2.0/UDP 13.57.122.212:5060;branch=z9hG4bK7841.79765615000000000000000000000000.0. To: sip:suren1002170622114516@54.183.206.134;tag=Hv494Z9D8D9rH. From: sip:919967609476@54.183.206.134;tag=gK0cf13bdd. CSeq: 1 BYE. Call-ID: 56783745-52ef-1237-e5a2-06119108e458. Route: sip:54.183.206.134:5060;r2=on;lr;ftag=Hv494Z9D8D9rH;nat=yes, sip:54.183.206.134;transport=tcp;r2=on;lr;ftag=Hv494Z9D8D9rH;nat=yes. Content-Length: 0. User-Agent: kamailio (5.1.4 (x86_64/linux)). Max-Forwards: 70. .. ```
### 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`
``` root@ip-172-31-4-160:/etc/kamailio# kamailio -version version: kamailio 5.1.4 (x86_64/linux) 6ebfda flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, 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 ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 6ebfda compiled on 11:48:26 Sep 7 2018 with gcc 4.8.4 ```
* **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@ip-172-31-4-160:/etc/kamailio# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS Release: 14.04 Codename: trusty
root@ip-172-31-4-160:/etc/kamailio# uname -a Linux ip-172-31-4-160 3.13.0-143-generic #192-Ubuntu SMP Tue Feb 27 10:45:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux ```
Can you list the IP addresses of the nodes involved in the call and their role, as well as which is the one running kamailio with dialog?
13.57.90.158:49325 ====== 54.183.206.134:5060 [kamailio] <==BYE== 13.57.122.212:5060 [kamailio] ===BYE===> 18.214.109.132:5060 [kamailio]
13.57.122.212 generating the bye to both side.
BYE is not getting forwarded from 54.183.206.134 to 13.57.90.158 as request uri do not contain the alias. Its trying to forward the request to 13.57.90.158:5080 not to 13.57.90.158:49325
Can you reproduce the scenario and look into the dialog structure for such call, either with a rpc command or in the database dialog table, and see what are the values for contact fields?
yes, i can reproduce this again. for sure , i will paste the dialog structure here.
<?xml version="1.0"?> <methodResponse> <params> <param> <value><struct><member><name>h_entry</name><value><int>2084</int></value></member><member><name>h_id</name><value><int>7721</int></value></member><member><name>call-id</name><value><string>ab2248af-53e9-1237-dfaf-06119108e458</string></value></member><member><name>from_uri</name><value><string>sip:suren1002170622114516@54.183.206.134</string></value></member><member><name>to_uri</name><value><string>sip:919967609476@54.183.206.134</string></value></member><member><name>state</name><value><int>4</int></value></member><member><name>start_ts</name><value><int>1540576147</int></value></member><member><name>init_ts</name><value><int>1540576137</int></value></member><member><name>timeout</name><value><int>1540619347</int></value></member><member><name>lifetime</name><value><int>43200</int></value></member><member><name>dflags</name><value><int>643</int></value></member><member><name>sflags</name><value><int>0</int></value></member><member><name>iflags</name><value><int>0</int></value></member><member><name>caller</name><value><struct><member><name>tag</name><value><string>7pNv5Kt36jm2j</string></value></member><member><name>contact</name><value><string>sip:gw+plivo.com@13.57.90.158:5080;transport=tcp;transport=tcp;gw=plivo.com;alias=13.57.90.158~50188~2</string></value></member><member><name>cseq</name><value><string>129951879</string></value></member><member><name>route_set</name><value><string><sip:54.183.206.134:5060;r2=on;lr;ftag=7pNv5Kt36jm2j;nat=yes>,<sip:54.183.206.134;transport=tcp;r2=on;lr;ftag=7pNv5Kt36jm2j;nat=yes></string></value></member><member><name>socket</name><value><string>udp:172.31.4.160:5060</string></value></member></struct></value></member><member><name>callee</name><value><struct><member><name>tag</name><value><string>gK09a0497e</string></value></member><member><name>contact</name><value><string>sip:+919967609476@81.52.176.68:5060</string></value></member><member><name>cseq</name><value><string>0</string></value></member><member><name>route_set</name><value><string><sip:18.214.109.132:5060;lr;ftag=7pNv5Kt36jm2j></string></value></member><member><name>socket</name><value><string>udp:172.31.4.160:5060</string></value></member></struct></value></member><member><name>profiles</name><value><array><data> </data></array></value></member><member><name>variables</name><value><array><data> <value><struct><member><name>call_answer_time</name><value><string>1540576147</string></value></member></struct></value><value><struct><member><name>call_ring_time</name><value><string>1540576145</string></value></member></struct></value><value><struct><member><name>carrier_id</name><value><string>737</string></value></member></struct></value><value><struct><member><name>carrier_uri</name><value><string>sip:+919967609476@81.52.176.68</string></value></member></struct></value><value><struct><member><name>dest_codecs</name><value><string>PCMA,telephone-event/8000</string></value></member></struct></value><value><struct><member><name>direction</name><value><string>outbound</string></value></member></struct></value><value><struct><member><name>cust_transport_protocol</name><value><string>udp</string></value></member></struct></value><value><struct><member><name>call_start_time</name><value><string>1540576137</string></value></member></struct></value><value><struct><member><name>dest_number</name><value><string>919967609476</string></value></member></struct></value><value><struct><member><name>call_uuid</name><value><string>71705c36-8942-41f2-a832-860550a73166</string></value></member></struct></value><value><struct><member><name>account_id</name><value><string>27298</string></value></member></struct></value><value><struct><member><name>src_codecs</name><value><string>PCMU,PCMA,telephone-event/8000</string></value></member></struct></value></data></array></value></member></struct> </value> </param> </params>
<member>contact</name><value><string>sip:gw+plivo.com@13.57.90.158:5080;transport=tcp;transport=tcp;gw=plivo.com;alias=13.57.90.158~50188~2</string></value></member>
The alias parameter of Contact should be handled internally by kamailio only if there is no Route set, but it is not the case here. I will look at the code.
i just checked the code and found that https://github.com/kamailio/kamailio/blob/98ee25c6da118cadedd98621c580ed4df3... ``` if(uri_restore_rcv_alias(&cell->contact[dir], &nuri, &duri)<0) { nuri.len = 0; duri.len = 0; }
``` This function is setting nuri, that is subsequently used as request uri. Problem here is nuri does not contains the alias parameters in uri.
While traveling earlier today I made the patch pushed with the commit referenced above. I saw you made a pull request as well, but I decided to push mine because it avoids few extra assignments that are no longer necessary. If still an issue with the above patch, reopen.
Closed #1689.