<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I think a foreign key constraint is failing, should look into that<div><br><div><div>On 9-Jun-09, at 11:53 PM, Diego Viola wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi everyone,<br><br>I have used freeswitch/scripts/contrib/intralanman/C/lcr/sql/mysql-5.0.sql to load the mod_lcr schema, that worked well.<br><br>But whenever I try to insert data from the "Sample Data" in the wiki it fails: <a href="http://wiki.freeswitch.org/wiki/Mod_lcr#Sample_Data">http://wiki.freeswitch.org/wiki/Mod_lcr#Sample_Data</a><br> <br>mysql> INSERT INTO lcr (digits, rate, carrier_id, lead_strip, trail_strip,<br> -> prefix, suffix,<br> -> date_start, date_end, quality, reliability) VALUES<br> -> ('1', 0.15, 1, 0, 0, '', '',<br> -> current_timestamp - interval 1 year,<br> -> current_timestamp + interval 1 year<br> -> , 0, 0);<br>ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`fs_lcr/lcr`, CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`) REFERENCES `carriers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)<br> mysql> <br><br>Regards,<br><br>Diego<br><br><div class="gmail_quote">On Tue, Jun 9, 2009 at 8:52 PM, Diego Viola <span dir="ltr"><<a href="mailto:diego.viola@gmail.com">diego.viola@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;">Thanks for your help Rupa :).<br><br>Don't worry that I will give everything back to the wiki, as I learn more and more, I have also contributed back some things to the wiki:<br> <br><a href="http://wiki.freeswitch.org/wiki/Special:Contributions/Diego.viola" target="_blank">http://wiki.freeswitch.org/wiki/Special:Contributions/Diego.viola</a><br> <br>I love to do that, I will also contribute my calling card application to the community as soon as I'm done with it ;).<br><br>Regards,<br><font color="#888888"><br>Diego</font><div><div></div><div class="h5"><br> <br><div class="gmail_quote">On Tue, Jun 9, 2009 at 8:37 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;">Diego,<br><br>Here is how I'd go about doing what I think you want. As payment, add a section to the wiki when you have it working. <br> <br>Create two profiles in lcr.conf.<br><br>the first profile is your callingcard rate deck. Give it a profile id of 1. Then load your data into the lcr tables. <br> <br>carriers = define your carrier. call it whatever you want<br>carrier_gateteway = you won't care about any real routes, so just load dummy data in here (linked to your carrier).<br>lcr = load your rate deck here. Set profile id to 1. <br> <br>Now, to look up the customer's code, use the lcr application. <br><br>application="lcr" data="$1 profilename" where profilename is the profile defined in lcr.conf with id 1. $1 is the normalized number (I suggest e164 format minus the + -- this is discussed in the wiki).<br> <br>At this point, you'll have the results of the lcr query in channel vars.<br><br>${lcr_route_count} tells you the number of routes found (if you loaded your rate deck right it should always be 1). ${lcr_rate_1} will contain the rate. <br> <br>So now you can set that to the var you need for nibblebill to work. <br><br>If you want to use lcr to actually route the actual call, just call it again. This time with the profile id set to whatever you use to load the full lcr table for all your providers.<br> <br><div class="gmail_quote"><div><div></div><div>On Tue, Jun 9, 2009 at 6:35 PM, Diego Viola <span dir="ltr"><<a href="mailto:diego.viola@gmail.com" target="_blank">diego.viola@gmail.com</a>></span> wrote:<br> </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></div><div> Hi everyone,<br><br>I'm trying to write a calling card app with A-Z rates, and I plan to use mod_lcr for this case... the only thing I need mod_lcr to do for me is get the rate based on the destination number / prefix.<br> <br>Is there a way I could achieve this with mod_lcr? I seen the wiki page and the SQL examples, but the SQL examples does a lot more, so I was thinking if I could use a custom SQL query to only do what I need.<br><br>Thanks,<br> <font color="#888888"> <br>Diego<br> </font><br></div></div>_______________________________________________<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><font color="#888888">-Rupa<br> </font><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> _______________________________________________<br>Freeswitch-users mailing list<br><a href="mailto:Freeswitch-users@lists.freeswitch.org">Freeswitch-users@lists.freeswitch.org</a><br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></blockquote></div><br></div></body></html>