Hello,
On 10/19/08 14:32, Arif-Uz-Zaman wrote:
Hi,
Here is a tricky sample config to check if a user is calling from a
registered device and if not, deny the call:
$var(temp) = $ruri;
$ruri = $fu;
if(!registered("location")) {
sl_send_reply("403","Forbidden auth ID");
xlog("<ARIF> Not Found\n");
exit;
}
$ruri = $var(temp);
in the trunk (so available with upcoming 1.5.0) you can do more strict
checks. While you are sure an user is registered, you cannot detect if
he is calling from registered device or a different one. You just know
it has a valid contact in location database.
Here is an example to check Contact address in INVITE is same as one in
location table:
http://openser.blogspot.com/2008/10/registrar-enhancements.html
As you get access to all attributes stored for a location record, you
can do many other tests, like source IP and port, etc.
Cheers,
Daniel
Yes, i've tested trunk and it works for me!
if(!reg_fetch_contacts("location", "$fu", "caller")) {
sl_send_reply("403", "Please register first");
exit;
}