<!--
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
When querying Kamailio 5.1 for statistics via JSON, we get back a string like this (shortened):
```
kamailio:~# curl -X POST -d '{ "jsonrpc": "2.0", "method": "stats.get_statistics", "params": ["all"],"id": 1 }' http://172.20.21.3:15060/jsonrpc
{
"jsonrpc": "2.0",
"result": ["core:bad_URIs_rcvd = 0", "core:bad_msg_hdr = 0", "core:drop_replies = 0", "core:drop_requests = 4", "core:err_replies = 0", "core:err_requests = 0", "core:fwd_replies = 2252", "core:fwd_requests = 16153", "core:rcv_replies = 393994", "core:rcv_replies_18x = 0"],
"id": 1
}
```
We want to graph some of the values returned by the statistics module. But the format makes it a bit hard. I would expect the format to be like this:
```
{
"jsonrpc": "2.0",
"result": {"core:bad_URIs_rcvd" : 0, "core:bad_msg_hdr" : 0, "core:drop_replies" : 0, "core:drop_requests" : 4, "core:err_replies" : 0, "core:err_requests" : 0, "core:fwd_replies" : 2252, "core:fwd_requests" : 16153, "core:rcv_replies" : 393994, "core:rcv_replies_18x" : 0},
"id": 1
}
```
With a result like this, one could access the result["core:bad_URIs_rcvd"] item. The way it is returned now, one has to iterate through all values and to a string comparison for the desired item.
Is there a reason, why the output is as it is?
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.1.4 (x86_64/linux)
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: unknown
compiled with gcc 4.7.2
```
* **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`)
-->
```
Debian Wheezy Linux hostname 3.2.0-5-amd64 #1 SMP Debian 3.2.96-3 x86_64 GNU/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/1595
Module: kamailio
Branch: master
Commit: 9c7f22a2df8ac5469cee82a7fd94d87029fc5046
URL: https://github.com/kamailio/kamailio/commit/9c7f22a2df8ac5469cee82a7fd94d87…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2018-07-16T14:17:04+02:00
modules: readme files regenerated - kex ... [skip ci]
---
Modified: src/modules/kex/README
---
Diff: https://github.com/kamailio/kamailio/commit/9c7f22a2df8ac5469cee82a7fd94d87…
Patch: https://github.com/kamailio/kamailio/commit/9c7f22a2df8ac5469cee82a7fd94d87…
---
diff --git a/src/modules/kex/README b/src/modules/kex/README
index cd61ff61a9..8012752527 100644
--- a/src/modules/kex/README
+++ b/src/modules/kex/README
@@ -633,6 +633,11 @@ kamcmd core.modules
Print the list of available internal statistics.
+ NOTE: the result is an array of strings that have the list of
+ statistics formated like "name = value", being propagated over the time
+ from the MI variant. Use "stats.fetch" command to have a more
+ JSON-friendly output.
+
Parameters: statsid - which statistics to be printed. If set to 'all'
then all statistics are printed; if set to 'statsgroup:' then all
statistics in the group are printed; if set to 'statsname' then the
Module: kamailio
Branch: master
Commit: 1cad8353e3fc04b2b8486fd490b57591a2cc0a9a
URL: https://github.com/kamailio/kamailio/commit/1cad8353e3fc04b2b8486fd490b5759…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-07-16T14:03:43+02:00
kex: docs - note about stats.fetch in the section for stats.get_statistics
---
Modified: src/modules/kex/doc/kex_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/1cad8353e3fc04b2b8486fd490b5759…
Patch: https://github.com/kamailio/kamailio/commit/1cad8353e3fc04b2b8486fd490b5759…
---
diff --git a/src/modules/kex/doc/kex_admin.xml b/src/modules/kex/doc/kex_admin.xml
index 8fe4e84ba8..b55bfa4be4 100644
--- a/src/modules/kex/doc/kex_admin.xml
+++ b/src/modules/kex/doc/kex_admin.xml
@@ -735,11 +735,15 @@ resetdebug();
<function moreinfo="none">stats.get_statistics</function>
</title>
<para>Print the list of available internal statistics.</para>
+ <para>NOTE: the result is an array of strings that have the list of
+ statistics formated like "name = value", being propagated over the time
+ from the MI variant. Use "stats.fetch" command to have a more
+ JSON-friendly output.</para>
<para>Parameters: <emphasis>statsid</emphasis> - which statistics to
- be printed. If set to 'all' then all statistics are printed; if
- set to 'statsgroup:' then all statistics in the group are printed;
- if set to 'statsname' then the statistics identified by the name
- is printed.</para>
+ be printed. If set to 'all' then all statistics are printed; if
+ set to 'statsgroup:' then all statistics in the group are printed;
+ if set to 'statsname' then the statistics identified by the name
+ is printed.</para>
<para>Examples:</para>
<programlisting format="linespecific">
&kamcmd; stats.get_statistics all
@@ -757,11 +761,11 @@ resetdebug();
structure: {"statsgroup.statsname" : "statsvalue"}. The value is
represented as string to accomodate large numbers.</para>
<para>Parameters: <emphasis>statsid</emphasis> - which statistics to
- be printed. If set to 'all' then all statistics are printed; if
- set to 'statsgroup:' then all statistics in the group are printed;
- if set to 'statsname' then the statistics identified by the name
- is printed (can be also 'statsgroup.stastname' or
- 'statsgroup:statsname').</para>
+ be printed. If set to 'all' then all statistics are printed; if
+ set to 'statsgroup:' then all statistics in the group are printed;
+ if set to 'statsname' then the statistics identified by the name
+ is printed (can be also 'statsgroup.stastname' or
+ 'statsgroup:statsname').</para>
<para>Examples:</para>
<programlisting format="linespecific">
&kamcmd; stats.fetch all
While trying the following code with sdp content-length of 2978 : -
$var(telephone-event) = $(avp(sdp){re.subst,/.*a=rtpmap:([0-9]+) telephone-event.*/\1/s});
kamailio -v
version: kamailio 5.1.4 (x86_64/linux)
got the following errors: -
ERROR: textops [txt_var.c:80]: tr_txt_eval_re(): PV value too big 2978, increase buffer size
ERROR: <core> [core/lvalue.c:346]: lval_pvar_assign(): non existing right pvar
ERROR: <core> [core/lvalue.c:404]: lval_assign(): assignment failed at pos: (424,27-424,91)
ERROR: <script>: telephone-event: 0
This is due to the fixed size of 2048 modules/textops/txt_var.c at line 48 : -
'''#define TR_TXT_BUF_SIZE 2048
static char tr_txt_buf[TR_TXT_BUF_SIZE];'''
Please can anybody check..
--
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/1592
### Description
A certain inbound provider does not return ACK R-URI as an exact copy of contact. A parameter is appended to it, like below:
200 OK Contact:
`Contact: <sip:35.197.205.XXX:5060;line=sr-N6IAzJd4WxFLWxVlz.jwWB0yM.y7MlV7zGZlMlvuMx3A>`
ACK R-URI:
`ACK sip:35.197.205.XXX:5060;line=sr-N6IAzJd4WxFLWxVlz.jwWB0yM.y7MlV7zGZlMlvuMx3A;user=phone SIP/2.0`
As you can see, the `user=phone` is appended along with `line=` put by topoh.
### Troubleshooting
#### Reproduction
I am not sure how this can be reproductible. I've put the URI with and without `user=phone` part in a small C app that calls kamailio's `parse_params` function and both resolved to one and two params, as expected, so the problem must come from `parse_uri`.
See the debug logs below that show the difference between a "good" ACK and a "bad" ACK. `topoh` doesn't get its `line=` param, so it doesn't perform the `Contact` header rewrite. The ACK does not match a dialog/transaction and it is forwarded to itself (from internal IP to external IP, this being a kamailio behind NAT, but that's not the problem).
#### Debugging Data
#### Log Messages
This is the "good" call, with ACK R-URI identical to Contact header. See the "+decoded" line:
```
13(40) DEBUG: topoh [topoh_mod.c:249]: th_prepare_msg(): no second via in this message
13(40) DEBUG: <core> [core/parser/parse_addr_spec.c:185]: parse_to_param(): add param: tag=as496aacd0
13(40) DEBUG: <core> [core/parser/parse_addr_spec.c:864]: parse_addr_spec(): end of header reached, state=29
13(40) DEBUG: topoh [th_msg.c:1165]: th_route_direction(): ftag match
13(40) DEBUG: topoh [th_msg.c:763]: th_unmask_ruri(): +decoded: 34: [sip:+441274957XXX@10.32.2.133:5060]
13(40) DEBUG: topoh [topoh_mod.c:358]: th_msg_received(): adding cookie: dc
13(40) DEBUG: topoh [th_msg.c:997]: th_add_hdr_cookie(): added cookie header [TH: dch
```
This is the "bad" call, with ACK R-URI having a `user=phone` param appended to original Contact contents:
```
10(37) DEBUG: topoh [topoh_mod.c:249]: th_prepare_msg(): no second via in this message
10(37) DEBUG: <core> [core/parser/parse_addr_spec.c:185]: parse_to_param(): add param: tag=3735986184-753647
10(37) DEBUG: <core> [core/parser/parse_addr_spec.c:864]: parse_addr_spec(): end of header reached, state=29
10(37) DEBUG: topoh [th_msg.c:1165]: th_route_direction(): ftag match
10(37) DEBUG: <core> [core/parser/parse_param.c:580]: parse_params2(): empty uri params, skipping
10(37) DEBUG: topoh [topoh_mod.c:358]: th_msg_received(): adding cookie: dc
10(37) DEBUG: topoh [th_msg.c:997]: th_add_hdr_cookie(): added cookie header [TH: dch
```
#### SIP Traffic
```
U 2018/05/21 10:22:53.206320 35.197.205.XXX:5060 -> 88.215.58.YYY:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 88.215.58.YYY:5060;rport=5060;branch=z9hG4bK469d20c71c138e366475cd537dc0c68b.
Record-Route: <sip:35.197.205.XXX;lr;ftag=3735908572-610467;vsf=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7dXNlcj1waG9uZQ--;vst=AAAAAAAAAAAAAAAAAAAAAAAACQgAAQMbFhsLHTE1OjUwNjA7dXNlcj1waG9uZQ--;did=f17.b7f>.
From: <sip:+16098378XXX@88.215.58.YYY;user=phone>;tag=3735908572-610467.
To: <sip:+441242395XXX@88.215.58.YYY:5060;user=phone>;tag=as3147fc45.
Call-ID: 5577511-3735908572-610459(a)MSX163.XXX.com.
CSeq: 1 INVITE.
Server: Asterisk PBX 1.8.28-cert5.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.
Supported: replaces.
Contact: <sip:35.197.205.XXX:5060;line=sr-N6IAzJd4WxFLWxVlz.jwWB0yM.y7MlV7zGZlMlvuMx3A>.
Content-Type: application/sdp.
Content-Length: 259.
.
v=0.
o=root 1611167628 1611167628 IN IP4 35.197.206.251.
s=Asterisk PBX 1.8.28-cert5.
c=IN IP4 35.197.206.251.
t=0 0.
m=audio 10948 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=sendrecv.
a=rtcp:10949.
U 2018/05/21 10:22:53.206827 88.215.58.YYY:5060 -> 35.197.205.XXX:5060
ACK sip:35.197.205.XXX:5060;line=sr-N6IAzJd4WxFLWxVlz.jwWB0yM.y7MlV7zGZlMlvuMx3A;user=phone SIP/2.0.
Max-Forwards: 68.
Route: <sip:35.197.205.XXX;lr;ftag=3735908572-610467;vsf=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7dXNlcj1waG9uZQ--;vst=AAAAAAAAAAAAAAAAAAAAAAAACQgAAQMbFhsLHTE1OjUwNjA7dXNlcj1waG9uZQ--;did=f17.b7f>.
To: <sip:+441242395XXX@88.215.58.YYY:5060;user=phone>;tag=as3147fc45.
From: <sip:+16098378XXX@88.215.58.YYY;user=phone>;tag=3735908572-610467.
Call-ID: 5577511-3735908572-610459(a)MSX163.XXX.com.
CSeq: 1 ACK.
Allow: PUBLISH,MESSAGE,UPDATE,SUBSCRIBE,REFER,INFO,NOTIFY,OPTIONS,BYE,INVITE,ACK,CANCEL.
Via: SIP/2.0/UDP 88.215.58.15:5060;branch=z9hG4bK6c862e8111736dc6d7d22479393d1f2d.
Contact: <sip:+16098378YYY@88.215.58.YYY:5060>.
Content-Length: 0.
```
### Possible Solutions
Changed the provider to avoid downtime, but the `empty uri params, skipping` error from `parse_params2` is strange, considering that we do not have a single param but 2.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.0.4 (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 5.4.0
```
* **Operating System**:
```
Linux gke-lon-1-sbc-in-082a7447-9rll 4.13.0-1011-gcp #15-Ubuntu SMP Mon Feb 12 16:29:04 UTC 2018 x86_64 x86_64 x86_64 GNU/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/1541