[Serusers] [about SER]networking among three SIP servers.....

송 미진 trytry02 at hotmail.com
Sat Sep 24 11:39:00 CEST 2005



confirm 83b7fb1612811c64f85f47a6046dd84dea286d15


Dear........
 
I want to networking among three SIP servers.
But now I am trying using two servers likes three servers.
That is, 

- source : computer A
            ip address ; 192.168.178.194
            sipuri : sip:mj at 192.168.178.194

- via : computer B
        ip address : 192.168.178.193
        sipuri : sip:hj at 192.168.178.193

- destination : computer A 
                ip address :192.168.178.194
                sipuri : sip:mj at 192.168.178.194

And I am using sipp to test (I modified the "via" part based on original 
uac module).

=====================================================

     <<  computer B's test.cfg   >>

#
# $Id: welcome.cfg,v 1.3 2003/11/03 13:03:56 janakj Exp $
#
# welcome message for new subscribers; based on exec
#

# ----------- global configuration parameters ------------------------

debug=3          # debug level (cmd line: -dddddddddd)
# must be yes since REGISTER processing causes an INVITE to be sent,
# which needs to be processed by another process
fork=yes
children=4

alias="kims.myserver.sampro.cse"
alias="myserver.sampro.cse"
alias="192.168.178.193"

# debugging
log_stderror=yes # (cmd line: -E)

mhomed=yes

fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.so"

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"

loadmodule "/usr/local/lib/ser/modules/exec.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

modparam("usrloc", "db_mode",   2)
#modparam("usrloc", "db_url", "mysql://ser:heslo@192.168.2.16/ser" )
modparam("usrloc", "db_url", "mysql://root:heslo@localhost/ser")

# -------------------------  request routing logic -------------------

# main routing logic

route{
	log(1, "\n\n");
	log(1, "START!!!\n");
	# 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>=204822) {
		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
#	if (method=="INVITE") record_route();	# 1=loose routing
	if(method=="INVITE"){
		log(1, "receive INVITE\n");
		record_route();
		sl_send_reply("200", "ok");
	};	

	# loose-route processing
	if (loose_route()) {
		t_relay();
		break;
	};
#	if(method=="ACK"){
#		log(1, "receive ACK\n");
#	};

	log(1, "record-route processing completed\n");

	# 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(uri=="sip:mijin at sam.cse"){
#		forward(192.168.178.194, 5060);
#	};

	if (uri=~"sip:192.168.178.193"){

		if (method=="REGISTER") {

			log(1, "receive REGISTER\n");
			# save location before initiating welcome
			save("location");
			log(1, "save &#236;&#8222;±&#234;³&#181;\n");
			record_route();
			sl_send_reply("200", "ok");
			# welcome message
			log(1, "route3&#236;œ¼&#235;¡œ &#236;&#157;´&#235;&#143;™ \n");
			route(3);
			break;
		};

		# native SIP destinations are handled using our USRLOC DB
		if (!lookup("location")) {
			sl_send_reply("404", "Not Found");
			log(1, "Usrloc DB&#236;&#8212;&#144;&#236;&#8222;œ &#236;°¾
&#236;&#157;&#8222; &#236;&#710;&#732; &#236;&#8212;†&#236;&#157;Œ \n");
			break;
		};
	};
	if(method=="BYE"){
		log(1, "receive BYE\n"); 
		record_route(); 
		sl_send_reply("200", "ok");
		break;
	};
	
	t_relay();
}

# welcome message -- if a REGISTER succeeded, look if it is the first-time;
# if so, initiate click-to-dial transaction to set up call to an 
announcement
# server; edit the config values first to make it work
route[3] {

	if (!exec_msg('
		# config: 
		# --announcement server URI
		ANS="sip:hjkim at myserver.sampro.cse"
		# --SIP domain
#		DOMAIN="192.168.178.193"
		DOMAIN="192.168.178.193"
		# ctd
		CTD=${HOME}/sip_router/examples/ctd.sh
		# ------------------------------------
		# check if first time ...
		SIP_UID=`echo $SIP_HF_TO | sed -e 
"s/^.*sip:\([a-zA-Z0-9_\.]*\)@.*$/\1/g"`
		QUERY="select flag from subscriber 
				where username=\"$SIP_UID\";
			update subscriber set flag=\"x\" 
				where username=\"$SIP_UID\" ";
			mysql -Bsuser -pheslo -e "$QUERY" ser| grep "^x$" > /dev/null
		# ... if so, c-t-d to announcement server
		if [ "$?" -ne 0 ] ; then
		# flag was not set to x yet -- first-time registration;
		# initiate a call from telephone of the user to an announcement server
			$CTD "sip:$SIP_UID@$DOMAIN" "$ANS" > /dev/null 2>&1
		fi
	')) {
		log(1, "welcome exec failed\n");
	}

	log(1, "-------route3 &#235;&#129;&#157; \n");
}

 As you see, I added 

         modparam("rr", "enable_full_lr", no)

         if(uri=="sip:mijin at 192.168.178.194"){
              forward(192.168.178.194, 5060);
              append_branch("sip:hjkim at 192.168.178.193:5060"); log(1, "next 
hop...\n");
          break;
         };

but, I received error message in computer B(via):

        8(12253) ERROR: forward_reply: no 2nd via found in reply
 
What does it mean?
What can I do for doing what I want ???
Is there any problem in my test.cfg file ????? 

I would like to know in detail .
please tell me what to do...............................


Song

_________________________________________________________________
싸게 싸게 MSN공동구매   
http://www.waawaa.com/cobuy/cobuy_default.asp?siteid=10160 




More information about the sr-users mailing list