[OpenSIPS-Users] CDRTool rating engine callcontrole prepaid Need advice

Ilya Pichugin i.pichugin at ptl.ru
Tue Dec 1 13:09:44 CET 2009


 I found my mistake - it was necessary to tune  my e164_class.
 And now debiting is OK.. but!

 Why function call_control() always return 1 retcode, even there is
 balance <=0 (No credit)?

 I cannot understand..


 Syslog:
 Dec  1 14:47:32 cdrtool call-control[7107]: Call id MDY2YjZlZTc0YzA4OTUwMjhlNTNmY2IwOGRlZmRhMzU. of 3097998 at a.x.y to sip:3364000 at a.x.y forbidden because credit is too low

 Dec  1 15:06:16 cdrtool /usr/local/opensips16/sbin/opensips[9386]: Call has limit and is under callcontrol management RETCODE is 1


OpenSIPS code is:


if (method=="INVITE" && nat_uac_test("2"))
{                                         
        xlog("L_INFO", "record route section | INVITE & nat test: M=$rm
RURI=$ru F=$fU T=$tu IP=$si\n");
        call_control();
        xlog("CALL_CONTROL");
        switch ($retcode) {  
    case 2:
        xlog("Call with no limit RETCODE is $retcode ");
    case 1:
        xlog("Call has limit and is under callcontrol management RETCODE is $retcode \n");
        break;
    case -1:  
        xlog("Not enough credit (prepaid call) RETCODE is $retcode ");
        sl_send_reply("402", "Not enough credit");
        exit;
        break;
    case -2:  
        xlog("Locked by another call in progress (prepaid call)");
        sl_send_reply("403", "Call locked by another call in progress");
        exit;
        break; 
 


> Hi All!

> I've installed subject applications. I'm trying to test prepaid calls
> but it's no successful

> Why does rating engine always return 'postpaid not limited'?

mysql>> select * from prepaid;
> +----+-------------+-------------------------+----------+---------------------+-----------------+-----------------+
> | id | reseller_id | account                 | balance  |
> change_date         | active_sessions | session_counter |
> +----+-------------+-------------------------+----------+---------------------+-----------------+-----------------+
> |  1 |           0 | 3097998 at a.x.y           | -32.6667 |
> 2009-11-27 18:01:43 | null            |               0 |


> I tried to force debit balance (telnet ip 9024), but call_control() on
> each INVITE returnes '+1' and in syslog I see 'postpaid not limited'

> And if I call MaxSessionTime, rating engine returne 'none'

> Nov 30 12:07:25 cdrtool call-control[2230]: Call id
> MDRjZmQ2ZGI5MDFlYzJiMmIyNDgwNjI5Y2FmMTk2YTc. of 3097998 at a.x.y to sip:3364000 at a.x.y is postpaid not
> limited

> I have enabled quota-based accounts but it does not work ;-(

mysql>> select id,datasource,account,domain,quota,blocked,calls,duration,cost,traffic,change_date from quota_usage;
> +----+-----------------+-------------------------+-----------------+-------+---------+-------+----------+----------+---------+---------------------+
> | id | datasource      | account                 | domain         
> | quota | blocked | calls | duration | cost     | traffic | change_date         |
> +----+-----------------+-------------------------+-----------------+-------+---------+-------+----------+----------+---------+---------------------+
> |  4 | opensips_radius | 3097998 at a.x.y           | a.x.y          
> |    10 | 1       |    23 |       91 | 658.3667 | 0       | 2009-11-30 12:49:53 |
> +----+-----------------+-------------------------+-----------------+-------+---------+-------+----------+----------+---------+---------------------+
> 2 rows in set (0.00 sec)

> Where is my mistake?

> I hope for your help


> --------------- 

> Ilya Pichugin



---------------

Ilya Pichugin






More information about the Users mailing list