[asterisk-users] Conditional IF based on IP address?

Rushowr rushowr at phreaker.net
Wed Sep 6 13:10:45 MST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Steve Hsieh wrote:
> Thanks, Russ!
>  
> Any suggestions on how to apply a subnet mask so that I can match an IP
> that belongs to 192.168.0.0/23 <http://192.168.0.0/23>, for example? Or
> would the only way be to match the string using REGEX?
> 
>  
> On 9/6/06, *Rushowr* <rushowr at phreaker.net
> <mailto:rushowr at phreaker.net>> wrote:
> 
>     -----BEGIN PGP SIGNED MESSAGE-----
>     Hash: SHA1
> 
>     Rushowr wrote:
>     > Steve Hsieh wrote:
>     >> Greetings,
>     >
>     >> Is it possible to create a conditional IF inside extensions.conf
>     based
>     >> on the source IP address of a SIP phone (as opposed to
>     extension)?  What
>     >> I would like to do is the following:
>     >
>     >
>     >> 1. If SIP phone IP belongs to 192.168.0.0/24
>     <http://192.168.0.0/24> <http://192.168.0.0/24>
>     >> subnet, set CALLERID=xxxx
>     >> 2. Else, set CALLERID=yyyy
>     >
>     >> Thanks in advance for any examples or help.
>     >
>     >> Steve
>     >
>     >
>     >>
>     ------------------------------------------------------------------------
>     >
>     >> _______________________________________________
>     >> --Bandwidth and Colocation provided by Easynews.com
>     <http://Easynews.com> --
>     >
>     >> asterisk-users mailing list
>     >> To UNSUBSCRIBE or update options visit:
>     >>     http://lists.digium.com/mailman/listinfo/asterisk-users
>     > Steve, yes you can do it.
>     >
>     > You'll need to use the SIPPEER function (available in trunk only I
>     > believe) to get ${SIPPEER(ipaddr)}. You can then use Set and If()
>     to do
>     > what you want.
>     >
>     > SKM
> 
>     I'm sorry, you need ${SIPPEER(${EXTEN}|ipaddr)} to retrieve the data you
>     want
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
Your best bet would be to use the REGEX function to match the first
three octets :)

Rushowr
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: ENCRYPTED WITH GPG

iD8DBQFE/ytFlfQsv7FBhp8RAmEiAKCQSU1mDLzuV+CC04tWm6cx6KLpwwCeLIpy
22YfgsC2WPtgnWSSBp4KG9k=
=FT10
-----END PGP SIGNATURE-----



More information about the asterisk-users mailing list