Hi All, i want to stop second registration request if use already registered i am using below code but getting no any response. please help me how to solve this problem.
if (method=="REGISTER") { if (registered("location") ) { xlog("L_NOTICE","Asif: lookup(location) Passed\n"); sl_send_reply("699", "User Not Found"); return; } route(2); return;
route[2] {
# ----------------------------------------------------------------- # REGISTER Message Handler # ---------------------------------------------------------------- xlog("L_NOTICE","Danish: Entering route[2]\n"); # if (registered("location")) { # xlog("L_NOTICE","Asif: lookup(location) failed\n"); # sl_send_reply("404", "User Not Found"); # return; # };
xlog("L_NOTICE","Asif: Register message IPsrcaddr [$si], RecvdIPaddr[$Ri]\n"); if (!search("^Contact:[ ]**") && nat_uac_test("2")) { xlog("L_NOTICE","Danish: In route[2] Found Nated contact\n"); setflag(6); setbflag(6); # if you want OPTIONS natpings uncomment next setbflag(7); fix_nated_register(); force_rport(); };
sl_send_reply("100", "Trying");
if (!radius_www_authorize("abc.com")) { www_challenge("abc.com", "1"); }; consume_credentials();
if (!save("location")) { sl_reply_error(); };
} }
regards, Asif
What do you mean by "no[t] getting any response?"
Mian M Asif wrote:
Hi All, i want to stop second registration request if use already registered i am using below code but getting no any response. please help me how to solve this problem.
if (method=="REGISTER") { if (registered("location") ) { xlog("L_NOTICE","Asif: lookup(location) Passed\n"); sl_send_reply("699", "User Not Found"); return; } route(2); return;
route[2] {
# ----------------------------------------------------------------- # REGISTER Message Handler # ---------------------------------------------------------------- xlog("L_NOTICE","Danish: Entering route[2]\n"); # if (registered("location")) { # xlog("L_NOTICE","Asif: lookup(location) failed\n"); # sl_send_reply("404", "User Not Found"); # return; # };
xlog("L_NOTICE","Asif: Register message IPsrcaddr [$si],
RecvdIPaddr[$Ri]\n"); if (!search("^Contact:[ ]**") && nat_uac_test("2")) { xlog("L_NOTICE","Danish: In route[2] Found Nated contact\n"); setflag(6); setbflag(6); # if you want OPTIONS natpings uncomment next setbflag(7); fix_nated_register(); force_rport(); };
sl_send_reply("100", "Trying"); if (!radius_www_authorize("abc.com")) { www_challenge("abc.com", "1"); }; consume_credentials(); if (!save("location")) { sl_reply_error(); };
} }
regards, Asif
Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
Mian M Asif wrote:
if (method=="REGISTER") { if (registered("location") ) { xlog("L_NOTICE","Asif: lookup(location) Passed\n"); sl_send_reply("699", "User Not Found"); return; }
Use "exit;" instead of "return;".
Cheers, ARIF
Use the following config:
$var(temp) = $ruri; $ruri = $fu; if(registered("location")) { sl_send_reply("699", "User Not Found"); xlog("L_NOTICE","ARIF: Already Registered\n"); exit; } $ruri = $var(temp);
Cheers, ARIF
On 10/27/08 09:08, arif.zaman wrote:
Use the following config:
$var(temp) = $ruri; $ruri = $fu; if(registered("location")) { sl_send_reply("699", "User Not Found"); xlog("L_NOTICE","ARIF: Already Registered\n"); exit; } $ruri = $var(temp)
this is not right. That registration might be an update for the existing registration. You have to check the contact address, maybe the source IP address and port and other attributes of the location record.
All these are available by using truck (development version to be released as 1.5.0), see here some examples that can be reused at some extent:
http://openser.blogspot.com/2008/10/registrar-enhancements.html
Cheers, Daniel
miconda wrote:
All these are available by using truck (development version to be released as 1.5.0), see here some examples that can be reused at some extent: http://openser.blogspot.com/2008/10/registrar-enhancements.html
Yes, reg_fetch_contacts() fetches the contacts for 'uri'. and does more operations to make available attributes associated with registered contacts: http://www.kamailio.org/docs/modules/devel/registrar.html#id2506813
Cheers, ARIF