VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
diego.viola at gmail.com Guest
|
Posted: Tue Jun 09, 2009 6:38 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
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 |
|
Back to top |
|
|
rupa at rupa.com Guest
|
Posted: Tue Jun 09, 2009 7:37 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
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 (diego.viola@gmail.com)> wrote:
--
-Rupa |
|
Back to top |
|
|
diego.viola at gmail.com Guest
|
Posted: Tue Jun 09, 2009 7:54 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
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 (rupa@rupa.com)> wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
--
-Rupa
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
|
|
Back to top |
|
|
mrene_lists at avgs.ca Guest
|
Posted: Tue Jun 09, 2009 10:57 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
I think a foreign key constraint is failing, should look into that
On 9-Jun-09, at 11:53 PM, Diego Viola wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
Quote: | 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 (rupa@rupa.com)> wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
--
-Rupa
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 (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
|
|
|
Back to top |
|
|
diego.viola at gmail.com Guest
|
Posted: Tue Jun 09, 2009 10:57 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
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 (diego.viola@gmail.com)> wrote:
Quote: | 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 (rupa@rupa.com)> wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
--
-Rupa
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
|
|
|
Back to top |
|
|
diego.viola at gmail.com Guest
|
Posted: Tue Jun 09, 2009 11:15 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
Any other ideas?
On Tue, Jun 9, 2009 at 11:55 PM, Mathieu Rene <mrene_lists@avgs.ca (mrene_lists@avgs.ca)> wrote:
Quote: | I think a foreign key constraint is failing, should look into that
On 9-Jun-09, at 11:53 PM, Diego Viola wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
Quote: | 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 (rupa@rupa.com)> wrote:
Quote: | 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 (diego.viola@gmail.com)> wrote:
--
-Rupa
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 (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 (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
|
|
|
Back to top |
|
|
mrene_lists at avgs.ca Guest
|
Posted: Tue Jun 09, 2009 11:22 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
If we look at the message again,
(`fs_lcr/lcr`, CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`)
REFERENCES `carriers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
And put it into words:
The contrainst names fs_lcr/lcr affecting field carrier_id, and
referencing the id field of the carriers table, fails.
In other words, the value you have for carrier_id does not match any
value of id in the carriers table.
Math
On 10-Jun-09, at 12:13 AM, Diego Viola wrote:
Quote: | (`fs_lcr/lcr`, CONSTRAINT `carrier_id` FOREIGN KEY (`carrier_id`)
REFERENCES `carriers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
|
_______________________________________________
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 |
|
Back to top |
|
|
diego.viola at gmail.com Guest
|
Posted: Tue Jun 09, 2009 11:45 pm Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
Fixed the issue, I will update the wiki now with a MySQL example.
Regards,
Diego
On Wed, Jun 10, 2009 at 12:21 AM, Mathieu Rene <mrene_lists@avgs.ca (mrene_lists@avgs.ca)> wrote:
|
|
Back to top |
|
|
diego.viola at gmail.com Guest
|
Posted: Wed Jun 10, 2009 12:11 am Post subject: [Freeswitch-users] mod_lcr for a-z rates |
|
|
Ok I have added a new MySQL example here.
http://wiki.freeswitch.org/wiki/Mod_lcr#Sample_Data
Diego
On Wed, Jun 10, 2009 at 12:43 AM, Diego Viola <diego.viola@gmail.com (diego.viola@gmail.com)> wrote:
Quote: | Fixed the issue, I will update the wiki now with a MySQL example.
Regards,
Diego
On Wed, Jun 10, 2009 at 12:21 AM, Mathieu Rene <mrene_lists@avgs.ca (mrene_lists@avgs.ca)> wrote:
|
|
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|