[Serusers] BYE message to SER.

Ricardo Martinez rmartinez at redvoiss.net
Tue Oct 26 00:58:37 CEST 2004


Hello list.
	I have a problem-question regarding to the BYE message reaching SER.
For the normail example i have a endpoint registered in SER and a
PSTN-Gateway receiving the outgoing traffic.  For this enviroment when i
made a call from my endpoint to the PSTN gateway and the Gateway send the
BYE (at the end of the call) this is what i see in the debug in SER.

U gw1.mydomain.com:52154 -> sersip.mydomain.com:5060
  BYE sip:005622408196 at sersip.mydomain.com:5060 SIP/2.0
Via: SIP/2.0/UDP  gw1.mydomain.com:5060
From: <sip:005622408196 at sersip.mydomain.com>;tag=A0272B49-B2D
To: <sip:5555832351 at sersip.mydomain.com>;tag=ae4208f2a4
Date: Mon, 25 Oct 2004 21:34:02 GMT
Call-ID: ae229c42-f2c3-08f3-81f2-0002a400f1e9 at xx.xx.xx.42
User-Agent: Cisco-SIPGateway/IOS-12.x
Max-Forwards: 6
Route: <sip:5555832351 at xx.xx.xx.42:5060>
Timestamp: 1098740047
CSeq: 101 BYE
Content-Length: 0

                                                         
#
U sersip.mydomain.com:5060 -> xx.xx.xx.42:5060
  BYE sip:5555832351 at xx.xx.xx.42:5060 SIP/2.0
Record-Route: <sip:005622408196 at sersip.mydomain.com;ftag=A0272B49-B2D;lr=on>
Via: SIP/2.0/UDP sersip.mydomain.com;branch=z9hG4bK4c65.37369754.0
Via: SIP/2.0/UDP  gw1.mydomain.com:5060
From: <sip:005622408196 at 64.76.148.231>;tag=A0272B49-B2D
To: <sip:5555832351 at sersip.mydomain.com>;tag=ae4208f2a4
Date: Mon, 25 Oct 2004 21:34:02 GMT
Call-ID: ae229c42-f2c3-08f3-81f2-0002a400f1e9 at xx.xx.xx.42
User-Agent: Cisco-SIPGateway/IOS-12.x
Max-Forwards: 5
Timestamp: 1098740047
CSeq:101 BYE
Content-Length: 0

 

#
U xx.xx.xx.42:5060 -> sersip.mydomain.com:5060
  SIP/2.0 200 OK
Via: SIP/2.0/UDP sersip.mydomain.com;branch=z9hG4bK4c65.37369754.0
Via: SIP/2.0/UDP  gw1.mydomain.com:5060
From: <sip:005622408196 at sersip.mydomain.com>;tag=A0272B49-B2D
To: <sip:5555832351 at sersip.mydomain.com>;tag=ae4208f2a4
Call-ID: ae229c42-f2c3-08f3-81f2-0002a400f1e9 at xx.xx.xx.42
CSeq: 101 BYE
User-Agent: AddPac SIP Gateway
Content-Length: 0
Record-Route: <sip:005622408196 at sersip.mydomain.com;ftag=A0272B49-B2D;lr=on>

 

#
U sersip.mydomain.com:5060 -> gw1.mydomain.com:5060
  SIP/2.0 200 OK
Via: SIP/2.0/UDP  gw1.mydomain.com:5060
From: <sip:005622408196 at sersip.mydomain.com>;tag=A0272B49-B2D
To: <sip:5555832351 at sersip.mydomain.com>;tag=ae4208f2a4
Call-ID: ae229c42-f2c3-08f3-81f2-0002a400f1e9 at xx.xx.xx.42
CSeq: 101 BYE
User-Agent: AddPac SIP Gateway
Content-Length: 0
Record-Route: <sip:005622408196 at sersip.mydomain.com;ftag=A0272B49-B2D;lr=on>

As you can  see the call is ended succesfully and there is no problem.
Now, instead of having a PSTN-Gateway i use a SIP-H323 translator and all
the calls are going out through this device.    When i made a call from my
endpoint and the SIP-H323 send the BYE message (at the end of the call) the
debug shows this :


U sipquest.mydomain.com:5060 -> sersip.mydomain.com:5060
  BYE sip:1112001003 at sersip.mydomain.com;ftag=25421eefa4;lr=on SIP/2.0
Via: SIP/2.0/UDP sipquest.mydomain.com:5060;
branch=z9hG4bKsKpiQfXRAwAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB_
From: <sip:1112001003 at sersip.mydomain.com>;tag=3896741524
To: <sip:5555832351 at sersip.mydomain.com>;tag=25421eefa4
CSeq: 1 BYE
Call-ID: 25229c42-16c9-1e95-81ef-0002a400f1e9 at xx.xx.xx.42
Contact: <sip:1112001003 at sipquest.mydomain.com>
Route: <sip:5555832351 at sersip.mydomain.com>
Max-Forwards: 69
Content-Length: 0

                                      
#
U sersip.mydomain.com:5060 -> sipquest.mydomain.com:5060
  SIP/2.0 404 Not Found IT!
Via: SIP/2.0/UDP sipquest.mydomain.com:5060;
branch=z9hG4bKsKpiQfXRAwAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB_;received=sipquest
.mydomain.com
From: <sip:1112001003 at sersip.mydomain.com>;tag=3896741524
To: <sip:5555832351 at sersip.mydomain.com>;tag=25421eefa4
CSeq: 1 BYE
Call-ID: 25229c42-16c9-1e95-81ef-0002a400f1e9 at xx.xx.xx.42
Server: Sip EXpress router (0.8.14 (i386/linux))
Content-Length: 0
Warning: 392 sersip.mydomain.com:5060 "Noisy feedback tells:  pid=15285
req_src_ip=sipquest.mydomain.com
req_src_port=5060in_uri=sip:1112001003 at sersip.mydomain.com;ftag=25421eefa4;l
r=on out_uri=sip:1112001003 at sersip.mydomain.com;ftag=25421eefa4;lr=on
via_cnt==1"



My question is : Why the call is ended succesfully in the first case and in
the second case SER answer with a "NOT FOUND"?  I only have registered in my
location table the endpoints.  Here is my ser.cfg file. 


#
# $Id: ser.cfg,v 1.21.2.2 2003/10/13 22:53:06 jiri Exp $
#
# simple quick-start config script
#

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

debug=0     # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes        # (cmd line: -E)

#Uncomment these lines to enter debugging mode 
#fork=no
#log_stderror=yes

listen=xx.xx.148.231

alias=sersip.mydomain.com

check_via=yes   # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5060
#children=4
fifo="/tmp/ser_fifo"
fifo_mode=0666


# ------------------ 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/textops.so"

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

# Para trabajar con NAT
loadmodule "/usr/local//lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local//lib/ser/modules/domain.so"
loadmodule "/usr/local//lib/ser/modules/dbtext.so"


# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
 #loadmodule "/usr/local/lib/ser/modules/auth_db.so"

loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
loadmodule "/usr/local/lib/ser/modules/group_radius.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"

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

# ----------------- setting module-specific parameters ---------------
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# module authorization
modparam("auth_radius","radius_config","/usr/local/etc/radiusclient/radiuscl
ient.conf")
modparam("auth_radius","service_type",15)

#module accounting
modparam("acc","radius_config","/usr/local/etc/radiusclient/radiusclient.con
f")
modparam("acc","log_level",1)
modparam("acc", "service_type", 15)
modparam("acc", "radius_flag", 1)
modparam("acc", "radius_missed_flag", 3)
modparam("acc", "failed_transactions", 1)
modparam("acc", "report_ack", 0)

#group radius
modparam("group_radius","radius_config","/usr/local/etc/radiusclient/radiusc
lient.conf")
modparam("group_radius", "use_domain", 1)
 
#module mediaproxy
modparam("mediaproxy", "natping_interval", 60)
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
#modparam("mediaproxy", "sip_asymmetrics",
"/usr/local/etc/ser/sip-asymmetrics-clients")
#modparam("mediaproxy", "rtp_asymmetrics",
"/usr/local/etc/ser/rtp-asymmetrics-clients")
modparam("registrar", "nat_flag", 5)

#module domain
modparam("domain", "db_url", "/usr/local/etc/ser/domaintables")
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")


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

# main routing logic

route {
        # Llamada a Rutina Externa para cambio de numero
#       if (method=="INVITE") {
#               exec_dset("/usr/local/etc/ser/redirect.sh");
#       };

        # 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;
        };

        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        record_route();
        
        if (loose_route()) {
                if (method=="BYE" || method=="CANCEL")  {
                        log(1, "NAT: BYE o CANCEL recibido --> terminando la
sesion de media\n");
                        end_media_session();
                        setflag(1);
                };
                t_relay();
                break;
        };


        # Maracamos las llamadas para accounting
        setflag(1);

        if (client_nat_test("1")) {
                log(1, "NAT: Requerimiento de IP privada --> fixed contact
(en rutina principal)\n");
                setflag(5);
                force_rport();
                fix_contact();
                append_hf("P-hint: fixed NAT contact for request\r\n");
        };

        # (in case, it does not work, use the following command
        # with proper names and addresses in it)

if (uri==myself) {
        if (method=="REGISTER") {
                # Challenge/Response 
                if ( !radius_www_authorize("")) {
                        www_challenge("", "1");
                        break;
                };

                # Mandamos un mensaje de Log si es que un cliente NATEADO se
registro.
                if (isflagset(5))  {
                        log(1, "NAT: Cliente NAT'eado registrado (dentro del
chequeo de REGISTER)\n");
                };

                save("location");
                break;
        }; # FIN DE CHEQUEO DE REGISTRO

        # lookup("aliases");

        # CHEQUEO EL INVITE DE LA LLAMADA 
        if (method=="INVITE" && search("^From: <sip:.*@xx.xx.148.231>")) {
                if ( !radius_proxy_authorize("")) {
                        proxy_challenge("", "1");
                        log (1, "LOG: Llamada no AUTORIZADA\n");
                        break;
                };
        };

        if ( (uri=~"^sip:0.*@.*") ){
                if (method=="INVITE")  {
                        log(1,"FORWARDING : Llamada hacia plataforma
H.323\n");
                        route(3);
                        break;
                };
        };
        # Llamadas hacia dominio H.323
        if ( (uri=~"^sip:111.*@.*") | (uri=~"^sip:777.*@.*") |
(uri=~"^sip:333.*@.*") ){
                if (method=="INVITE")  {
                        log(1,"FORWARDING : Llamada hacia plataforma
H.323\n");
                        route(1);
                        break;
                };
        };

        # Llamadas SIP locales
        if (!lookup("location")) { #Usuarios que no estan en "location"
database.
                route(4);
                break;
        };

        setflag(3);

        # Manejo para llamadas NAT'das
        if (method=="INVITE") {
                log(1, "ROUTING: Reply processing (online user) enabled to
handle NAT'd resonses\n");
                t_on_reply("1");
                        if ( (isflagset(5)) && (method=="INVITE" ||
method=="ACK") )  {
                                log(1, "NAT: Invite received --> enabling
media proxy (else del lookup 2do if)\n");
                                use_media_proxy();
                                append_hf("P-hint: request forced to media
proxy\r\n");
                        };
        };

        # Do it ? (Ricardo Martinez)
};
        append_hf("P-hint: USRLOC\r\n");

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

} /* end of initial routing logic */

#--------- Route 1 hacia SIPQUEST -------------------------------
route[1] 
{
        # send it out now; use stateful forwarding as it works reliably
        # even for UDP2TCP

        # Esta NATEADO?
        if (isflagset(5))  {
                log(1, "NAT: At least one participant NAT'd --> enable reply
processing (hacia GW)\n");
                t_on_reply("1");
                if (method=="INVITE")  {
                        log(1, "NAT: Invite received --> enabling proxied
media session (hacia GW)\n");
                        setflag(1);
                        use_media_proxy();
                };                      
        };

        rewritehostport("sipquest.mydomain.com:5060");
        append_hf("P-hint: GATEWAY\r\n");
        
        if (!t_relay()) {
                sl_reply_error();
                break;
        };
        
}


#------- Route 3 : Trafico de Internet hacia la PSTN -------------------

route[3] {
        setflag(1);

        #Esta NETEADO?

        if (isflagset(5))  {
                log(1, "NAT: At least one participant NAT'd --> enable reply
processing (hacia GW)\n");
                t_on_reply("1");
                if (method=="INVITE")  {
                        log(1, "NAT: Invite received --> enabling proxied
media session (hacia GW)\n");
                        #setflag(1);
                        use_media_proxy();
                };
        };


        rewritehostport("gw1.mydomain.com:5060");
        append_hf("P-hint: GATEWAY\r\n");

        t_relay();
        break;


}


#------ Route 4 : Llamadas a usuarios Off-line ------------------------

route[4] {

        if (!t_newtran()) {
                sl_reply_error();
        };

        if (!t_reply("404", "Not Found IT!")) {
                sl_reply_error();
        };
        break;
}

# ---------------------------- Begin On-Reply Routes
--------------------------

onreply_route[1] {
     #  If we've got here, it's because we've previously passed through a
block
     #  which handles NAT requests and has set a t_on_reply condition. DB
03-08-2004
      if (status =~ "(183)|(2[0-9][0-9])")  {
        if (client_nat_test("1") || isflagset(5))  {
          log(1, "NAT: Reply from NAT'd client --> fixing contact
(onreply_route)\n");
          fix_contact();
        use_media_proxy();
        setflag(5);
        };
        log(1, "NAT: NAT'd transaction answered --> enabling media proxy
(onreply_route)\n");
      #  use_media_proxy();
      };

}

# ------------------------------ End On-Reply Routes
--------------------------
 
Can someone please help me?.



Ricardo Martinez




More information about the sr-users mailing list