[Serusers] Matching of src_ip, what am I doing wrong?

Nils Ohlmeier nils at iptel.org
Wed May 21 23:23:50 CEST 2003


Hi,

On Wednesday 21 May 2003 23:14, Jamin W. Collins wrote:
> The problem comes when one of the phones is not registered properly with
> the SER proxy and the PBX requests it.  The request fails the location
> lookup and is sent back to the PBX.  To correct this I've tried matching
> the "src_ip" to see if the request is from the PBX however this doesn't
> appear to work.  I have the following condition in the ser.cfg,
> shouldn't this stop requests from 1.2.3.4 being sent back to 1.2.3.4?
>
>    if (!lookup("location")) {
>
>       log(1, "Location lookup failure.");
>
>       if (src_ip=="1.2.3.4") || (src_ip=="1.2.3.6") {
                    ^       ^              ^       ^
Please remove the "" around the IPs.
And i'm not sure if the () || () works for an if. Please try (()||()) instead 
to be safe (optional it should be possible to ommit the brackets around the 
IP compares e.g. (||) ).

>          log(1, "Request from first server.");
>          sl_reply_error();
>
>       } else {
>
>          rewritehost("1.2.3.4");
>          log (1, "Sending request to the first server.");
>          t_on_negative("1");
>          t_relay();

This statement causes the behavior you are describing. You set the destination 
to 1.2.3.4 and rely it.

Regards
  Nils Ohlmeier

>       };
>
>       break;
>    };




More information about the sr-users mailing list