[Serusers] What exactly does "lookup" lookup?

Brian McCrary bmccrary at lwav.net
Thu Apr 14 22:37:09 CEST 2005


Hello,

I hope I'm not asking a really stupid question here, but here goes...

I'm setting up a new SER installation and have it running pretty
smoothly now for authenticated outbound traffic.  The problem comes when
trying to route incoming traffic through.  

My routing plans are pretty simple, when a number comes into SER,
see if it it's a registered SIP phone, if so send the call to it, and
if not, then authenticate the user, and send it to the PSTN gateway.  

I thought this could easily be solved by having a lookup("location") as
the first part of my routing.  However, I'm not really sure what lookup
looks up.  I assume it's the user being dialed, such as if a call comes
in wanting sip:1234567890 at x.x.x.x, lookup would look into the database
and see user "1234567890" matches a registered user, and go from there.
However, using lookup never returns a match, thus the call goes into a
loop since it's next stop is the PSTN gateway.  I can see the phone has
registered by running serctl ul show.

Here's part of my routing I tried using, I may be incorrect in using
t_relay, but right now lookup is never true:

if (method=="INVITE") {
                        if (lookup("location")) {
			log("LOG: SIP Phone found\n");
                        t_relay();
                        break; 
                       } else if (uri=~"sip:[0-9]+ at .*") { 
                       if (!is_user_in("credentials", "local")) {
                       sl_send_reply("403", "Forbidden");
                       break;
                       };

rewritehostport("10.0.0.4:5060");  # PSTN GW

Brian




More information about the sr-users mailing list