[OpenSIPS-Users] LCR Route Prefixes -> Gateways (From Scratch)

Nick Khamis symack at gmail.com
Mon Aug 5 19:41:45 CEST 2013


Hello Muhammad,

Thanks again for your response. I took a look at call-control, and since we
handle call duration on our Asterisk server using AGI script, we are not
worried about limiting calls on this server (or did I miss something?).
Basically what we have is:

OpenSIPS-In(Security, Internal Routing, LB, CDR)-->Asterisk(Billing,
Prepaid, CDR)-->OpenSIPS-Out(LCR,CDR)

Now in OpenSIPS-Out we load all the external service provider routes. As
you know :), the data we are working with looks something like:

County,           Prefix, Price, Carrier
AFGHANISTAN, 93,    0.1789, 0
AFGHANISTAN, 93,    0.1989, 1
AFGHANISTAN, 93,    0.1189, 2
AFGHANISTAN, 93,    0.1289, 3

You are correct!!! The one-one relationship will not work for obvious
reasons, and also because of the `gw_list` field in dr_rules. In essence
(and I am asking here), we would have (note: gw_list reflects LCR above):

*dr_rules*

 ruleid | groupid | prefix | timerec | priority | routeid | gwlist | attrs
| description|
+--------+---------+--------+---------+----------+---------+--------+-------+-------------------------------------+
|     1   | 1       |     93   |         |        1 | 0       | 1      |
2,3,0,1   | Route for Afghanistan |
+--------+---------+--------+---------+----------+---------+--------+-------+-------------------------------------+

And an additional table (call it dr_rates for example), and it would have:

id, country, prefix (FK to dr_rules.prefix), price, carrier

*dr_gateways*

+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+
| id | gwid | type | address                    | strip | pri_prefix |
attrs | probe_mode | description     |
+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+
|  1 | 1    |    2    | carrier_address:5060 |     0 | 0011101    | yes   |
         0 | Carrier 0           |
+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+
|  1 | 1    |    2    | carrier_address:5060 |     0 |                 |
yes   |          0 | Carrier 1           |
+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+

...

Now we can either determine the `gw_list` order using data pre-processing
or perl-script that fires for every call. Either solution should be easy to
implement however, the former would prove better performance but would
require additional manual process (i.e., running the script that would
order the gateway list based on rate). Any thoughts would be greatly
appreciated.

On a side note, I would really hate to know that I am re-inventing the
wheel so if there is something that already does this *PLEASE*, let us
know...


Kind Regards,

Nick.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130805/d7dd28e5/attachment-0001.htm>


More information about the Users mailing list