> This occurs because the rules with id=1 and id=3
do match the INVITE
> so if the first fails (longest matching prefix) the other will be
> executed. This is how LCR works.
>
> Use load_gws() with a pseudo-variable as I recommend you in the other
> mail so you won't rely on the From URI but on the call origin you have
> previously analized in the script.
>
It works :)
In lcr:
+----+-----------+----------------+--------+----------+
| id | prefix | from_uri | grp_id | priority |
+----+-----------+----------------+--------+----------+
| 1 | 48 | ^from_sip$ | 1 | 1 |
| 2 | 48 | ^from_pstn$ | 2 | 1 |
+----+-----------+----------------+--------+----------+
gw,
+----+--------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
| id | gw_name | grp_id | ip_addr | hostname | port |
uri_scheme | transport | strip | tag | weight | ping | flags |
+----+--------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
| 1 | CLI48 | 1 | 77.77.77.70 | NULL | 5060 | NULL |
NULL | NULL | NULL | 150 | 0 | 0 |
| 2 | CLI48backup | 1 | 77.77.77.71 | NULL | 5060 |
NULL | NULL | NULL | NULL | 150 | 0 | 0 |
| 3 | CLI49 | 1 | 77.77.77.75 | NULL | 5060 | NULL |
NULL | NULL | NULL | 15 | 0 | 0 |
| 4 | CLI49backup | 1 | 77.77.77.76 | NULL | 5060 |
NULL | NULL | NULL | NULL | 15 | 0 | 0 |
| 5 | SIPWORLD | 2 | 88.88.88.88 | NULL | 5060 |
NULL | NULL | NULL | NULL | 250 | 0 | 0 |
+----+--------------+--------+----------------+----------+------+------------+-----------+-------+------+--------+------+-------+
if (allow_source_address("1")) {
$var(origin) = "from_sip";
}
else if (allow_source_address("2")) {
$var(origin) = "from_pstn";
}
else {
sl_send_reply("403", "Forbidden");
exit;
where "1" and "2" are MGWs and SIPWORLD ips.
Then load_gws("$var(origin)") is called.
But still one issue remains (only from SIPWORLD ---> Kamailio ---->
MGWs scenario).
As aforementioned i need to inspect calling number and choose proper
MGWs to have the call terminated.
I need to be able to identify calling numbers like 48 (only two
starting digits), 48221112233 (the whole number), and the rest.
Is there any way i can implement this functionality with lcr module?
Thx,
Maciej.