[Serusers] HELP - lookup("aliases") not working

Java Rockx javarockx at yahoo.com
Thu Sep 23 16:22:04 CEST 2004


I'm still struggling with getting aliases to work. I've included many details
of my configuration. Can anyone see why lookup("aliases") doesn't work?

Regards,
Paul

"serctl alias add 2025551234 sip:1000 at mycompany.com" returns

        200 Added to table
        ('2025551234','sip:1000 at mycompany.com') to 'aliases'

"serctl alias show 2025551234 at mycompany.com" returns

        <sip:2025551234 at mycompany.com>;q=1;expires=-7

"mysql> select username, domain, contact from aliases;" returns

        +-------------+--------+------------------------+
        | username    | domain | contact                |
        +-------------+--------+------------------------+
        | 2025551234  |        | sip:1000 at mycompany.com |
        +-------------+--------+------------------------+
        1 row in set (0.00 sec)


For simplicity purposes I'm using this really simple ser.cfg. NOTE: MySQL is
enabled in my ser.cfg.

route{

	xlog("L_ERR", "LOG MSG 0:");
	xlog("L_ERR", "      method        : %rm");
	xlog("L_ERR", "      source ip     : %is");
	xlog("L_ERR", "      request uri   : %ru");
	xlog("L_ERR", "      to uri        : %tu");
	xlog("L_ERR", "      contact header: %ct");
	xlog("L_ERR", "      from uri      : %fu");

	# initial sanity checks here
        ...

	if (!method=="REGISTER") record_route();	

	if (loose_route()) {
		route(1);
		break;
	};

	xlog("L_ERR", "LOG MSG 1:");
	xlog("L_ERR", "      method        : %rm");
	xlog("L_ERR", "      source ip     : %is");
	xlog("L_ERR", "      request uri   : %ru");
	xlog("L_ERR", "      to uri        : %tu");
	xlog("L_ERR", "      contact header: %ct");
	xlog("L_ERR", "      from uri      : %fu");

	if (!uri==myself) {
		route(1);
		break;
	};

	if (uri==myself) {

		if (method=="REGISTER") {

			if (!www_authorize("mycompany.com", "subscriber")) {
				www_challenge("mycompany.com", "0");
				break;
			};

			save("location");
			break;
		};

		xlog("L_ERR", "LOG MSG 2:");
		xlog("L_ERR", "      method        : %rm");
		xlog("L_ERR", "      source ip     : %is");
		xlog("L_ERR", "      request uri   : %ru");
		xlog("L_ERR", "      to uri        : %tu");
		xlog("L_ERR", "      contact header: %ct");
		xlog("L_ERR", "      from uri      : %fu'");

		lookup("aliases");

		xlog("L_ERR", "LOG MSG 3:");
		xlog("L_ERR", "      method        : %rm");
		xlog("L_ERR", "      source ip     : %is");
		xlog("L_ERR", "      request uri   : %ru");
		xlog("L_ERR", "      to uri        : %tu");
		xlog("L_ERR", "      contact header: %ct");
		xlog("L_ERR", "      from uri      : %fu");

		if (!uri==myself) {
			append_hf("P-hint: outbound alias\n"); 
			if (!t_relay()) sl_reply_error();
			break;
		};

		if (!lookup("location")) {
			sl_send_reply("404", "Not Found");
			break;
		};
	};

	if (!t_relay()) sl_reply_error();
}



"ngrep -W byline 2025551234 port 5060" shows


INVITE sip:2025551234 at mycompany.com;user=phone SIP/2.0.
Via: SIP/2.0/UDP 12.9.8.30:55426;branch=z9hG4bKae0d85e2f16ba73c.
From: "Paul" <sip:1010 at mycompany.com;user=phone>;tag=80578d1984094720.
To: <sip:2025551234 at mycompany.com;user=phone>.
Contact: <sip:1010 at 12.9.8.30:55426;user=phone>.
Call-ID: f827df1838656746 at 172.16.1.34.
CSeq: 8477 INVITE.
User-Agent: Grandstream BT100 1.0.5.11.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
Content-Type: application/sdp.
Content-Length: 395.

SIP/2.0 404 Not Found.
Via: SIP/2.0/UDP 12.9.8.30:55426;branch=z9hG4bKae0d85e2f16ba73c.
From: "Paul" <sip:1010 at mycompany.com;user=phone>;tag=80578d1984094720.
To: <sip:2025551234 at mycompany.com;user=phone>;tag=bf952ed189d84485aa0b6f1.d8ae



and my /var/log/messages shows these entries from the xlog statments:

LOG MSG 0:
      method        : INVITE
      source ip     : 12.9.8.30
      request uri   : 2025551234 at mycompany.com;user=phone
      to uri        : sip:2025551234 at mycompany.com;user=phone
      contact header: <sip:1010 at 12.9.8.30:55426;user=phone>
      from uri      : sip:1010 at mycompany.com;user=phone
LOG MSG 1:
      method        : INVITE
      source ip     : 12.9.8.30
      request uri   : 2025551234 at mycompany.com;user=phone
      to uri        : sip:2025551234 at mycompany.com;user=phone
      contact header: <sip:1010 at 12.9.8.30:55426;user=phone>
      from uri      : sip:1010 at mycompany.com;user=phone
LOG MSG 2:
      method        : INVITE
      source ip     : 12.9.8.30
      request uri   : 2025551234 at mycompany.com;user=phone
      to uri        : sip:2025551234 at mycompany.com;user=phone
      contact header: <sip:1010 at 12.9.8.30:55426;user=phone>
      from uri      : sip:1010 at mycompany.com;user=phone
LOG MSG 3:
      method        : INVITE
      source ip     : 12.9.8.30
      request uri   : 2025551234 at mycompany.com;user=phone
      to uri        : sip:2025551234 at mycompany.com;user=phone
      contact header: <sip:1010 at 12.9.8.30:55426;user=phone>
      from uri      : sip:1010 at mycompany.com;user=phone


--- Andrei Pelinescu-Onciul <pelinescu-onciul at fokus.fraunhofer.de> wrote:

> On Sep 22, 2004 at 13:34, Java Rockx <javarockx at yahoo.com> wrote:
> > Hello all.
> > 
> > I'm using ser from the CVS head branch. When my ser.cfg calls
> lookup("aliases")
> > nothing seems to be returned.
> > 
> > I have a real user named "1000" which works since I can originate and
> recieve
> > calls.
> > 
> > I need to alias this because I need this user to receive calls from the
> PSTN.
> > 
> > I have used serctl to create an alias with the following command:
> > 
> >        serctl add 2025551234 sip:1000 at mycompany.com
>         serctl alias add ....
> > 
> > I also verified that this new alias is in the mysql database ser.aliases
> table
> What does serctl alias show 2025551234 at mycompany.com say?
> > 
> > Now I make a call from a land line to 2025551234 and I use ngrep on my sip
> > proxy to monitor port 5060. I see that a 404 is always returned after the
> > statement
> 
> How does the uri look? Is it 2025551234 at mycompany.com? If not are you
> re-writing it from your config?
> 
> 
> Andrei
> 




		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com




More information about the sr-users mailing list