What is the best way to detect whether an INVITE message came from a certain IP address? I.e. if a call comes from a certain asterisk box?
I have thought of using the textops search(), but this seems a little clumsy. Perhaps there is a way to get directly at the via headers? Or is there a keyword of corresponding functionality to the uri keyword?
Thanks, Mark Price
Perhaps the Source IP address pseudo variable is what you are looking for.
Reference to it can be found at: http://openser.org/docs/pseudo-variables-1.1.x.htm Section: 3.45. IP source address
With $si on one side of the equation, you need something on the other side. This can be perhaps a hardcoded IP address or perhaps an $avp() variable. Pretty much any business logic can be used to pull an IP out of a database table and put it into an avp variable.
With $si on one side of the equation and an $avp() on the other, you can then perform various comparisons.
Another approach might be to use the permissions module and the "trusted" table. Using this method, a simple "allow_trusted()" call can be made to determine is an address is "trusted".
Hope this helps.
Regards, Norm
Mark Price wrote:
What is the best way to detect whether an INVITE message came from a certain IP address? I.e. if a call comes from a certain asterisk box?
I have thought of using the textops search(), but this seems a little clumsy. Perhaps there is a way to get directly at the via headers? Or is there a keyword of corresponding functionality to the uri keyword?
Thanks, Mark Price
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Hi,
the most trivial way is:
if (src_ip==111.222.111.222) { }
regards, bogdan
Norman Brandinger wrote:
Perhaps the Source IP address pseudo variable is what you are looking for.
Reference to it can be found at: http://openser.org/docs/pseudo-variables-1.1.x.htm Section: 3.45. IP source address
With $si on one side of the equation, you need something on the other side. This can be perhaps a hardcoded IP address or perhaps an $avp() variable. Pretty much any business logic can be used to pull an IP out of a database table and put it into an avp variable.
With $si on one side of the equation and an $avp() on the other, you can then perform various comparisons.
Another approach might be to use the permissions module and the "trusted" table. Using this method, a simple "allow_trusted()" call can be made to determine is an address is "trusted".
Hope this helps.
Regards, Norm
Mark Price wrote:
What is the best way to detect whether an INVITE message came from a certain IP address? I.e. if a call comes from a certain asterisk box?
I have thought of using the textops search(), but this seems a little clumsy. Perhaps there is a way to get directly at the via headers? Or is there a keyword of corresponding functionality to the uri keyword?
Thanks, Mark Price
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users