I think a foreign key constraint is failing, should look into that On 9-Jun-09, at 11:53 PM, Diego Viola wrote:
Hi everyone,
I have used freeswitch/scripts/contrib/intralanman/C/lcr/sql/ mysql-5.0.sql to load the mod_lcr schema, that worked well.
But whenever I try to insert data from the "Sample Data" in the wiki it fails: http://wiki.freeswitch.org/wiki/Mod_lcr#Sample_Data
mysql> INSERT INTO lcr (digits, rate, carrier_id, lead_strip, trail_strip, -> prefix, suffix, -> date_start, date_end, quality, reliability) VALUES -> ('1', 0.15, 1, 0, 0, '', '', -> current_timestamp - interval 1 year, -> current_timestamp + interval 1 year -> , 0, 0); 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) mysql>
Regards,
Diego
On Tue, Jun 9, 2009 at 8:52 PM, Diego Viola <diego.viola@gmail.com> wrote: Thanks for your help Rupa :).
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:
http://wiki.freeswitch.org/wiki/Special:Contributions/Diego.viola
I love to do that, I will also contribute my calling card application to the community as soon as I'm done with it ;).
Regards,
Diego
On Tue, Jun 9, 2009 at 8:37 PM, Rupa Schomaker <rupa@rupa.com> wrote: Diego,
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.
Create two profiles in lcr.conf.
the first profile is your callingcard rate deck. Give it a profile id of 1. Then load your data into the lcr tables.
carriers = define your carrier. call it whatever you want carrier_gateteway = you won't care about any real routes, so just load dummy data in here (linked to your carrier). lcr = load your rate deck here. Set profile id to 1.
Now, to look up the customer's code, use the lcr application.
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).
At this point, you'll have the results of the lcr query in channel vars.
${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.
So now you can set that to the var you need for nibblebill to work.
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.
On Tue, Jun 9, 2009 at 6:35 PM, Diego Viola <diego.viola@gmail.com> wrote: Hi everyone,
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.
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.
Thanks,
Diego
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@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@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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org