Module: kamailio
Branch: master
Commit: 77bf2478893bb935e0ca09d93df75b404417d3bd
URL: https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-01-21T19:49:47+01:00
core: select - added function to print select for error purposes
---
Modified: src/core/select.c
Modified: src/core/select.h
---
Diff: https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
Patch: https://github.com/kamailio/kamailio/commit/77bf2478893bb935e0ca09d93df75b4…
---
diff --git a/src/core/select.c b/src/core/select.c
index 1bf1e6a..bf3e567 100644
--- a/src/core/select.c
+++ b/src/core/select.c
@@ -428,18 +428,28 @@ int run_select(str* res, select_t* s, struct sip_msg* msg)
return ret;
}
-void print_select(select_t* s)
+void log_select(select_t* s, int level)
{
int i;
- DBG("select(");
+ LOG(level, "select(");
for(i = 0; i < s->n; i++) {
if (s->params[i].type == SEL_PARAM_INT) {
- DBG("%d,", s->params[i].v.i);
+ LOG(level, "%d,", s->params[i].v.i);
} else {
- DBG("%.*s,", s->params[i].v.s.len, s->params[i].v.s.s);
+ LOG(level, "%.*s,", s->params[i].v.s.len, s->params[i].v.s.s);
}
}
- DBG(")\n");
+ LOG(level, ")\n");
+}
+
+void print_select(select_t* s)
+{
+ log_select(s, L_DBG);
+}
+
+void err_select(select_t* s)
+{
+ log_select(s, L_ERR);
}
int register_select_table(select_row_t* mod_tab)
diff --git a/src/core/select.h b/src/core/select.h
index 5d639d6..74c68e4 100644
--- a/src/core/select.h
+++ b/src/core/select.h
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@@ -26,7 +26,7 @@
* Module: \ref core
*/
-
+
#ifndef _SELECT_H
#define _SELECT_H
@@ -36,7 +36,7 @@
#define MAX_SELECT_PARAMS 32
#define MAX_NESTED_CALLS 4
-/* Flags for parser table FLAG bitfiels
+/* Flags for parser table FLAG bitfiels
*/
#define DIVERSION_MASK 0x00FF
@@ -75,12 +75,12 @@
/* left function is noted to be called
* rigth function continues in resolution
- * NOTE: the parameter is not consumed for PARENT,
+ * NOTE: the parameter is not consumed for PARENT,
* so you can leave it as ..,SEL_PARAM_INT, 0,..
*
* run_select then calls all functions with PARENT flag
- * in the order of resolution until the final call or
- * the result is != 0 (<0 error, 1 null str)
+ * in the order of resolution until the final call or
+ * the result is != 0 (<0 error, 1 null str)
* the only one parameter passed between nested calls
* is the result str*
*/
@@ -102,13 +102,13 @@ typedef enum {
SEL_PARAM_DIV, /* Integer value got from parsing table */
SEL_PARAM_PTR /* void* data got from e.g. fixup call */
} select_param_type_t;
-
+
typedef union {
int i; /* Integer value */
str s; /* String value */
void* p;/* Any data ptr */
} select_param_value_t;
-
+
typedef struct sel_param {
select_param_type_t type;
select_param_value_t v;
@@ -164,11 +164,16 @@ int resolve_select(select_t* s);
int run_select(str* res, select_t* s, struct sip_msg* msg);
/*
- * Print select for debugging purposes
+ * Print select for debugging purposes
*/
void print_select(select_t* s);
/*
+ * Print select for error purposes
+ */
+void err_select(select_t* s);
+
+/*
* Register modules' own select parser table
*/
int register_select_table(select_row_t *table);
@@ -191,7 +196,7 @@ int parse_select (char** p, select_t** s);
void free_select(select_t *s);
/*
* Select parser, result is stored in SHARED memory
- *
+ *
* If you call this, you must ensure, that the string which
* is beeing parsed MUST be at the same place for all child
* processes, e.g. allocated in the shared memory as well
<!--
-->
### Description
The 200OK reply to SUBSCRIBE on IPv6 has the Contact header
wrong formatted, it's appear as:
Contact: <sip:2222:0:0:0:0:0:0:55:4060;transport=udp>
instead of
Contact: <sip:[2222:0:0:0:0:0:0:55]:4060;transport=udp>
<!--
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
<!--
-->
```
(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
UBSCRIBE sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org SIP/2.0
Via: SIP/2.0/UDP [2221::5]:4060;branch=z9hG4bK-5-0-95675325205398405120;rport
From: <sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org>;tag=5-0-63373794482729304064
To: <sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org>
Call-ID: callid-5-0-cnt-2-23363871231378927616
Contact: <sip:+393498786882@[2221::5]:4060>;expires=80
Max-Forwards: 70
User-Agent: SIPv3 UeSIM LTE - vtrunk_C
Allow: INVITE,ACK,BYE,CANCEL,NOTIFY,MESSAGE,OPTIONS,PRACK,UPDATE,REFER
Expires: 80
Proxy-Authorization: Digest username="+393498786882(a)ims.mnc021.mcc292.3gppnetwork.org",
realm="ims.mnc021.mcc292.3gppnetwork.org",
algorithm=MD5,
nonce="WIIsT1iCKyMEfQy/SmMqSl2b4P4n2vR7",
uri="sip:ims.mnc021.mcc292.3gppnetwork.org",
response="4e39c2ab34e4009dca083e4cbd2acebc",
cnonce="59159616548176674082335766872064",
qop=auth,
nc=00000001
Event: presence.winfo
Allow-Events: reg, presence, presence.winfo
Privacy: none
Accept: application/watcherinfo+xml
CSeq: 76585 SUBSCRIBE
Organization: Sent by UAC Transaction Layer
Content-Length: 0
SIP/2.0 200 OK
Via: SIP/2.0/UDP [2221::5]:4060;branch=z9hG4bK-5-0-95675325205398405120;rport=4060;received=2221:0:0:0:0:0:0:5
From: <sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org>;tag=5-0-63373794482729304064
To: <sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org>;tag=be7ce37c4413768ae7f9747982106912-651e
Call-ID: callid-5-0-cnt-2-23363871231378927616
CSeq: 76585 SUBSCRIBE
Expires: 80
Contact: <sip:2222:0:0:0:0:0:0:55:4060;transport=udp>
Server: kamailio (4.4.5 (x86_64/linux))
Content-Length: 0
Warning: 392 [2222:0:0:0:0:0:0:55]:4060 "Noisy feedback tells: pid=27504 req_src_ip=2221:0:0:0:0:0:0:5 req_src_port=4060 in_uri=sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org out_uri=sip:+393498786882@ims.mnc021.mcc292.3gppnetwork.org via_cnt==1"
<!--
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`
version: kamailio 4.4.5 (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 4.9.2
```
(paste your output here)
```
* **Operating System**:
Distributor ID: Debian
Description: Debian GNU/Linux 8.7 (jessie)
Release: 8.7
Codename: jessie
<!--
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/943