[Serusers] username numeric routing

Harold Workman hworkman at cytelcom.com
Tue Apr 13 19:01:06 CEST 2004


Just a quick question....I am using numerics as the username (ex. 111000001)
of
my hosts.  I am able to make pstn calls through my pstn gateway.  My
question is how
do i configure the routing request lock to allow ip to ip calls between two
hosts.  if i
dial 111000002 it routes the call to the pstn instead of to the other host.



here is my config so far.


# -------------------------  request routing logic -------------------
route{

	# initial sanity checks -- messages with
	# max_forwards==0, or excessively long requests
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		break;
	};
	if ( msg:len > max_len ) {
		sl_send_reply("513", "Message too big");
		break;
	};

	# we record-route all messages -- to make sure that
	# subsequent messages will go through our proxy; that's
	# particularly good if upstream and downstream entities
	# use different transport protocol
	record_route();
	# loose-route processing
	if (loose_route()) {
		t_relay();
		break;
	};


# is it a PSTN destination? (is username nummerical and does not begin with
8?)


if (uri=~"^sip:[0-79][0-9]*@") { # ... forward to gateways then;
      # check first to which PSTN destination the requests goes;
      # if it is US (prefix "1"), use the gateway 64.72.107.2...
      if (uri=~"^sip:1") {
           forward(64.72.107.2, 5060);
      }
      if (uri=~"^sip:011") {
           forward(64.72.107.2, 5060);

	} else {
    if (!lookup("location")) {
      sl_send_reply("404", "User Not Found");
      log("SER: Dest User Not in location table.\n");
      break;
    };
    if (!t_relay()) { sl_reply_error(); };
    break;
  };
}

	# if the request is for other domain use UsrLoc
	# (in case, it does not work, use the following command
	# with proper names and addresses in it)
	if (uri==myself) {

		if (method=="REGISTER") {

	# Uncomment this if you want to use digest authentication
			if (!www_authorize("sipua.cytelcom.com", "subscriber")) {
				www_challenge("sipua.cytelcom.com", "0");
				break;
			};
			save("location");
			break;
		};

		# native SIP destinations are handled using our USRLOC DB
		if (!lookup("location")) {
			sl_send_reply("404", "Not Found");
			break;
		};
	};
	# forward to current uri now; use stateful forwarding; that
	# works reliably even if we forward from TCP to UDP
	if (!t_relay()) {
		sl_reply_error();
	};

}



--
Harold Workman
CCNA, CCNP
Cytel Communications
hworkman at cytelcom.com
Ph. 281-449-4000 x3098





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the sr-users mailing list