Hi,
Well, this piece of code looks correct, but it is out of context. It may be the way your config file is that makes you always hit the else. Other than that ... have you checked the obvious? is the user really registered (check with >serctl ul show)? the function checks the request uri, is that what you want? do you modify the request uri before this point? What version of ser are you running?
One question ... why do you rewrite host and port? if the user is already registered, just doing a lookup("location") would be enough to for the uri to be rewritten to the contact and then you can t_relay it ... no need to do the localhost:5061
C.
On 6/1/05, Bastian Schern ml01@in-bln.de wrote:
It looks like that I looked for, but it will not work on my SER: --- snip --- if( registered( "location" ) ) { rewritehostport( "localhost:5061" ); } else { log( 1, "ERR: <403> Unauthorized call\n" ); sl_send_reply( "403", "Unauthorized call" ); break; }; --- snap ---
It will always do the "else" condition. Did I made something wrong?
Regrds Bastian
Cesc schrieb:
Hi,
I think you are looking for the function registered("location")
Regards,
C.
On 5/31/05, Bastian Schern ml01@in-bln.de wrote:
Hello everybody,
is it possible to check if a user is already registered or authenticated?
I want to allow only registered users call to PSTN destinations.
Regards Bastian