Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cnxcc doesn't update values in redis #1387

Closed
zenichev opened this issue Dec 24, 2017 · 2 comments
Closed

Cnxcc doesn't update values in redis #1387

zenichev opened this issue Dec 24, 2017 · 2 comments

Comments

@zenichev
Copy link
Contributor

zenichev commented Dec 24, 2017

Description

Have a problem with cnxcc call monitoring.
__set_max_credit() allocates new call as expected:

"DEBUG: cnxcc [cnxcc_mod.c:444]: __dialog_created_callback(): Flag is not
set for this message. Ignoring
DEBUG: cnxcc [cnxcc_mod.c:1569]: __set_max_credit(): Setting up new call
for client [2], max-credit[0.100000], cost-per-sec[0.010000], initial-pulse
[6], final-pulse [6],
call-id[2f77fd103d0bfa28718d896876b373fe at b2b.user.agent:50600]
DEBUG: cnxcc [cnxcc_mod.c:1470]: set_ctrl_flag(): Flag set!
DEBUG: cnxcc [cnxcc_redis.c:313]: redis_get_int(): Got INT value:
concurrent_calls=0i
DEBUG: cnxcc [cnxcc_redis.c:68]: redis_get_or_create_credit_data():
credit_data with ID=[2] DOES NOT exist in the cluster, creating it...
DEBUG: cnxcc [cnxcc_redis.c:92]: redis_insert_credit_data(): Inserting
credit_data_t using ID [2]
DEBUG: cnxcc [cnxcc_mod.c:1125]: __get_or_create_credit_data_entry():
Credit entry didn't exist. Allocated new entry [0x7f17668f6d70]
DEBUG: cnxcc [cnxcc_mod.c:1255]: __alloc_new_call_by_money(): New call
allocated for client [2]".

So that I can see values inside redis:
redis.youwillnever.find:6389> HGETALL cnxcc:money:2
 1) "concurrent_calls"
 2) "0"
 3) "consumed_amount"
 4) "0.000000"
 5) "ended_calls_consumed_amount"
 6) "0.000000"
 7) "max_amount"
 8) "0.000000"
 9) "number_of_calls"
10) "1"
11) "type"
12) "1"


But cnxcc doesn't update credit amount during the call.


modparam("debugger", "mod_level", "cnxcc=4") but there are no rows in
kamailio log like:

"DEBUG: cnxcc [cnxcc_check.c:94]: check_calls_by_money(): ec=0.000000,
ca=0.600000, ca2=0.600000
DEBUG: cnxcc [cnxcc_check.c:107]: check_calls_by_money(): Client
[some_client] | Ended-Calls-Credit-Spent: 0.000000  TotalCredit/MaxCredit:
0.600000/3.000000".

cnxcc parameters:
modparam("cnxcc", "dlg_flag", FLG_DLG)
modparam("cnxcc", "redis", "addr=redis.youwillnever.find;port=6389;db=0")
modparam("cnxcc", "credit_check_period", 1)

function that performs credit setup:
if
(!cnxcc_set_max_credit("$var(setid)","$var(credit)","$var(cost_per_sec)","$var(i_pulse)","$var(f_pulse)"))
{
                xlog("L_WARN", "----- cnxcc: $fU - Error setting up credit
control - R=$ru ID=$ci\n");
                sl_send_reply("402", "Payment Required");
        }

Why is it so? And as see, all values are set zero. Seems to be problem with
redis inserts.
Any ideas are highly appreciated. Thanks.

Troubleshooting

Reproduction

Debugging Data

(paste your debugging data here)

Log Messages

(paste your log messages here)

SIP Traffic

(paste your sip traffic here)

Possible Solutions

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 on 17:22:52 Nov 27 2017 with gcc 5.4.0

  • Operating System:
Debian stretch
Linux machine_name_here SMP Tue Dec 5 10:49:06 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@zenichev
Copy link
Contributor Author

Sorry for the delayed response.
Problem is solved by recompiling the cnxcc module.

@miconda
Copy link
Member

miconda commented Feb 16, 2018

Thanks for the update! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants