[OpenSIPS-Users] CDRTool - ShowPrice -> No match for gateway parameter

Dan-Cristian Bogos danb at sms4sip.com
Thu Apr 9 12:41:57 CEST 2009


Hi Adrian,

looks much better now, thank you for so fast reaction.

One thing to comment, while we are here. Not sure what is your policy
regarding accounts, but when using a prepaid account without any realm /
or even in postpaid scenarios, if the UserName contain no domain part,
the following query will hit the database when choosing the customer
profile:
"""
select * from billing_customers
        where subscriber = 'test'
        or domain        = ''
        or gateway       = '10.0.0.1'
        or (subscriber = '' and domain = '' and gateway = '')
        order by subscriber desc, domain desc, gateway desc limit 1
"""

In this case, any predefined rule which has domain empty will match, so
the result will be unexpected (cannot call it a real bug, but close).
Would it be possible to normalize the domain to something "faked.domain"
in case of missing from UserName, or is it against CDRTool internal
architecture?

Thanks again,
DanB

On Thu, 2009-04-09 at 12:17 +0200, Adrian Georgescu wrote:
> Hi Dan,
> 
> 
> I made a fix for this, please test the last version 6.7.7
> 
> 
> Adrian
> 
> On Apr 8, 2009, at 9:26 PM, Dan-Cristian Bogos wrote:
> 
> > More on the subject ...
> > 
> > Just to be sure that I am not doing any mistake, the log of mysql
> > for
> > the same command (ShowPrice             From=sip:123 at example2.com
> > To=sip:0031650222333 at example.com Gateway=10.0.0.1 Duration=59) shows
> > the
> > gateway parameter queried as suspected, faked:
> > 
> > 090408 21:17:22    314 Init DB     cdrtool
> >    314 Query       select * from billing_customers
> >        where subscriber = '123 at example2.com'
> >        or domain        = 'example2.com'
> >        or gateway       = '0.0.0.0'
> >        or (subscriber = '' and domain = '' and gateway = '')
> >        order by subscriber desc, domain desc, gateway desc limit 1
> > 
> > 
> > Ta,
> > DanB
> > 
> > On Wed, 2009-04-08 at 17:34 +0200, Dan-Cristian Bogos wrote:
> > > Guys,
> > > 
> > > some strange thing I noticed in the last versions of CDRTool
> > > related to
> > > usage of the Gateway parameter in ShowPrice. Based on logs it
> > > looks like
> > > the gateway parameter is somehow faked (or perhaps wrongly
> > > converted).
> > > 
> > > 1. On ShowPrice commands:
> > > 
> > > * Using default dataset, I have replaced the default entry
> > > (gateway,
> > > domain, subscriber empty) with (gateway=10.0.0.1 , subscriber and
> > > domain
> > > empty). Reloaded the cdrtool from console and executed:
> > > ShowPrice             From=sip:123 at example2.com
> > > To=sip:0031650222333 at example.com Gateway=10.0.0.1 Duration=59
> > > 
> > > The answer was: 
> > > 0
> > > 
> > > In the syslog I could find: 
> > > Apr  8 17:12:54 DellLaptop cdrtool[11081]: ShowPrice
> > > From=sip:123 at example2.com To=sip:0031650222333 at example.com
> > > Gateway=10.0.0.1 Duration=59
> > > Apr  8 17:12:54 DellLaptop cdrtool[11081]: Error: no customer
> > > found in
> > > billing_customers table for billing party=123 at example2.com,
> > > domain=example2.com, gateway=0.0.0.0
> > > 
> > > In the mysql table I have:
> > > 
> > > mysql> select * from billing_customers;
> > > +----+----------+-------------+-------------------+---------------+-------------------+---------------+-------------------+------------------+-----------+--------------+--------------+
> > > | id | gateway  | domain      | subscriber        | profile_name1
> > > |
> > > profile_name1_alt | profile_name2 | profile_name2_alt | timezone
> > > | increment | min_duration | country_code |
> > > +----+----------+-------------+-------------------+---------------+-------------------+---------------+-------------------+------------------+-----------+--------------+--------------+
> > > |  4 | 10.0.0.1 |             |                   | 441
> > >           |
> > > | 442           |                   | Europe/Amsterdam |         0
> > > |
> > > 0 |              | 
> > > |  5 |          | example.com |                   | 441
> > >           |
> > > | 442           |                   | Europe/Amsterdam |         0
> > > |
> > > 0 |              | 
> > > |  6 |          |             | alice at example.com | 441
> > >           |
> > > | 442           |                   | Europe/Amsterdam |         0
> > > |
> > > 0 |              | 
> > > +----+----------+-------------+-------------------+---------------+-------------------+---------------+-------------------+------------------+-----------+--------------+--------------+
> > > 3 rows in set (0.01 sec)
> > > 
> > > 
> > > Ta,
> > > DanB
> > 
> > 
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> > 
> 
> 




More information about the Users mailing list