CDRTool rating engine callcontrole prepaid Need advice

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

CDRTool rating engine callcontrole prepaid Need advice

Ilya Pichugin
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 | [hidden email]           | -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 [hidden email] to sip:[hidden email] 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 | [hidden email]           | 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




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CDRTool rating engine callcontrole prepaid Need advice

Ilya Pichugin

 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 [hidden email] to sip:[hidden email] 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 | [hidden email]           | -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 [hidden email] to sip:[hidden email] 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 | [hidden email]           | 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




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CDRTool rating engine callcontrole prepaid Need advice

Laszlo
Hi,


2009/12/1 Ilya Pichugin <[hidden email]>

 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 [hidden email] to sip:[hidden email] 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


You think it isn't correct  with a negative balance?

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 | [hidden email]           | -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 [hidden email] to sip:[hidden email] 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 | [hidden email]           | 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




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CDRTool rating engine callcontrole prepaid Need advice

Ilya Pichugin
In reply to this post by Ilya Pichugin
Hi!




>You think it isn't correct  with a negative balance?


I think it is correct for me case -1: Not enough credit

Am i wrong?

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

Ilya Pichugin




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CDRTool rating engine callcontrole prepaid Need advice

Dan Pascu
In reply to this post by Ilya Pichugin

On 1 Dec 2009, at 14:09, Ilya Pichugin wrote:

>
> 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..

Because $retcode is the last function's return code and you called  
xlog("CALL_CONTROL"); before the switch statement, so you actually  
test the retcode of xlog.

>
>
> Syslog:
> Dec  1 14:47:32 cdrtool call-control[7107]: Call id  
> MDY2YjZlZTc0YzA4OTUwMjhlNTNmY2IwOGRlZmRhMzU. of [hidden email] to sip:[hidden email]
>  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 | [hidden email]           | -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 [hidden email] to sip:[hidden email]
>>  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 | [hidden email]           | 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
>
>
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


--
Dan




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: CDRTool rating engine callcontrole prepaid Need advice

Ilya Pichugin
Hi Dan!

Thanks a lot! Now it works.

You wrote 2009 г., 1:55:55:

> On 1 Dec 2009, at 14:09, Ilya Pichugin wrote:

>>
>> 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..

> Because $retcode is the last function's return code and you called  
> xlog("CALL_CONTROL"); before the switch statement, so you actually  
> test the retcode of xlog.







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

Ilya Pichugin




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users