Hello Камиль

Thank you so much for your response. Basically, what I have done is created
a table `dr_rates`:

+--------+----------------------------------------+--------+--------------+----------+------------------+-------------+----------+
| rateid | destination                         | cc     | prefix      |
listrate | retailrate     | currency | carrier |
+--------+----------------------------------------+--------+--------------+----------+------------------+--------------+---------+
|   5839 | Canada 416 Metro Toronto | 1      |        1416 |   0.0028 |
 0.00364 | USD        | TN1 |
+--------+----------------------------------------+--------+--------------+----------+------------------+--------------+---------+

And in `dr_rules`

+---------+-----------+--------+---------+--------------+---------+--------+-------------+------------------------------------------------------+
| ruleid  | groupid | prefix | timerec | priority | routeid | gwlist |
attrs    | description                                        |
+---------+-----------+--------+---------+--------------+---------+--------+-------------+-------------------------------------------------------+
|   5839 | 0         | 1416   |           |        1     | 0       |
 | yes          |   Route for Canada 416 Metro Toronto |
+---------+-----------+--------+---------+--------------+---------+--------+-------------+-------------------------------------------------------+


​For scalability reasons as mentioned with Muhammad, we would like on every
call to fire a perl script that would
query the database, and pull all the prefix for the dialled number order by
price ascending. I don't know much about
prefixes and types of tricks carrier like to play longest vs. shortest
matching etc however, what I am thinking about is:


1) Pull up all records for the dialed CC
2) If CC is 1 digit substring the first four digits of prefix
2) If CC is 2 digits substring the first five digits of prefix
2) If CC is 3 digits substring the first six digits digits of prefix

>From all those relevant records, order by price ascending.

If the gateway for least expensive route fails, try the next route etc...

Nice and simple I think? If anyone feels there is anything wrong with this,
I would really
appreciate your input. Also, if anyone can write this perl script easily, I
would be happy
to compensate for it.

Kind Regards,

Nick.
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to