Hi all,
I've extended Juha's LCR module to support prefixes for gateways. We use it for prefix-based setting of the bearer capability on our gateways.
Note that the attached patch is against Juha's backport for rel_0_9_0 at http://tutpro.com/tmp/lcr-0.9.0.tgz because we've no CVS-HEAD running here.
It works as follows:
In the new table gw_cap you can define capabilities and their corresponding prefix, like:
mysql root@ser> select * from gw_cap; +--------+-----------+------------+----------------------+ | cap_id | cap_value | cap_prefix | cap_description | +--------+-----------+------------+----------------------+ | 1 | 1 | | default phone trunk | | 2 | 1 | 01 | prefixed phone trunk | | 3 | 2 | 02 | prefixed fax trunk | +--------+-----------+------------+----------------------+ 3 rows in set (0.00 sec)
In this case the cap_value of "1" means phone-capabilites, "2" means fax-capabilities.
The table gw_grp is extended with an additional column cap_id.
mysql root@ser> select * from gw_grp; +--------+-------------------------+--------+ | grp_id | grp_name | cap_id | +--------+-------------------------+--------+ | 1 | priority_1_phone | 1 | | 2 | priority_1_phone_prefix | 2 | | 3 | priority_1_fax_prefix | 3 | | 4 | priority_2_phone | 1 | | 5 | priority_2_phone_prefix | 2 | | 6 | priority_3_phone_prefix | 2 | +--------+-------------------------+--------+ 6 rows in set (0.00 sec)
In ser.cfg you can then load the gateways for example like this if you use different gateways/trunks for phone and fax:
if( /* phone call */) { if(!load_gws("1")) { sl_send_reply("500", "Internal server error, unable to load phone gateways"); break; } } else /* fax call */ { if(!load_gws("2")) { sl_send_reply("500", "Internal server error, unable to load fax gateways"); break; } }
The usage of next_gw() is as usual.
Also note that the gateway selection algorithm changes when you use load_gws("x") instead of load_gws(): The latter always selects the gateways with highest priority first. The new one uses the priority value as weight, so also gateways with lower priority are chosen. Hit ratio for 5000 rounds is as follows:
priority-1-gw-1: 35% priority-2-gw-1: 14% priority-2-gw-3: 14% priority-2-gw-2: 14% priority-2-gw-4: 14% priority-3-gw-1: 9%
Looking forward for comments/fixes/improvements, Andy
Andreas,
Did you ever get any feedback on your LCR patch as far as having it committed to CVS or having Juha incorporate it in to his official ser-0.9 backport?
Regards, Paul
On Tue, 08 Mar 2005 13:25:06 +0100, Andreas Granig andreas.granig@inode.info wrote:
Hi all,
I've extended Juha's LCR module to support prefixes for gateways. We use it for prefix-based setting of the bearer capability on our gateways.
Note that the attached patch is against Juha's backport for rel_0_9_0 at http://tutpro.com/tmp/lcr-0.9.0.tgz because we've no CVS-HEAD running here.
It works as follows:
In the new table gw_cap you can define capabilities and their corresponding prefix, like:
mysql root@ser> select * from gw_cap; +--------+-----------+------------+----------------------+ | cap_id | cap_value | cap_prefix | cap_description | +--------+-----------+------------+----------------------+ | 1 | 1 | | default phone trunk | | 2 | 1 | 01 | prefixed phone trunk | | 3 | 2 | 02 | prefixed fax trunk | +--------+-----------+------------+----------------------+ 3 rows in set (0.00 sec)
In this case the cap_value of "1" means phone-capabilites, "2" means fax-capabilities.
The table gw_grp is extended with an additional column cap_id.
mysql root@ser> select * from gw_grp; +--------+-------------------------+--------+ | grp_id | grp_name | cap_id | +--------+-------------------------+--------+ | 1 | priority_1_phone | 1 | | 2 | priority_1_phone_prefix | 2 | | 3 | priority_1_fax_prefix | 3 | | 4 | priority_2_phone | 1 | | 5 | priority_2_phone_prefix | 2 | | 6 | priority_3_phone_prefix | 2 | +--------+-------------------------+--------+ 6 rows in set (0.00 sec)
In ser.cfg you can then load the gateways for example like this if you use different gateways/trunks for phone and fax:
if( /* phone call */) { if(!load_gws("1")) { sl_send_reply("500", "Internal server error, unable to load phone gateways"); break; } } else /* fax call */ { if(!load_gws("2")) { sl_send_reply("500", "Internal server error, unable to load fax gateways"); break; } }
The usage of next_gw() is as usual.
Also note that the gateway selection algorithm changes when you use load_gws("x") instead of load_gws(): The latter always selects the gateways with highest priority first. The new one uses the priority value as weight, so also gateways with lower priority are chosen. Hit ratio for 5000 rounds is as follows:
priority-1-gw-1: 35% priority-2-gw-1: 14% priority-2-gw-3: 14% priority-2-gw-2: 14% priority-2-gw-4: 14% priority-3-gw-1: 9%
Looking forward for comments/fixes/improvements, Andy
Serdev mailing list serdev@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serdev
Hello,
Java Rockx wrote:
Did you ever get any feedback on your LCR patch as far as having it committed to CVS or having Juha incorporate it in to his official ser-0.9 backport?
See http://lists.iptel.org/pipermail/serdev/2005-March/004109.html for a comment from Francesco Botta. Seems to work fine for him.
I'll try to port it to the main branch when I have some spare time and will then get in touch with Juha for having it commited to CVS if it's ok for him.
I personally don't want to push it to the official 0.9-backport without getting it to the main branch. Should be the other way around IMHO.
Cheers, Andy
andy,
i haven't had time to study your changes yet, but basically i would accept a patch if it solves a general problem (not something that is specific to a particular user) in a general way and does not slow down the operation for those who don't need that new feature.
you can always make your own lcr_ng module if you don't like my judgement.
-- juha
Hi Andrea,
We've been testing with your patch and so far no major breaks. Seems to us that only use load_gw("X") the prefix is inserted. And also with load_gw("x") we will have weighted call distribution. Now we would like to have the prefix added to the gateways but not the call distribution. Can you tell us how to configure that?
Thanks
Ray
-----Original Message----- From: serdev-bounces@iptel.org [mailto:serdev-bounces@lists.iptel.org] On Behalf Of Andreas Granig Sent: Tuesday, March 08, 2005 8:25 PM To: 'serdev@lists.iptel.org'; 'serusers@lists.iptel.org' Subject: [Serdev] LCR-module extension for GW prefixes
Hi all,
I've extended Juha's LCR module to support prefixes for gateways. We use it for prefix-based setting of the bearer capability on our gateways.
Note that the attached patch is against Juha's backport for rel_0_9_0 at http://tutpro.com/tmp/lcr-0.9.0.tgz because we've no CVS-HEAD running here.
It works as follows:
In the new table gw_cap you can define capabilities and their corresponding prefix, like:
mysql root@ser> select * from gw_cap; +--------+-----------+------------+----------------------+ | cap_id | cap_value | cap_prefix | cap_description | +--------+-----------+------------+----------------------+ | 1 | 1 | | default phone trunk | | 2 | 1 | 01 | prefixed phone trunk | | 3 | 2 | 02 | prefixed fax trunk | +--------+-----------+------------+----------------------+ 3 rows in set (0.00 sec)
In this case the cap_value of "1" means phone-capabilites, "2" means fax-capabilities.
The table gw_grp is extended with an additional column cap_id.
mysql root@ser> select * from gw_grp; +--------+-------------------------+--------+ | grp_id | grp_name | cap_id | +--------+-------------------------+--------+ | 1 | priority_1_phone | 1 | | 2 | priority_1_phone_prefix | 2 | | 3 | priority_1_fax_prefix | 3 | | 4 | priority_2_phone | 1 | | 5 | priority_2_phone_prefix | 2 | | 6 | priority_3_phone_prefix | 2 | +--------+-------------------------+--------+ 6 rows in set (0.00 sec)
In ser.cfg you can then load the gateways for example like this if you use different gateways/trunks for phone and fax:
if( /* phone call */) { if(!load_gws("1")) { sl_send_reply("500", "Internal server error, unable to load phone gateways"); break; } } else /* fax call */ { if(!load_gws("2")) { sl_send_reply("500", "Internal server error, unable to load fax gateways"); break; } }
The usage of next_gw() is as usual.
Also note that the gateway selection algorithm changes when you use load_gws("x") instead of load_gws(): The latter always selects the gateways with highest priority first. The new one uses the priority value as weight, so also gateways with lower priority are chosen. Hit ratio for 5000 rounds is as follows:
priority-1-gw-1: 35% priority-2-gw-1: 14% priority-2-gw-3: 14% priority-2-gw-2: 14% priority-2-gw-4: 14% priority-3-gw-1: 9%
Looking forward for comments/fixes/improvements, Andy