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?<br><br><div class="gmail_quote">On Mon, Feb 1, 2010 at 10:16 AM, Mouncif Benniane <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I got it! nevermind.<br><br>session.execute("set_profile_var","caller_id_number=1617947XXXX"); ( since I am using js)<br>
<br>Thanks<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Feb 1, 2010 at 10:47 AM, Mouncif Benniane <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">any example on how to use: set_profile_var?<br><br>thanks<div><div></div><div><br>
<br><br><div class="gmail_quote">On Sun, Jan 31, 2010 at 6:07 PM, Rupa Schomaker <span dir="ltr"><<a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Yes, you need to normalize the values passed to lcr. Otherwise, how could it work?<div><br>
</div><div>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 (<a href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_set_profile_var" target="_blank">http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_set_profile_var</a>). (mod_cidlookup will set it after doing a #->name/area lookup - but for now you can set it yourself)</div>
<div><br></div><div>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.</div><div><br></div><div>I'm pretty sure mod_cidlookup has an example of normalizing... yeah:</div>
<div><a href="http://wiki.freeswitch.org/wiki/Mod_cidlookup#Dialplan_Application" target="_blank">http://wiki.freeswitch.org/wiki/Mod_cidlookup#Dialplan_Application</a></div><div><div></div><div><div><br><div class="gmail_quote">
On Sun, Jan 31, 2010 at 4:18 PM, Mouncifbb <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div bgcolor="#FFFFFF"><div>So the CID must have 1 at front also? Usually people</div><div>
Send only npa and nxx ex 6176427788 7817612233</div>
<div>Do I need to alter it?<br><br>Sent from my iPhone</div><div><div></div><div><div><br>On Jan 31, 2010, at 8:32 AM, Rupa Schomaker <<a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>> wrote:<br>
<br></div><div></div><blockquote type="cite"><div><br><br><div class="gmail_quote">On Sat, Jan 30, 2010 at 10:57 PM, Mouncif Benniane <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
OK going back to use default profile to keep things simple below 2 results<br><br>Using:<br><br>lcr 16179470890 default 19785223241 ( this one consult npa_nxx_company_ocn)<br><br>lcr 6179470890 default 9785223241 ( this one don't!! )<br>
<br><br></blockquote><div><br></div><div>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.</div>
<div><br></div><div>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). </div><div><br></div><div>This is the only rational way to do it when you have a rate table with both domestic (NANPA) and international prefixes.</div>
<div><br></div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><br>freeswitch> lcr 16179470890 default 19785223241<br>2010-01-30 23:53:34.681842 [DEBUG] mod_lcr.c:1329 data passed to lcr is [16179470890 default 19785223241]<br>
2010-01-30 23:53:34.681842 [DEBUG] mod_lcr.c:1365 Set Caller ID to [19785223241]<br>
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)<br>
2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:696 Type: state, Count: 1<br>2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:696 Type: lata, Count: 1<br>2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:786 intra routing [state:1 lata:1] so rate field is [intralata_rate]<br>
2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:802 we have an event<br>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=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=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();<br>
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<br>2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:615 Adding carrier1 to head of list<br>
2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/<a href="http://06179470890@proxy.carrier2.net:5060" target="_blank">06179470890@proxy.carrier2.net:5060</a><br>
2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:667 adding carrier2 to end of list after carrier1<div><br>
<br> | Digit Match | Carrier | Rate | Codec | CID Regexp | Dialstring |<br></div> | 1 | carrier1 | 0.00000 | | | [lcr_carrier=carrier1,lcr_rate=0.00000]sofia/gateway/carrier1/16179470890 |<br>
| 1 | carrier2 | 0.00000 | | | [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/<a href="http://06179470890@proxy.carrier2.net:5060" target="_blank">06179470890@proxy.carrier2.net:5060</a> |<br>
<br>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<br>
2010-01-30 23:53:34.910842 [DEBUG] mod_lcr.c:307 Returning Dialstring [lcr_carrier=carrier2,lcr_rate=0.00000]sofia/external/<a href="http://06179470890@proxy.carrier2.net:5060" target="_blank">06179470890@proxy.carrier2.net:5060</a><br>
<br>
<br><br><br><br>freeswitch> lcr 6179470890 default 9785223241<br>2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:1329 data passed to lcr is [6179470890 default 9785223241]<br>2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:1365 Set Caller ID to [9785223241]<br>
2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:786 intra routing [state:0 lata:0] so rate field is [rate]<br>2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:802 we have an event<br>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=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=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();<br>
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<br>2010-01-30 23:52:58.782633 [DEBUG] mod_lcr.c:615 Adding carrier1 to head of list<br>
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<div><br><br> | Digit Match | Carrier | Rate | Codec | CID Regexp | Dialstring |<br>
</div>
| 617947 | carrier1 | 0.09000 | | | [lcr_carrier=carrier1,lcr_rate=0.09000]sofia/gateway/carrier1/16179470890 |<div><div></div><div><br><br><br><br><br><br><br><br><br><br><br><div class="gmail_quote">
On Sat, Jan 30, 2010 at 7:45 PM, Rupa Schomaker <span dir="ltr"><<a href="mailto:rupa@rupa.com" target="_blank"></a><a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">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 <a href="http://pastebin.freeswitch.org" target="_blank"></a><a href="http://pastebin.freeswitch.org" target="_blank">pastebin.freeswitch.org</a>). That may show more useful info as to why things are mucked up?<div>
<div></div><div><br>
<br><div class="gmail_quote">On Sat, Jan 30, 2010 at 6:23 PM, Mouncif Benniane <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
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.<br><br>There is this line in thw wiki:<br>intra lata/state selection is done manually by setting the channel variables <b>intrastate</b> or <b>intralata</b> to the value <b>true</b>. <br>
<br>do I have to set these ? if yes how?<br><br>Thanks<div><div></div><div><br><br><div class="gmail_quote">On Sat, Jan 30, 2010 at 6:59 PM, Rupa Schomaker <span dir="ltr"><<a href="mailto:rupa@rupa.com" target="_blank"></a><a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">Stuff inline.<br><br><div class="gmail_quote"><div>On Sat, Jan 30, 2010 at 3:38 PM, Mouncif Benniane <span dir="ltr"><<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<table style="border-collapse:collapse;width:192pt" border="0" cellpadding="0" cellspacing="0" width="256"><col style="width:48pt" span="4" width="64">
<tbody><tr style="min-height:15pt" height="20">
<td colspan="4" style="min-height:15pt;width:192pt" height="20" width="256">NPANXX,"LATA","OCN","NTER","INTRA"</td>
</tr>
<tr style="min-height:15pt" height="20">
<td colspan="4" style="min-height:15pt" height="20">201007,"224","7229","0.0059","0.0127"</td>
</tr>
<tr style="min-height:15pt" height="20">
<td colspan="4" style="min-height:15pt" height="20">201040,"224","9206","0.0036","0.0036"</td>
</tr>
</tbody></table><br></blockquote><div><br></div></div><div>Looks like they give you the LATA and OCN values with the prefix. We (should) look that up ourselves.</div><div><div> </div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
FreeSWITCH Version 1.0.trunk (16540)<br><br><br>Also I noticed the <b>npa_nxx_ocn</b> table never get consulted.<br><br>I also see this now when making a real call instead of running thorugh CLI<br><br>
EXECUTE sofia/external/6179472456@174.x.x.x lcr(16179470890 NANPA_STD)<br>2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1230 <b style="color:rgb(255, 0, 0)">intrastate channel var is [undef]</b></blockquote><div><br></div>
</div><div>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.</div>
<div>
<div> </div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><br>2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1233 Select routes based on interstate rates<br>
2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:1252 LCR Lookup on 16179470893 using profile NANPA_STD<br>2010-01-30 16:28:56.685457 [DEBUG] mod_lcr.c:786 intra routing [state:0 lata:0] so rate field is [rate]<br><br>called number 6179470890 caller ID: 6179472456<br>
<br>any ideas??<div><div></div><div><br></div></div></blockquote><div><br></div></div><div>Only thing that jumps out at me. </div><div><br></div><div>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?</div>
<div><div></div><div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div><div><br><br><br><br><div class="gmail_quote">
On Sat, Jan 30, 2010 at 10:02 AM, Rupa Schomaker <span dir="ltr"><<a href="mailto:rupa@rupa.com" target="_blank"></a><a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Something is still missing from the logs. Note the query of the npanxx<br>
table, the flags being set, and the rate field being chosen. Umm..<br>
oh, what version of fs are you running?<br>
<br>
Yes, the npa_nxx_ocn table needs to be loaded up as described in:<br>
<a href="http://wiki.freeswitch.org/wiki/Mod_cidlookup#Falling_back_to_.22City_State.22_in_the_absense_of_a_name" target="_blank"></a><a href="http://wiki.freeswitch.org/wiki/Mod_cidlookup#Falling_back_to_.22City_State.22_in_the_absense_of_a_name" target="_blank">http://wiki.freeswitch.org/wiki/Mod_cidlookup#Falling_back_to_.22City_State.22_in_the_absense_of_a_name</a><br>
(there is a link to that from mod_lcr's wiki page).<br>
<br>
An example from my own setup:<br>
<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:1384 data passed to lcr<br>
is [12148267711 default 12148267712]<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:1420 Set Caller ID to [12148267712]<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:759 SQL: SELECT 'state',<br>
count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=214 AND<br>
nxx=826) OR (npa=214 AND nxx=826) UNION SELECT 'lata', count(DISTINCT<br>
lata) FROM npa_nxx_company_ocn WHERE (npa=214 AND nxx=826) OR (npa=214<br>
AND nxx=826)<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:719 Type: lata, Count: 1<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:719 Type: state, Count: 1<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:809 intra routing<br>
[state:1 lata:1] so rate field is [intralata_rate]<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:825 we have an event<br>
2010-01-30 08:55:10.633951 [DEBUG] mod_lcr.c:849 SQL: SELECT l.digits<br>
AS lcr_digits, c.carrier_name AS lcr_carrier_name,<br>
l.intralata_rate as lcr_rate_field, cg.prefix AS lcr_gw_prefix,<br>
cg.suffix AS lcr_gw_suffix, l.lead_strip AS lcr_lead_strip,<br>
l.trail_strip AS lcr_trail_strip, l.prefix AS lcr_prefix,<br>
l.suffix AS lcr_suffix, cg.codec AS lcr_codec, l.cid AS<br>
lcr_cid, 'carriers' AS lcr_limit_realm, c.carrier_name AS<br>
lcr_limit_id, 5 AS lcr_limit_max FROM lcr l JOIN carriers c ON<br>
<div>l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id<br>
WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1'<br>
</div>AND digits_prefix @> '12148267711' AND CURRENT_TIMESTAMP BETWEEN<br>
date_start AND date_end ORDER BY digits DESC, intralata_rate,<br>
random();<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring<br>
[lcr_carrier=grnvoip_us,lcr_rate=0.00591]sofia/gateway/grnvoip/XXXX12148267711<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:638 Adding grnvoip_us to<br>
head of list<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring<br>
[lcr_carrier=teliax,lcr_rate=0.01000]sofia/gateway/teliax_atl/12148267711<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding teliax to end of list<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring<br>
[lcr_carrier=teliax,lcr_rate=0.01000]sofia/gateway/teliax/12148267711<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding teliax to end of list<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring<br>
[lcr_carrier=vitelity,lcr_rate=0.01440]sofia/gateway/vitelity/12148267711<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:660 Adding vitelity to end of list<br>
2010-01-30 08:55:10.644013 [DEBUG] mod_lcr.c:314 Returning Dialstring<br>
[lcr_carrier=grnvoip_std,lcr_rate=0.01500]sofia/gateway/grnvoip/YYYY12148267711<br>
[...]<br>
<div><div></div><div><br>
On Fri, Jan 29, 2010 at 10:42 PM, Mouncif Benniane <<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>> wrote:<br>
> Also the Provider has presented the rates in this format?<br>
> NPANXXLATA OCN INTER INTRA<br>
><br>
><br>
> On Fri, Jan 29, 2010 at 11:30 PM, Mouncif Benniane <<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Tried it and it's not giving me intralata instead I get interstate, does<br>
>> the npa_nxx_company_ocn table needs to be used in this case?, also do I have<br>
>> to have the rate field in lcr table?<br>
>><br>
>> lcr 617642 default 6176421212<br>
>> | Digit Match | Carrier | Rate | Codec | CID Regexp | Dialstring<br>
>> |<br>
>> | 617642 | carrier1 | 0.00500 | | |<br>
>> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642 |<br>
>><br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:1329 data passed to lcr is<br>
>> [617642 default 6176421212]<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:1365 Set Caller ID to<br>
>> [6176421212]<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:786 intra routing [state:0<br>
>> lata:0] so rate field is [rate]<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:802 we have an event<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:826 SQL: SELECT l.digits,<br>
>> c.carrier_name, l.rate, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix,<br>
>> l.lead_strip, l.trail_strip, l.prefix, l.suffix , cg.codec , l.cid FROM lcr<br>
>> l JOIN carriers c ON l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON<br>
>> <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled<br>
>> = '1' AND digits IN (617642, 61764, 6176, 617, 61, 6) AND CURRENT_TIMESTAMP<br>
>> BETWEEN date_start AND date_end ORDER BY digits DESC, rate, rand();<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:307 Returning Dialstring<br>
>> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:615 Adding carrier1 to head<br>
>> of list<br>
>> 2010-01-29 23:29:45.003307 [DEBUG] mod_lcr.c:307 Returning Dialstring<br>
>> [lcr_carrier=carrier1,lcr_rate=0.00500]sofia/gateway/carrier1/1617642<br>
>><br>
>> Thank you Rupa!<br>
>><br>
>> On Fri, Jan 29, 2010 at 7:37 PM, Rupa Schomaker <<a href="mailto:rupa@rupa.com" target="_blank"></a><a href="mailto:rupa@rupa.com" target="_blank">rupa@rupa.com</a>> wrote:<br>
>>><br>
>>> turn console logging up to debug and redo the lcr lookup. The sql<br>
>>> statements along with status info will show up. This should give<br>
>>> enough information to debug what is happening.<br>
>>><br>
>>> I'm assuming the npanxx table is actually populated and not just<br>
>>> existing?<br>
>>><br>
>>> When doing the lookup from the cli you have to tell lcr what CID to<br>
>>> use (remember, it is relative to the src/dest number). I'm pretty<br>
>>> sure you get something on the console log when you don't specify a CID<br>
>>> when using the commandline. Anyway:<br>
>>><br>
>>> lcr 617642 default 6176421212<br>
>>><br>
>>> should give you intralata.<br>
>>><br>
>>> Note that the definition of intralata doesn't mean "local" for some<br>
>>> providers. Some providers define local to "same ratecenter" which is<br>
>>> even more restrictive.<br>
>>><br>
>>> On Fri, Jan 29, 2010 at 4:43 PM, Mouncif Benniane <<a href="mailto:mouncifbb@gmail.com" target="_blank"></a><a href="mailto:mouncifbb@gmail.com" target="_blank">mouncifbb@gmail.com</a>><br>
>>> wrote:<br>
>>> > i can't make use of mod_lcr using Intra/Interstate rating, I am using<br>
>>> > svn: FreeSWITCH Version 1.0.trunk (16517)<br>
>>> ><br>
>>> > lcr mysql table structure:<br>
>>> > CREATE TABLE `lcr` (<br>
>>> > `id` INT(11) NOT NULL AUTO_INCREMENT,<br>
>>> > `digits` VARCHAR(15) DEFAULT NULL,<br>
>>> > `rate` FLOAT(11,5) DEFAULT NULL,<br>
>>> > `intrastate_rate` FLOAT(11,5) DEFAULT NULL,<br>
>>> > `intralata_rate` FLOAT(11,5) DEFAULT NULL,<br>
>>> > `carrier_id` INT(11) NOT NULL,<br>
>>> > `lead_strip` INT(11) NOT NULL,<br>
>>> > `trail_strip` INT(11) NOT NULL,<br>
>>> > `prefix` VARCHAR(16) NOT NULL,<br>
>>> > `suffix` VARCHAR(16) NOT NULL,<br>
>>> > `lcr_profile` VARCHAR(32) DEFAULT NULL,<br>
>>> > `date_start` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00',<br>
>>> > `date_end` DATETIME NOT NULL DEFAULT '2030-12-31 00:00:00',<br>
>>> > `quality` FLOAT(10,6) NOT NULL,<br>
>>> > `reliability` FLOAT(10,6) NOT NULL,<br>
>>> > `cid` VARCHAR(32) NOT NULL DEFAULT '',<br>
>>> > `enabled` TINYINT(1) NOT NULL DEFAULT '1',<br>
>>> > PRIMARY KEY (`id`),<br>
>>> > KEY `carrier_id` (`carrier_id`),<br>
>>> > KEY `digits` (`digits`),<br>
>>> > KEY `lcr_profile` (`lcr_profile`),<br>
>>> > KEY `digits_profile_cid_rate` USING BTREE (`digits`),<br>
>>> > CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`) REFERENCES<br>
>>> > `carriers`<br>
>>> > (`id`) ON DELETE CASCADE ON UPDATE CASCADE<br>
>>> > ) ENGINE=INNODB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1<br>
>>> ><br>
>>> ><br>
>>> > lcr_admin show profiles<br>
>>> > Name: default<br>
>>> > custom sql: SELECT l.digits, c.carrier_name, l.${lcr_rate_field},<br>
>>> > cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip,<br>
>>> > l.trail_strip,<br>
>>> > l.prefix, l.suffix , cg.codec , l.cid FROM lcr l JOIN carriers c ON<br>
>>> > l.carrier_id=<a href="http://c.id" target="_blank">c.id</a> JOIN carrier_gateway cg ON <a href="http://c.id" target="_blank">c.id</a>=cg.carrier_id WHERE<br>
>>> > c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN<br>
>>> > (${lcr_query_expanded_digits}) AND CURRENT_TIMESTAMP BETWEEN date_start<br>
>>> > AND<br>
>>> > date_end ORDER BY digits DESC, ${lcr_rate_field}, quality DESC,<br>
>>> > reliability DESC, rand();<br>
>>> > has %: false<br>
>>> > has vars: true<br>
>>> > has intrastate: true<br>
>>> > has intralata: true<br>
>>> > has npanxx: true<br>
>>> > Reorder rate: enabled<br>
>>> > Info in headers: disabled<br>
>>> > Quote IN() List: disabled<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > lcr 617642 default returns rate from the rate field table and not<br>
>>> > intra/inter state fields rates.<br>
>>> ><br>
>>> > Any ideas? thanks!<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > FreeSWITCH-users mailing list<br>
>>> > <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
>>> > <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
>>> ><br>
>>> > UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
>>> > <a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
>>> ><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> -Rupa<br>
>>><br>
>>> _______________________________________________<br>
>>> FreeSWITCH-users mailing list<br>
>>> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
>>> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
>>> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
>>> <a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
-Rupa<br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div></div></div><br><br clear="all"><br>-- <br><font color="#888888">-Rupa<br>
</font><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank"></a><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank"></a><a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank"></a><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>FreeSWITCH-users mailing list</span><br><span><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a></span><br>
<span><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></span><br><span>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></span><br>
<span><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></span><br></div></blockquote></div></div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>
</div>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>-Rupa<br>