[OpenSIPS-Users] drouting: is_from_gw() does not detect requests from (redundant) PSTN gateways

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri May 29 16:08:49 CEST 2009


Hi Rene,

So, just to be sure I understand correctly  - the GW is asymmetric when 
comes to ports (between receiving on 5060 and sending from whatever 
port), right?

If so, the fix will be to make the function to ignore the port test if 
the "address" field has no port - no port means any port.

Regards,
Bogdan

Rene de Vall wrote:
> Greetings,
>
> ..we are experiencing the following problem:
>
> We use 2 gateways from/to the PSTN, both are datafilled in the table 
> dr_gateways with type = 1.  In our routing script we use 
> is_from_gw("1") to filter requests coming from the PSTN gateways.
>
> Unfortunately the function does not detect these requests.
>
> It seems that the code in drouting.c (is_from_gw_1) uses not only the 
> ip address but also the source-port of the request to 
> compare/match/find the gateway. As the gateways do not use 5060 as 
> their source port when forwarding requests to OpenSIPS, is_from_gw_1 
> does not find a match in the gateway list.
>
> Is this intended per design ?
> And if it is intended, could you please be so kind and advice a 
> workaround ?
> Please no "if ($si == 'x.x.x.x')" based workarounds, as this should be 
> provisioned via database (eg. mysql), without the need to rewrite the 
> routing script every time a change is required.
>
> Our drouting datafill looks like this:
>
> >select * from dr_gateways;
> +------+------+--------------------+-------+------------+-------+-------------+
> | gwid | type | address            | strip | pri_prefix | attrs | 
> description |
> +------+------+--------------------+-------+------------+-------+-------------+
> |    1 |    1 | 10.0.1.75          |     0 |            |       | 
> pstn1       |
> |    2 |    1 | 10.0.1.76          |     0 |            |       | 
> pstn2       |
> |    3 |    2 | 10.0.2.61          |     0 |            |       | 
> ocs         |
> |    4 |    4 | 10.0.2.107         |     0 |            |       | 
> pbx1        |
> |    5 |    4 | 10.0.2.207         |     0 |            |       | 
> pbx2        |
> |    6 |    4 | 10.0.2.109         |     0 |            |       | 
> pbx3        |
> |    7 |    4 | 10.0.2.209         |     0 |            |       | 
> pbx4        |
> +------+------+--------------------+-------+------------+-------+-------------+
>
> >select * from dr_rules;
> +--------+---------+-------------+---------+----------+---------+---------+---------------+
> | ruleid | groupid | prefix      | timerec | priority | routeid | 
> gwlist  | description   |
> +--------+---------+-------------+---------+----------+---------+---------+---------------+
> |      1 | 0       |             |         |       50 |       0 | 
> 1,2     | pstn1+pstn2   |
> |      2 | 0       | 0043222254  |         |       50 |       0 | 
> 3       | ocs           |
> |      3 | 0       | 00432220045 |         |       50 |       0 | 
> 4,5,6,7 | pbx           |
> +--------+---------+-------------+---------+----------+---------+---------+---------------+
>
> We are using OpenSIPS 1.5.1 on Red Hat Enterprise Linux 5.
>
> Looking forward to hear/read your answers and best regards,
>
> René de Vall
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   




More information about the Users mailing list