Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-07 Thread Daniel-Constantin Mierla
To allow more flexibility, I increased the default number of slots from 10 to 
40. Dialog specific code analysis will be considered in the future.

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


Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-07 Thread Daniel-Constantin Mierla
Closed #1551.

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


Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-01 Thread Daniel-Constantin Mierla
The issue is that the dlg vars are using core pv buffers to copy their value 
before returning it. I assume they do the copy to avoid future race with their 
shared memory location, by cloning in pv buffers.

A quick solution is to increase pv_buffer_slots value:

  * https://www.kamailio.org/wiki/cookbooks/5.1.x/core#pv_buffer_slots.

Must be more than the number of dlg vars you use in the string.

I will think to see if this can be avoided somehow in the dialog module.

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


Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-01 Thread Victor Seva
has something to do with the size of the string
```
#!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 "tm.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "dialog.so"
loadmodule "xlog.so"
loadmodule "debugger.so"

# - setting module-specific parameters ---

modparam("dialog", "dlg_flag", 9)

# - debugger params -
modparam("debugger", "mod_level_mode", 1)
modparam("debugger", "mod_hash_size", 4)
modparam("debugger", "mod_level", "core=3")
modparam("debugger", "mod_level", "xlog=3")

### Routing Logic 


# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {
$dlg_var(cgrCategory) = "internal";
$dlg_var(cgrReqType) = "cgrReqType";
$dlg_var(tenant) = "tenant";
$dlg_var(cgrAccount) = "cgrAccount";
$dlg_var(cgrDestination) = "cgrDestination";
$dlg_var(profile) = "profile";
$dlg_var(source_user) = "source_user";
$dlg_var(account_code) = "account_code";
$dlg_var(billing_cli) = "billing_cli";
$dlg_var(start_ts) = "start_ts";
$dlg_var(reseller_id) = "reseller_id";

xinfo("Send the call to CGRates ci='$ci'");
$var(tmp) = '"event":"CGR_AUTH_REQUEST",
"cgr_category":"$dlg_var(cgrCategory)",
"cgr_reqtype":"$dlg_var(cgrReqType)",
"cgr_tenant":"$dlg_var(tenant)",
"cgr_account":"$dlg_var(cgrAccount)",
"cgr_destination":"$dlg_var(cgrDestination)",
"direction":"$dlg_var(profile)",
"source_user":"$dlg_var(source_user)",
"recording_url":"",
"account_code":"$dlg_var(account_code)",
"billing_cli":"$dlg_var(billing_cli)",
"cgr_setuptime":"$dlg_var(start_ts)",
"reseller_id":"$dlg_var(reseller_id)"';
pv_evalx("$var(msg)", "$var(tmp)");
xinfo("$$var(tmp):'$var(tmp)'\n");
xinfo("$$var(msg):'$var(msg)'\n");
xinfo("\n");

xinfo("Send the call to CGRates ci='$ci'");
$var(tmp) = '"event":"CGR_AUTH_REQUEST",
"cgr_tenant":"$dlg_var(tenant)",
"cgr_account":"$dlg_var(cgrAccount)",
"cgr_destination":"$dlg_var(cgrDestination)",
"direction":"$dlg_var(profile)",
"source_user":"$dlg_var(source_user)",
"recording_url":"",
"account_code":"$dlg_var(account_code)",
"billing_cli":"$dlg_var(billing_cli)",
"cgr_setuptime":"$dlg_var(start_ts)",
"reseller_id":"$dlg_var(reseller_id)"';
pv_evalx("$var(msg)", "$var(tmp)");
xinfo("$$var(tmp):'$var(tmp)'\n");
xinfo("$$var(msg):'$var(msg)'\n");
xinfo("+\n");
}
```

```
| 10(17) DEBUG:  [core/pvapi.c:1103]: pv_parse_format(): format parsed 
OK: [12] items
| 10(17) INFO: 

Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-01 Thread Victor Seva
Try this:
```
#!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 "tm.so"
loadmodule "rr.so"
loadmodule "pv.so"
loadmodule "dialog.so"
loadmodule "xlog.so"
loadmodule "debugger.so"

# - setting module-specific parameters ---

modparam("dialog", "dlg_flag", 9)

# - debugger params -
modparam("debugger", "mod_level_mode", 1)
modparam("debugger", "mod_hash_size", 4)
modparam("debugger", "mod_level", "core=3")
modparam("debugger", "mod_level", "xlog=3")

### Routing Logic 


# Main SIP request routing logic
# - processing of any incoming SIP request starts with this route
# - note: this is the same as route { ... }
request_route {
$dlg_var(cgrCategory) = "internal";
$dlg_var(cgrReqType) = "cgrReqType";
$dlg_var(tenant) = "tenant";
$dlg_var(cgrAccount) = "cgrAccount";
$dlg_var(cgrDestination) = "cgrDestination";
$dlg_var(profile) = "profile";
$dlg_var(source_user) = "source_user";
$dlg_var(account_code) = "account_code";
$dlg_var(billing_cli) = "billing_cli";
$dlg_var(start_ts) = "start_ts";
$dlg_var(reseller_id) = "reseller_id";

xinfo("Send the call to CGRates ci='$ci'");
$var(tmp) = '"event":"CGR_AUTH_REQUEST",
"cgr_category":"$dlg_var(cgrCategory)",
"cgr_reqtype":"$dlg_var(cgrReqType)",
"cgr_tenant":"$dlg_var(tenant)",
"cgr_account":"$dlg_var(cgrAccount)",
"cgr_destination":"$dlg_var(cgrDestination)",
"direction":"$dlg_var(profile)",
"source_user":"$dlg_var(source_user)",
"recording_url":"",
"account_code":"$dlg_var(account_code)",
"billing_cli":"$dlg_var(billing_cli)",
"cgr_setuptime":"$dlg_var(start_ts)",
"reseller_id":"$dlg_var(reseller_id)"';
pv_evalx("$var(msg)", "$var(tmp)");
xinfo("$$var(tmp):'$var(tmp)'\n");
xinfo("$$var(msg):'$var(msg)'\n");
xinfo("\n");
}
```

```
|9(15) INFO: 

Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-06-01 Thread Daniel-Constantin Mierla
This seems to be something specific for your environment. I tested with:

```
$var(fmt) = '{"srcip": "$si", "rcvip": "$Ri"}';
pv_evalx("$var(msg)", "$var(fmt)");
xlog(" fmt: $var(fmt)\n");
xlog(" msg: $var(msg)\n");
```

And I got:

```
2(4083) ERROR: 

Re: [sr-dev] [kamailio/kamailio] pv_evalx result in destination pv seems wrong (#1551)

2018-05-31 Thread Victor Seva
log with debug enabled
```
May 31 15:31:48 PBX-2117 kamailio[43398]: INFO: