Hi you can use check_to function from uri module that Check To username against URI table or digest credentials, see my example: if (method == "REGISTER") {
if (!www_authorize("mydomain.com.pe http://mydomain.com.pe", "subscriber")) { log(1," ----- Fails to Register \n"); www_challenge("mydomain.com.pe http://mydomain.com.pe", "0"); break; };
# only registered users are allowed if (!check_to()) { log(1, "LOG: Hijack!!!--> unregistered user registration attempt\n"); sl_send_reply("403", "hijack attempt!!!! Only registered users are allowed"); break; }; log(1," Registered!!! \n"); if (!save("location")) { sl_reply_error(); }; break; };
if ((method == "INVITE" || method== "CANCEL" || method== "ACK")) {
log(1, "ANALYZING INVITE||CANCEL REQUESTs\n"); if (!proxy_authorize("mydomain.com.pe http://mydomain.com.pe", "subscriber")) { proxy_challenge("mydomain.com.pe http://mydomain.com.pe", "1"); break; } else { if (method == "INVITE" && !check_from()) { sl_send_reply("403", "Only registered users are allowed"); break; }; };
/* *********** Dial out to Local and PSTN logic ********* */
if(uri=~"^sip:001[0-9][0-9][1-9]*@(mydomain.com.pe)"){ rewritehostport("IP_Gateway:5060"); log(1,"digit expression match - pstn 001\n"); if(!t_relay()){ sl_reply_error(); }; break; }; . . . .
hope it helps,
rafael
On 5/10/05, Edgardo O. Gonzales II edgardo.g@pacific.net.ph wrote:
Hi!
How will I check if user is authenticated or not before I permit him to make a call.
thanks, ed
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers