Re: [sr-dev] [kamailio/kamailio] cfgt: wrong route name if onsend_route is not declared at the beginning (#1536)

2018-06-07 Thread Victor Seva
```
#!KAMAILIO
#
### Global Parameters #

### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
log_stderror=yes

memdbg=5
memlog=5

log_facility=LOG_LOCAL0
log_stderror=yes
fork=no

/* uncomment the next line to disable TCP (default on) */
disable_tcp=yes

/* uncomment the next line to disable the auto discovery of local aliases
 * based on reverse DNS on IPs (default on) */
auto_aliases=no

/* add local domain aliases */
#alias="sip.mydomain.com"

/* uncomment and configure the following line if you want Kamailio to
 * bind on a specific interface/port/proto (default bind on all available) */
#listen=udp:10.0.0.10:5060

/* port to listen to
 * - can be specified more than once if needed to listen on many ports */
port=5060

# life time of TCP connection when there is no traffic
# - a bit higher than registration expires to cope with UA behind NAT
tcp_connection_lifetime=3605

### Modules Section 

# set paths to location of modules (to sources or installation folders)
mpath="modules"

loadmodule "pv.so"
loadmodule "cfgt.so"
loadmodule "xlog.so"
loadmodule "debugger.so"

# - setting module-specific parameters ---

modparam("cfgt", "basedir", "/log/cfgt")
modparam("cfgt", "mask", 4)

# - debugger params -
modparam("debugger", "cfgtrace", 1)
modparam("debugger", "mod_level_mode", 1)
modparam("debugger", "mod_hash_size", 4)
modparam("debugger", "mod_level", "core=3")
modparam("debugger", "cfgtest", 1)
### Routing Logic 


route[TEST1] {
$var(script_var) = "test1";
}

onsend_route {
xlog("onsend\n");
$var(script_var) = "on_send";
}

reply_route {
xlog("reply\n");
$var(script_var) = "on_reply";
}

route[TEST2] {
$var(script_var) = "test2";
}

# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {
if(status=~"4[0-9][0-9]") {
exit;
}
$var(script_var) = "ini";
route(TEST1);
route(TEST2);
$du = "sip:reply@192.168.106.1";
forward();
exit;
}
```
confirmed:
```
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=86 a=16 n=if
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=86 a=63 n=assign
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=87 a=5 n=route
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[TEST1] 
c=[/etc/kamailio/kamailio.cfg] l=62 a=63 n=assign
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=88 a=5 n=route
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[TEST2] 
c=[/etc/kamailio/kamailio.cfg] l=76 a=63 n=assign
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=89 a=63 n=assign
kamailio_1  | 13(20) ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] 
c=[/etc/kamailio/kamailio.cfg] l=90 a=1 n=forward
kamailio_1  | 13(20) DEBUG:  [core/md5utils.c:67]: MD5StringArray(): MD5 
calculated: 2ba6b842aef10b2968059c36d9581118
kamailio_1  | 13(20) DEBUG:  [core/forward.c:557]: forward_request(): 
Sending:
kamailio_1  | OPTIONS sip:kamailio SIP/2.0
kamailio_1  | Via: SIP/2.0/UDP 
172.19.0.2;branch=z9hG4bK2aec.2ba6b842aef10b2968059c36d9581118.0
kamailio_1  | Via: SIP/2.0/UDP 
172.19.0.3:36095;received=172.19.0.3;branch=z9hG4bK.38e42f28;rport=44285;alias
kamailio_1  | From: sip:sipsak@172.19.0.3:36095;tag=23de4e29
kamailio_1  | To: sip:kamailio
kamailio_1  | Call-ID: 601771561@172.19.0.3
kamailio_1  | CSeq: 1 OPTIONS
kamailio_1  | Contact: sip:sipsak@172.19.0.3:36095
kamailio_1  | Content-Length: 0
kamailio_1  | Max-Forwards: 70
kamailio_1  | User-Agent: sipsak 0.9.7pre
kamailio_1  | Accept: text/plain
kamailio_1  | 
kamailio_1  | .
kamailio_1  | 13(20) DEBUG:  [core/forward.c:558]: forward_request(): 
orig. len=341, new_len=450, proto=1
kamailio_1  | 13(20) ERROR: *** cfgtrace:onsend_route=[TEST1] 
c=[/etc/kamailio/kamailio.cfg] l=66 a=25 n=xlog
kamailio_1  | 13(20) ERROR: 

Re: [sr-dev] [kamailio/kamailio] cfgt: wrong route name if onsend_route is not declared at the beginning (#1536)

2018-06-07 Thread Victor Seva
Closed #1536 via 92f8fdabcffd84e315d749bae8ded3490f8de014.

-- 
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/1536#event-1668855267___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] cfgt: wrong route name if onsend_route is not declared at the beginning (#1536)

2018-05-21 Thread Marco Capetta
kamailio version: kamailio 5.1.2 (x86_64/linux)

If "onsend_route" routing block is defined at the beginning of the kamailio.cfg 
routing part, the name defined in "src/core/cfg.lex" file (DEFAULT_SEND) is 
used when printed in the json files.

Instead, if this routing block is defined in between the configuration, its 
name is changed to the previous defined block.
For example, if the cfg file looks like the following:

route[TEST_1]
{
...
}
onsend_route
{
...
}
route[TEST_2]
{
...
}

then in the output json file, the "onsend_route" block is called TEST_1.


The issue doesn't happen for "request_route" block.

-- 
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/1536___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev