[Freeswitch-users] mod_lcr problem

Rupa Schomaker rupa at rupa.com
Mon Feb 1 09:32:06 PST 2010


Thanks.  It is a bit of a foot-gun.  This example might be worth adding to
the wiki for that app, would you mind doing it?

On Mon, Feb 1, 2010 at 10:16 AM, Mouncif Benniane <mouncifbb at gmail.com>wrote:

> I got it! nevermind.
>
> session.execute("set_profile_var","caller_id_number=1617947XXXX"); ( since
> I am using js)
>
> Thanks
>
>
> On Mon, Feb 1, 2010 at 10:47 AM, Mouncif Benniane <mouncifbb at gmail.com>wrote:
>
>> any example on how to use: set_profile_var?
>>
>> thanks
>>
>>
>>
>> On Sun, Jan 31, 2010 at 6:07 PM, Rupa Schomaker <rupa at rupa.com> wrote:
>>
>>> Yes, you need to normalize the values passed to lcr.  Otherwise, how
>>> could it work?
>>>
>>> You can normalize the CID by matching and adding a 1 for 10 digit #s, or
>>> removing the leading + or other things you might need then setting it back
>>> to the profile using the set_profile_var app (
>>> http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_set_profile_var).
>>>  (mod_cidlookup will set it after doing a #->name/area lookup - but for now
>>> you can set it yourself)
>>>
>>> You can normalize the DID by doing similar matching rules as above and
>>> then transfering to that normalized DID for the rest of your call plan
>>> processing.
>>>
>>> I'm pretty sure mod_cidlookup has an example of normalizing... yeah:
>>> http://wiki.freeswitch.org/wiki/Mod_cidlookup#Dialplan_Application
>>>
>>> On Sun, Jan 31, 2010 at 4:18 PM, Mouncifbb <mouncifbb at gmail.com> wrote:
>>>
>>>> So the CID must have 1 at front also? Usually people
>>>> Send only npa and nxx ex 6176427788 7817612233
>>>> Do I need to alter it?
>>>>
>>>> Sent from my iPhone
>>>>
>>>> On Jan 31, 2010, at 8:32 AM, Rupa Schomaker <rupa at rupa.com> wrote:
>>>>
>>>>
>>>>
>>>> On Sat, Jan 30, 2010 at 10:57 PM, Mouncif Benniane <<mouncifbb at gmail.com>
>>>> mouncifbb at gmail.com> wrote:
>>>>
>>>>> OK going back to use default profile to keep things simple below 2
>>>>> results
>>>>>
>>>>> Using:
>>>>>
>>>>> lcr 16179470890  default  19785223241  ( this one consult
>>>>> npa_nxx_company_ocn)
>>>>>
>>>>> lcr 6179470890  default  9785223241 ( this one don't!! )
>>>>>
>>>>>
>>>>>
>>>> Oh, right!  mod_lcr really expects you to normalize your prefix to e164
>>>> format.  I thought there was discussion about this in the wiki, but maybe
>>>> not.  For simple prefix matching it doesn't matter, but for things that make
>>>> decisions based on the # (like the lata/state stuff) it does.
>>>>
>>>> npanxx lookup only makes sense for NANPA numbers.  NANPA numbers have a
>>>> country code of "1" and a total length of 11 (including the 1).
>>>>
>>>> This is the only rational way to do it when you have a rate table with
>>>> both domestic (NANPA) and international prefixes.
>>>>
>>>>
>>>>> freeswitch> lcr 16179470890  default  19785223241
>>>>> 2010-01-30 23:53:34.681842 [DEBUG] mod_lcr.c:1329 data passed to lcr is
>>>>> [16179470890  default  19785223241]
>>>>> 2010-01-30 23:53:34.681842 [DEBUG] mod_lcr.c:1365 Set Caller ID to
>>>>> [19785223241]
>>>>> 2010-01-30 23:53:34.681842 [DEBUG] mod_lcr.c:736 SQL: SELECT 'state',
>>>>> count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=617 AND nxx=947)
>>>>> OR (npa=978 AND nxx=522) UNION SELECT 'lata', count(DISTINCT lata) FROM
>>>>> npa_nxx_company_ocn WHERE (npa=617 AND nxx=947) OR (npa=978 AND nxx=522)
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:696 Type: state, Count: 1
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:696 Type: lata, Count: 1
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:786 intra routing [state:1
>>>>> lata:1] so rate field is [intralata_rate]
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:802 we have an event
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:826 SQL: SELECT l.digits,
>>>>> c.carrier_name, l.intralata_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 (16179470890, 1617947089,
>>>>> 161794708, 16179470, 1617947, 161794, 16179, 1617, 161, 16, 1) AND
>>>>> CURRENT_TIMESTAMP BETWEEN date_start AND date_end ORDER BY digits DESC,
>>>>> intralata_rate, rand();
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier1,lcr_rate=0.00000]sofia/gateway/carrier1/16179470890
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:615 Adding carrier1 to
>>>>> head of list
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/
>>>>> 06179470890 at proxy.carrier2.net:5060
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:667 adding carrier2 to end
>>>>> of list after carrier1
>>>>>
>>>>>
>>>>>  | Digit Match | Carrier  | Rate     | Codec | CID Regexp |
>>>>> Dialstring
>>>>> |
>>>>>  | 1           | carrier1 | 0.00000  |       |            |
>>>>> [lcr_carrier=carrier1,lcr_rate=0.00000]sofia/gateway/carrier1/16179470890
>>>>> |
>>>>>  | 1           | carrier2 | 0.00000  |       |            |
>>>>> [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/
>>>>> 06179470890 at proxy.carrier2.net:5060 |
>>>>>
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier1,lcr_rate=0.00000]sofia/gateway/carrier1/16179470890
>>>>> 2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/
>>>>> 06179470890 at proxy.carrier2.net:5060
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> freeswitch> lcr 6179470890  default  9785223241
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:1329 data passed to lcr is
>>>>> [6179470890  default  9785223241]
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:1365 Set Caller ID to
>>>>> [9785223241]
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:786 intra routing [state:0
>>>>> lata:0] so rate field is [rate]
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:802 we have an event
>>>>> 2010-01-30 23:52:58.782633 [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
>>>>> (6179470890, 617947089, 61794708, 6179470, 617947, 61794, 6179, 617, 61, 6)
>>>>> AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ORDER BY digits DESC,
>>>>> rate, rand();
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier1,lcr_rate=0.09000]sofia/gateway/carrier1/16179470890
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:615 Adding carrier1 to
>>>>> head of list
>>>>> 2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:307 Returning Dialstring
>>>>> [lcr_carrier=carrier1,lcr_rate=0.09000]sofia/gateway/carrier1/16179470890
>>>>>
>>>>>
>>>>>  | Digit Match | Carrier  | Rate     | Codec | CID Regexp |
>>>>> Dialstring                                                                |
>>>>>   | 617947      | carrier1 | 0.09000  |       |            |
>>>>> [lcr_carrier=carrier1,lcr_rate=0.09000]sofia/gateway/carrier1/16179470890 |
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Jan 30, 2010 at 7:45 PM, Rupa Schomaker < <rupa at rupa.com>
>>>>> rupa at rupa.com> wrote:
>>>>>
>>>>>> turn up logging to debug again, and then reload mod_lcr.  It'll spit
>>>>>> out a bunch of crap when it tests out each profile you have defined.  Give
>>>>>> me the full log (here or in <http://pastebin.freeswitch.org>
>>>>>> pastebin.freeswitch.org).  That may show more useful info as to why
>>>>>> things are mucked up?
>>>>>>
>>>>>>
>>>>>> On Sat, Jan 30, 2010 at 6:23 PM, Mouncif Benniane <<mouncifbb at gmail.com>
>>>>>> mouncifbb at gmail.com> wrote:
>>>>>>
>>>>>>> yes I use NANPA_STD profile instead of default cause I thought the
>>>>>>> custom profile was causing issues, but looks like it's returning same
>>>>>>> results.
>>>>>>>
>>>>>>> There is this line in thw wiki:
>>>>>>> intra lata/state selection is done manually by setting the channel
>>>>>>> variables *intrastate* or *intralata* to the value *true*.
>>>>>>>
>>>>>>> do I have to set these ? if yes how?
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Jan 30, 2010 at 6:59 PM, Rupa Schomaker < <rupa at rupa.com>
>>>>>>> rupa at rupa.com> wrote:
>>>>>>>
>>>>>>>> Stuff inline.
>>>>>>>>
>>>>>>>> On Sat, Jan 30, 2010 at 3:38 PM, Mouncif Benniane <<mouncifbb at gmail.com>
>>>>>>>> mouncifbb at gmail.com> wrote:
>>>>>>>>
>>>>>>>>>  NPANXX,"LATA","OCN","NTER","INTRA"
>>>>>>>>> 201007,"224","7229","0.0059","0.0127"
>>>>>>>>> 201040,"224","9206","0.0036","0.0036"
>>>>>>>>>
>>>>>>>>
>>>>>>>> Looks like they give you the LATA and OCN values with the prefix.
>>>>>>>>  We (should) look that up ourselves.
>>>>>>>>
>>>>>>>>
>>>>>>>>> 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]*
>>>>>>>>
>>>>>>>>
>>>>>>>> This is fine.  it is a leftover from when you would tell mod_lcr via
>>>>>>>> a channel var that it should do intrastate.  I later had mod_lcr do the
>>>>>>>> lookup itself, but we still honor the old var.  There are no channel vars
>>>>>>>> associated with the cli, so you wouldn't see that msg.
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> 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??
>>>>>>>>>
>>>>>>>>>
>>>>>>>> Only thing that jumps out at me.
>>>>>>>>
>>>>>>>> The output from lcr_admin show profiles showed only the default one.
>>>>>>>>  On the dialplan you use the NANPA_STD profile.  Can you check lcr_admin
>>>>>>>> list and see if that profile is defined and if so if it says it is using the
>>>>>>>> npanxx table?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Sat, Jan 30, 2010 at 10:02 AM, Rupa Schomaker < <rupa at rupa.com>
>>>>>>>>> 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>
>>>>>>>>>> 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>
>>>>>>>>>> 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>
>>>>>>>>>> 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>
>>>>>>>>>> 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>
>>>>>>>>>> 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>
>>>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>>> >>> >
>>>>>>>>>> <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>>>> >>> >
>>>>>>>>>> >>> > UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>>> >>> > <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>>> >>> >
>>>>>>>>>> >>> >
>>>>>>>>>> >>>
>>>>>>>>>> >>>
>>>>>>>>>> >>>
>>>>>>>>>> >>> --
>>>>>>>>>> >>> -Rupa
>>>>>>>>>> >>>
>>>>>>>>>> >>> _______________________________________________
>>>>>>>>>> >>> FreeSWITCH-users mailing list
>>>>>>>>>> >>> <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>>> >>>
>>>>>>>>>> <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>>>> >>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>>> >>> <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>>> >>
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>> > _______________________________________________
>>>>>>>>>> > FreeSWITCH-users mailing list
>>>>>>>>>> > <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>>> > <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>>>> > UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>>> > <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>>> >
>>>>>>>>>> >
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> -Rupa
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> FreeSWITCH-users mailing list
>>>>>>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>>>  <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> FreeSWITCH-users mailing list
>>>>>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>>  <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> -Rupa
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> FreeSWITCH-users mailing list
>>>>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>>  <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> FreeSWITCH-users mailing list
>>>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>>  <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> -Rupa
>>>>>>
>>>>>> _______________________________________________
>>>>>> FreeSWITCH-users mailing list
>>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>>  <http://www.freeswitch.org>http://www.freeswitch.org
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> FreeSWITCH-users mailing list
>>>>>  <FreeSWITCH-users at lists.freeswitch.org>
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>>  <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users>
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>> UNSUBSCRIBE:<http://lists.freeswitch.org/mailman/options/freeswitch-users>
>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>>  <http://www.freeswitch.org>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
>>>
>>>
>>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100201/72f5cf14/attachment-0002.html 


More information about the FreeSWITCH-users mailing list