<div dir="ltr">Hello Muhammad,<div><br></div><div style>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:</div>
<div style><br></div><div style>OpenSIPS-In(Security, Internal Routing, LB, CDR)--&gt;Asterisk(Billing, Prepaid, CDR)--&gt;OpenSIPS-Out(LCR,CDR)</div><div style><br></div><div style>Now in OpenSIPS-Out we load all the external service provider routes. As you know :), the data we are working with looks something like:</div>
<div style><br></div><div style><div>County,           Prefix, Price, Carrier</div><div>AFGHANISTAN, 93,    0.1789, 0</div><div>AFGHANISTAN, 93,    0.1989, 1</div><div>AFGHANISTAN, 93,    0.1189, 2</div><div>AFGHANISTAN, 93,    0.1289, 3</div>
<div><br></div><div style>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):</div>
<div style><br></div><div style>*dr_rules*</div><div style><br></div><div style><div> ruleid | groupid | prefix | timerec | priority | routeid | gwlist | attrs | description|</div><div>+--------+---------+--------+---------+----------+---------+--------+-------+-------------------------------------+</div>
<div>|     1   | 1       |     93   |         |        1 | 0       | 1      | 2,3,0,1   | Route for Afghanistan |</div><div>+--------+---------+--------+---------+----------+---------+--------+-------+-------------------------------------+<br>
</div><div><br></div><div>And an additional table (call it dr_rates for example), and it would have:<br></div><div style><br></div><div style>id, country, prefix (FK to dr_rules.prefix), price, carrier</div><div style><br>
</div><div style>*dr_gateways*</div><div style><br></div><div style><div>+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+</div><div>| id | gwid | type | address                    | strip | pri_prefix | attrs | probe_mode | description     |</div>
<div>+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+</div><div>|  1 | 1    |    2    | carrier_address:5060 |     0 | 0011101    | yes   |          0 | Carrier 0           |</div>
<div>+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+</div><div>|  1 | 1    |    2    | carrier_address:5060 |     0 |                 | yes   |          0 | Carrier 1           |<br>
</div><div><div>+----+------+------+-------------------+-------+------------+-------+------------+----------------------------------------+</div></div><div><br></div><div>...<br></div><div><br></div><div style>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.</div>
<div style><br></div><div style>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...</div><div style><br></div><div style><br>
</div><div style>Kind Regards,</div><div style><br></div><div style>Nick.</div></div></div><div><br></div></div><div style><br></div></div>