Hello all,
I've come across the following issue with topos on Kamailio 5.1.0-rc2.
### Description
Kamailio acts as a proxy for asterisk instances residing in a private IP range. Asterisk's peers are configured with their public IP address or hostname, but asterisk will dispatch requests to them to kamailio instead (because kamailio's IP is set in outboundproxy option in peer definition).
This works fine for INVITEs, but if qualify=yes is set for the peer, asterisk will send out OPTIONs to monitor these peers. If the topos module is loaded, 200 OK replies to these OPTIONs will be malformed when forwarded from kamailio to asterisk (no Via header present). Disabling the topos module will resolve this.
### Troubleshooting
#### Reproduction
Configure a peer in asterisk with outboundproxy option set to kamailio's IP address. Set qualify=yes.
Adjust kamailio's default configuration so that OPTIONs to other hosts besides itself are routed. Change the following section in request_route:
```
if ($rU==$null) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
```
to:
```
if ( ($rU==$null) && !(is_method("OPTIONS")) ) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
# Permit asterisk's monitoring using options
if(is_method("OPTIONS") && uri!=myself) {
route(RELAY);
}
```
Enable and configure the topos module with database.
#### SIP Traffic
asterisk:5060 -> kamailio:5060
```
OPTIONS sip:peer.domain.tld SIP/2.0
Via: SIP/2.0/UDP asterisk:5060;branch=z9hG4bK460330cf;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>
Contact: <sip:asterisk@asterisk:5060>
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
User-Agent: myUA
Date: Sun, 03 Dec 2017 00:39:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
```
kamailio:5060 -> peer:5060
```
OPTIONS sip:peer.domain.tld SIP/2.0
Via: SIP/2.0/UDP kamailio:5060;branch=z9hG4bK460330cf;rport
Max-Forwards: 69
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>
Contact: <sip:asterisk@asterisk:5060>
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
User-Agent: myUA
Date: Sun, 03 Dec 2017 00:39:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
```
peer:5060 -> kamailio:5060
```
SIP/2.0 200 OK
Via: SIP/2.0/UDP kamailio;branch=z9hG4bKda8d.cc03bd2def8ad36e8c43f61ab31a636f.0;received=kamailio;rport=5060
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>;tag=as472874ee
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
Server: myUA
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:peer:5060>
Accept: application/sdp
Content-Length: 0
```
**kamailio:5060 -> asterisk:5060: Missing Via Header**
```
SIP/2.0 200 OK
From: "asterisk" <sip:asterisk@domain.tld>;tag=as690c2406
To: <sip:peer.domain.tld>;tag=as472874ee
Call-ID: 6548f43b2d8740122186bb0c6e72ac78(a)domain.tld
CSeq: 102 OPTIONS
Server: myUA
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:peer:5060>
Accept: application/sdp
Content-Length: 0
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.1.0-rc2 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, 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: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
```
Debian 9.1
```
* **Other pertinent configuration information**:
This kamailio box has several network interfaces. mhomed is not used, instead force_send_socket is called where necessary. I'm mentioning this in case it's what might trigger this issue with topos.
--
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/1350
Hi guys,
We are quite newby about Kamailio and we are trying to use it as a load
balancer. While installing certificates we started having problems.
We use Kamailio (vers. 5.5) deployed on a VM (Ubuntu, 20.04 LTS).
We cannot connect via TLS Kamailio VM with clients or other TCP VM.
Our Kamailio currently exposes only port 5060 in UDP and TCP.
Even doing a port scan on localhost, port 5061, used for the TLS protocol,
is instead closed.
There are 3 things worth noting:
- All ports for all protocols are open on the firewall;
- Before we set the disable_tcp option to "no", the 5060 was only reachable
in UDP;
- Even if you put a non-existent certificate, the system does not return an
error so we cannot understand if the goodness of the certificates affects
the opening of the door. Furthermore, we did not find any different
behavior when switching from crt format (key for the private key) to PEM.
If someone can help us would be very appreciated.
Thank you very much
Here is our tls configuration:
kamailio.cfg
#!define WITH_TLS 1
...
disable_tcp=no
auto_aliases=no
….
loadmodule "sl.so"
loadmodule "tls.so"
...
modparam("tls", "private_key", "/etc/kamailio/key.pem")
modparam("tls", "certificate", "/etc/kamailio/crt.pem")
modparam("tls", "ca_list", "/etc/kamailio/ca.pem")
enable_tls=yes
tls.config
[server:default]
method = TLSv1.2+
verify_certificate = no
require_certificate = no
private_key = /etc/kamailio/kamailio-selfsigned.key
certificate = /etc/kamailio/kamailio-selfsigned.pem
#ca_list = /etc/kamailio/tls/cacert.pem
#crl = /etc/kamailio/tls/crl.pem
[client:default]
#method = TLSv1.2+
verify_certificate = no
require_certificate = no
*Sent with Shift
<https://tryshift.com/?utm_source=SentWithShift&utm_campaign=Sent+with+Shift…>*
Hi all,
I've been recently testing kamailio support for proxy protocol which was
introduced by https://github.com/kamailio/kamailio/issues/1757. As reported
by others, even if kamailio is able to decode the proxy protocol and get
the client's original IP address, it is unable to send SIP messages to the
client which initiated the connection through the HA load balancer (nginx
in my case). After investigation I've found that there is no alias added to
the tcp connection aliases list for the tuple
CLIENT_IP:CLIENT_PORT/LOCAL_KAMAILIO_IP:KAMAILIO_PORT. This means that when
trying to forward a message to the originating client kamailio won't use
the existing connection with the load balancer/proxy but will try to
establish a new connection. The fact is that the function which parses the
proxy header overwrites the dst ip/port of the connection with the
"Destination IP" and "Destination Port" fields of the proxy header (
https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738…
for v2,
https://github.com/kamailio/kamailio/blob/f677dea597db6ceaa66a2755dd6e9e738…
for v1). This fields contain the IP/port of the Load Balancer, not the
kamailio IP/Port, and kamailio will fail to find a tcp connection toward
the client's src IP since the Load Balancer IP is not a kamailio's local
socket.
I think that the destination IP of the connection shouldn't be rewritten
with the load balancer IP, unless I'm missing something.
Hopefully I've been clear enough explaining the issue :)
If you agree with the analysis I can prepare a PR for it.
Have you all a great weekend,
Federico Cabiddu
<!--
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
I noticed in the logs messages similar to errors (in fact, this is INFO level).
<!--
Explain what you did, what you expected to happen, and what actually happened.
-->
### Troubleshooting
#### Reproduction
Retrive **kamailioSIPSummaryOutResponses** statistic
`snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.34352.3.1.1.1.3.4`
And you will see errors in log file.
<!--
If the issue can be reproduced, describe how it can be done.
-->
#### 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).
-->
```
INFO /usr/local/sbin/kamailio[15984]: INFO: snmpstats [utilities.c:116]: get_statistic(): failed to retrieve statistics for local_replies
INFO /usr/local/sbin/kamailio[15984]: INFO: snmpstats [utilities.c:116]: get_statistic(): failed to retrieve statistics for relayed_replies
```
### Possible Solutions
I found part of code
https://github.com/kamailio/kamailio/blob/026119200117d20740cbe4d162a14767f…
and it seems that tm module no longer has `local_replies` and `relayed_replies` statistics.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.4.3 (x86_64/linux)
```
--
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/2865
### Description
dlgs: dlgs_tags_count(): always returns 1 and not count of dialogs.
### Possible Solutions
I guess [ki_dlgs_tags_count](https://github.com/kamailio/kamailio/blob/master/src/mo… should return `ret` instead of 1.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.3.5 (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
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 4.9.2
```
--
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/2884