[Freeswitch-users] mod_lcr problem

Mouncif Benniane mouncifbb at gmail.com
Sat Jan 30 13:38:22 PST 2010


  NPANXX,"LATA","OCN","NTER","INTRA"  201007,"224","7229","0.0059","0.0127"
201040,"224","9206","0.0036","0.0036"
FreeSWITCH Version 1.0.trunk (16540)


Also I noticed the *npa_nxx_ocn* table never get consulted.

I also see this now when making a real call instead of running thorugh CLI

EXECUTE sofia/external/6179472456 at 174.x.x.x lcr(16179470890 NANPA_STD)
2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1230 *intrastate channel var is
[undef]*
2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1233 Select routes based on
interstate rates
2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1252 LCR Lookup on 16179470893
using profile NANPA_STD
2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:786 intra routing [state:0
lata:0] so rate field is [rate]

called number 6179470890  caller ID: 6179472456

any ideas??




On Sat, Jan 30, 2010 at 10:02 AM, Rupa Schomaker <rupa at rupa.com> wrote:

> Something is still missing from the logs. Note the query of the npanxx
> table, the flags being set, and the rate field being chosen.  Umm..
> oh, what version of fs are you running?
>
> Yes, the npa_nxx_ocn table needs to be loaded up as described in:
>
> http://wiki.freeswitch.org/wiki/Mod_cidlookup#Falling_back_to_.22City_State.22_in_the_absense_of_a_name
> (there is a link to that from mod_lcr's wiki page).
>
> An example from my own setup:
>
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:1384 data passed to lcr
> is [12148267711 default 12148267712]
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:1420 Set Caller ID to
> [12148267712]
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:759 SQL: SELECT 'state',
> count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=214 AND
> nxx=826) OR (npa=214 AND nxx=826) UNION SELECT 'lata', count(DISTINCT
> lata) FROM npa_nxx_company_ocn WHERE (npa=214 AND nxx=826) OR (npa=214
> AND nxx=826)
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:719 Type: lata, Count: 1
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:719 Type: state, Count: 1
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:809 intra routing
> [state:1 lata:1] so rate field is [intralata_rate]
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:825 we have an event
> 2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:849 SQL:  SELECT l.digits
> AS lcr_digits,         c.carrier_name AS lcr_carrier_name,
> l.intralata_rate as lcr_rate_field,        cg.prefix AS lcr_gw_prefix,
> cg.suffix AS lcr_gw_suffix,        l.lead_strip AS lcr_lead_strip,
> l.trail_strip AS lcr_trail_strip,        l.prefix AS lcr_prefix,
> l.suffix AS lcr_suffix,        cg.codec AS lcr_codec, l.cid AS
> lcr_cid,        'carriers' AS lcr_limit_realm, c.carrier_name AS
> lcr_limit_id, 5 AS lcr_limit_max   FROM lcr l      JOIN carriers c ON
> l.carrier_id=c.id      JOIN carrier_gateway cg ON c.id=cg.carrier_id
>  WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1'
> AND digits_prefix @> '12148267711'      AND CURRENT_TIMESTAMP BETWEEN
> date_start AND date_end   ORDER BY digits DESC, intralata_rate,
> random();
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring
>
> [lcr_carrier=grnvoip_us,lcr_rate=0.00591]sofia/gateway/grnvoip/XXXX12148267711
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:638 Adding grnvoip_us to
> head of list
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring
> [lcr_carrier=teliax,lcr_rate=0.01000]sofia/gateway/teliax_atl/12148267711
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding teliax to end of
> list
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring
> [lcr_carrier=teliax,lcr_rate=0.01000]sofia/gateway/teliax/12148267711
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding teliax to end of
> list
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring
> [lcr_carrier=vitelity,lcr_rate=0.01440]sofia/gateway/vitelity/12148267711
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding vitelity to end of
> list
> 2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring
>
> [lcr_carrier=grnvoip_std,lcr_rate=0.01500]sofia/gateway/grnvoip/YYYY12148267711
> [...]
>
> On Fri, Jan 29, 2010 at 10:42 PM, Mouncif Benniane <mouncifbb at gmail.com>
> wrote:
> > Also the Provider has presented the rates in this format?
> > NPANXXLATA OCN INTER INTRA
> >
> >
> > On Fri, Jan 29, 2010 at 11:30 PM, Mouncif Benniane <mouncifbb at gmail.com>
> > wrote:
> >>
> >> Tried it and it's not giving me intralata  instead I get interstate,
> does
> >> the npa_nxx_company_ocn table needs to be used in this case?, also do I
> have
> >> to have the rate field in lcr table?
> >>
> >> lcr 617642  default 6176421212
> >>  | Digit Match | Carrier  | Rate     | Codec | CID Regexp | Dialstring
> >>                                                        |
> >>  | 617642      | carrier1 | 0.00500  |       |            |
> >> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642 |
> >>
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:1329 data passed to lcr is
> >> [617642  default 6176421212]
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:1365 Set Caller ID to
> >> [6176421212]
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:786 intra routing [state:0
> >> lata:0] so rate field is [rate]
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:802 we have an event
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:826 SQL: SELECT l.digits,
> >> c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix,
> >> l.lead_strip, l.trail_strip, l.prefix, l.suffix , cg.codec , l.cid FROM
> lcr
> >> l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON
> >> c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND
> l.enabled
> >> = '1' AND digits IN (617642, 61764, 6176, 617, 61, 6) AND
> CURRENT_TIMESTAMP
> >> BETWEEN date_start AND date_end ORDER BY digits DESC,  rate, rand();
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:307 Returning Dialstring
> >> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:615 Adding carrier1 to head
> >> of list
> >> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:307 Returning Dialstring
> >> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642
> >>
> >> Thank you Rupa!
> >>
> >> On Fri, Jan 29, 2010 at 7:37 PM, Rupa Schomaker <rupa at rupa.com> wrote:
> >>>
> >>> turn console logging up to debug and redo the lcr lookup.  The sql
> >>> statements along with status info will show up.  This should give
> >>> enough information to debug what is happening.
> >>>
> >>> I'm assuming the npanxx table is actually populated and not just
> >>> existing?
> >>>
> >>> When doing the lookup from the cli you have to tell lcr what CID to
> >>> use (remember, it is relative to the src/dest number).  I'm pretty
> >>> sure you get something on the console log when you don't specify a CID
> >>> when using the commandline.  Anyway:
> >>>
> >>> lcr 617642  default 6176421212
> >>>
> >>> should give you intralata.
> >>>
> >>> Note that the definition of intralata doesn't mean "local" for some
> >>> providers.  Some providers define local to "same ratecenter" which is
> >>> even more restrictive.
> >>>
> >>> On Fri, Jan 29, 2010 at 4:43 PM, Mouncif Benniane <mouncifbb at gmail.com
> >
> >>> wrote:
> >>> > i can't make use of mod_lcr using Intra/Interstate rating, I am using
> >>> > svn: FreeSWITCH Version 1.0.trunk (16517)
> >>> >
> >>> > lcr mysql table structure:
> >>> > CREATE TABLE `lcr` (
> >>> >   `id` INT(11) NOT NULL AUTO_INCREMENT,
> >>> >   `digits` VARCHAR(15) DEFAULT NULL,
> >>> >   `rate` FLOAT(11,5) DEFAULT NULL,
> >>> >   `intrastate_rate` FLOAT(11,5) DEFAULT NULL,
> >>> >   `intralata_rate` FLOAT(11,5) DEFAULT NULL,
> >>> >   `carrier_id` INT(11) NOT NULL,
> >>> >   `lead_strip` INT(11) NOT NULL,
> >>> >   `trail_strip` INT(11) NOT NULL,
> >>> >   `prefix` VARCHAR(16) NOT NULL,
> >>> >   `suffix` VARCHAR(16) NOT NULL,
> >>> >   `lcr_profile` VARCHAR(32) DEFAULT NULL,
> >>> >   `date_start` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',
> >>> >   `date_end` DATETIME NOT NULL DEFAULT '2030-12-31 00:00:00',
> >>> >   `quality` FLOAT(10,6) NOT NULL,
> >>> >   `reliability` FLOAT(10,6) NOT NULL,
> >>> >   `cid` VARCHAR(32) NOT NULL DEFAULT '',
> >>> >   `enabled` TINYINT(1) NOT NULL DEFAULT '1',
> >>> >   PRIMARY KEY  (`id`),
> >>> >   KEY `carrier_id` (`carrier_id`),
> >>> >   KEY `digits` (`digits`),
> >>> >   KEY `lcr_profile` (`lcr_profile`),
> >>> >   KEY `digits_profile_cid_rate` USING BTREE (`digits`),
> >>> >   CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`) REFERENCES
> >>> > `carriers`
> >>> > (`id`) ON DELETE CASCADE ON UPDATE CASCADE
> >>> > ) ENGINE=INNODB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
> >>> >
> >>> >
> >>> > lcr_admin show profiles
> >>> > Name:           default
> >>> >  custom sql:    SELECT l.digits, c.carrier_name, l.${lcr_rate_field},
> >>> > cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip,
> >>> > l.trail_strip,
> >>> > l.prefix, l.suffix , cg.codec , l.cid FROM lcr l JOIN carriers c ON
> >>> > l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id
> WHERE
> >>> > c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits
> IN
> >>> > (${lcr_query_expanded_digits}) AND CURRENT_TIMESTAMP BETWEEN
> date_start
> >>> > AND
> >>> > date_end ORDER BY digits DESC,  ${lcr_rate_field},  quality DESC,
> >>> >  reliability DESC, rand();
> >>> >  has %:         false
> >>> >  has vars:      true
> >>> >  has intrastate:        true
> >>> >  has intralata: true
> >>> >  has npanxx:    true
> >>> >  Reorder rate:  enabled
> >>> >  Info in headers:       disabled
> >>> >  Quote IN() List:       disabled
> >>> >
> >>> >
> >>> >
> >>> > lcr 617642  default  returns rate from the rate field table and not
> >>> > intra/inter state fields rates.
> >>> >
> >>> > Any ideas? thanks!
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > FreeSWITCH-users mailing list
> >>> > FreeSWITCH-users at lists.freeswitch.org
> >>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> >>> >
> >>> > UNSUBSCRIBE:
> http://lists.freeswitch.org/mailman/options/freeswitch-users
> >>> > http://www.freeswitch.org
> >>> >
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> -Rupa
> >>>
> >>> _______________________________________________
> >>> FreeSWITCH-users mailing list
> >>> FreeSWITCH-users at lists.freeswitch.org
> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> >>> UNSUBSCRIBE:
> http://lists.freeswitch.org/mailman/options/freeswitch-users
> >>> http://www.freeswitch.org
> >>
> >
> >
> > _______________________________________________
> > FreeSWITCH-users mailing list
> > FreeSWITCH-users at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> > http://www.freeswitch.org
> >
> >
>
>
>
> --
> -Rupa
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100130/9d35d33c/attachment-0002.html 


More information about the FreeSWITCH-users mailing list