Here, try this script. I couldn't test it, but apart from minor errors it should work.
# ----------- 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=server.sam.cse alias=sam.cse
# debugging log_stderror=yes # (cmd line: -E)
#mhomed=yes
fifo="/tmp/ser_fifo" fifo_db_url="mysql://root:vlftmd@localhost/ser"
# ------------------ 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 ---------------
modparam("rr", "enable_full_lr", 1)
# -- usrloc params --
modparam("usrloc", "db_mode", 2) modparam("usrloc", "db_url", "mysql://root:vlftmd@localhost/ser")
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with # max_forwards==0, or excessively long requests if (!mf_process_maxfwd_header("10")) { log(1, "ERROR: Too Many Hops\n"); sl_send_reply("483","Too Many Hops"); break; }; #keep this low to prevent possible DoS attacks and misconfigurations from overloading the server if (msg:len>=2048) { log(1, "ERROR: Message Too Big\n"); 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 (loose_route()) { route(1); break; };
if (method=="REGISTER") {
log(1, "INFO: User Registered\n"); # save location before initiating welcome save("location"); record_route(); sl_send_reply("200", "ok"); # welcome message log(1, "INFO: Initiating Welcome Message \n"); route(3); break; };
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(method=="INVITE") { log(1, "INFO: SIP Invite"); if (!lookup("location")) { sl_send_reply("404", "Not Found"); log(1, "ERROR: User Not Found\n"); break; }; }; record_route(); };
route(1); }
route[1] { #send the call outward if (!t_relay()) { xlog("L_WARN", "ERROR: t_relay failed"); sl_reply_error(); }; }
# 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:mijin@sam.cse" # --SIP domain # DOMAIN="192.168.178.193" DOMAIN="192.168.178.194" # 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, "ERROR: Welcome Message Script Failed\n"); }
log(1, "INFO: Welcome Message Sent\n"); }
#----------------End Script---------------------
---Mike
-----Original Message----- From: serusers-bounces@lists.iptel.org on behalf of ? ?? Sent: Fri 9/23/2005 6:30 AM To: serusers@lists.iptel.org Subject: [Serusers] SIP/2.0 483 Too Many Hops
confirm 83b7fb1612811c64f85f47a6046dd84dea286d15
Dear.... I inserted command like this. What I want is that when I loaded test.cfg file, what I check SIP messages using sipp client mode I want 200 OK. But, as you see, I received "SIP/2.0 483 Too Many Hops" error message.
So I was advanced about this. - alias="sam.cse"//SIP_ DOMAIN alias="server.sam.cse"//my_computer.SIP_DOMAIN alias="192.168.178.194"//my_ip - add my hostname in /etc/host - change to : if (!mf_process_maxfwd_header("100")
but, I couldn't solve this problem.
I would really appreciate for giving some advise. Thank you in advance.............................
mi-jin Song
=====================================================
[root@cse4 ~]# ser -f test.cfg Listening on udp: 127.0.0.1 [127.0.0.1]:5060 udp: 192.168.178.194 [192.168.178.194]:5060 tcp: 127.0.0.1 [127.0.0.1]:5060 tcp: 192.168.178.194 [192.168.178.194]:5060 Aliases: tcp: server:5060 tcp: localhost:5060 tcp: localhost.localdomain:5060 tcp: cse4:5060 udp: server:5060 udp: localhost:5060 udp: localhost.localdomain:5060 udp: cse4:5060 *: 192.168.178.194:* *: sam.cse:* *: server.sam.cse:*
stateless - initializing 0(0) Maxfwd module- initializing exec - initializing 0(0) INFO: udp_init: SO_RCVBUF is initially 110592 0(0) INFO: udp_init: SO_RCVBUF is finally 221184 0(0) INFO: udp_init: SO_RCVBUF is initially 110592 0(0) INFO: udp_init: SO_RCVBUF is finally 221184 0(0) ERROR: tcp_init: bind(6, 0x810dafc, 16) on 127.0.0.1: Address already in use
=====================================================
[root@cse4 sipp]# ./sipp -sn uac 192.168.178.194 Resolving 192.168.178.194... ------------------------------ Scenario Screen -------- [1-4]: Change Screen -- Call-rate(length) Port Total-time Total-calls Remote-host 10.0(0 ms)/1.000s 5061 2.54 s 25 192.168.178.194:5060(UDP)
5 new calls during 0.538 s period 2 ms scheduler resolution 0 concurrent calls (limit 30) Peak was 1 calls, after 0 s 0 out-of-call msg (discarded) 1 open sockets
Messages Retrans Timeout Unexpected-Msg INVITE ----------> 25 0 0 100 <---------- 25 0 25 180 <---------- 0 0 0 200 <---------- E-RTD 0 0 0 ACK ----------> 0 0 [ 0 ms] BYE ----------> 0 0 0 200 <---------- 0 0 0
------------------------------ Test Terminated ---------------------------------
----------------------------- Statistics Screen ------- [1-4]: Change Screen -- Start Time | 2005-09-23 20:03:13 Last Reset Time | 2005-09-23 20:03:15 Current Time | 2005-09-23 20:03:16 -------------------------+---------------------------+--------------------------
Counter Name | Periodic value | Cumulative value -------------------------+---------------------------+--------------------------
Elapsed Time | 00:00:00:536 | 00:00:02:543 Call Rate | 9.328 cps | 9.831 cps -------------------------+---------------------------+--------------------------
Incoming call created | 0 | 0 OutGoing call created | 5 | 25 Total Call created | | 25 Current Call | 0 | -------------------------+---------------------------+--------------------------
Successful call | 0 | 0 Failed call | 6 | 25 -------------------------+---------------------------+--------------------------
Response Time | 00:00:00:000 | 00:00:00:000 Call Length | 00:00:00:004 | 00:00:00:004 ------------------------------ Test Terminated --------------------------------
2005-09-23 20:03:16: Unexpected message for Call-ID '25.4743.127.0.0.1@sipp.call.id': while expecting '100' response, received 'SIP/2.0 483 Too Many Hops Via: SIP/2.0/UDP 127.0.0.1:5061;received=192.168.178.194 From: sipp sip:sipp@127.0.0.1:5061;tag=25 To: sut sip:service@192.168.178.194:5060;tag=b27e1a1d33761e85846fc98f5f3a7e58.6e68
Call-ID: 25.4743.127.0.0.1@sipp.call.id CSeq: 1 INVITE Server: Sip EXpress router (0.9.4 (i386/linux)) Content-Length: 0 Warning: 392 192.168.178.194:5060 "Noisy feedback tells: pid=4688 req_src_ip=192.168.178.194 req_src_port=5060 in_uri=sip:service@192.168.178.194:5060 out_uri=sip:service@192.168.178.194:5060 via_cnt==18"
' . sipp: There were more errors, enable -trace_err to log them.
=======================================================
<< 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="server.sam.cse" alias="sam.cse" alias="192.168.178.194"
# 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:vlftmd@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("15")) { 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 (method=="REGISTER") {
log(1, "receive REGISTER\n"); # save location before initiating welcome save("location"); log(1, "save ??\n"); record_route(); sl_send_reply("200", "ok"); # welcome message log(1, "route3?? ?? \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?? ?? ? ?? \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:mijin@sam.cse" # --SIP domain # DOMAIN="192.168.178.193" DOMAIN="192.168.178.194" # 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 ? \n"); }
_________________________________________________________________ ???? ?? ??? ???? ???... MSN ??? ??? http://vod.msn.co.kr
_______________________________________________ Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers