[Serusers] BYE / CANCEL Problem
Marian Dumitru
marian.dumitru at voice-sistem.ro
Tue Oct 26 23:52:48 CEST 2004
Hi Ricardo,
The is a problem in your script. When you do diversion to GWs (h.323 /
pstn), do it for all requests, not only for INVITES. In this particular
case, the CANCEL must follow the same path as the INVITE.
Best regards,
Marian Dumitru
Ricardo Martinez wrote:
> Hello list
> Beside the BYE problem that i post in a past mail, i detected
> another weird behaivor of SER. When i made a call from a registered
> endpoint (64.76.148.242) to a PSTN-number through a PSTN-Gateway. The
> destination devices keep ringing even if i send a CANCEL message. I don't
> understand why. Here is the debug
>
> U 64.76.148.242:5060 -> sersip.mydomain.com:5060
> CANCEL sip:005622408196 at sersip.mydomain.com SIP/2.0
> Via: SIP/2.0/UDP 64.76.148.242:5060;branch=z9hG4bK1f42736da4462
> From: <sip:5555832351 at sersip.mydomain.com>;tag=1f42736da4
> To: <sip:005622408196 at sersip.mydomain.com>
> Call-ID: 1f629d42-2d9e-73aa-826d-0002a400f1e9 at 64.76.148.242
> CSeq: 462 CANCEL
> Date: Wed, 01 Jun 2005 07:22:16 GMT
> User-Agent: AddPac SIP Gateway
> Content-Length: 0
> Max-Forwards: 70
>
>
> #
> U sersip.mydomain.com:5060 -> 64.76.148.242:5060
> SIP/2.0 404 Not Found IT!
> Via: SIP/2.0/UDP 64.76.148.242:5060;branch=z9hG4bK1f42736da4462
> From: <sip:5555832351 at sersip.mydomain.com>;tag=1f42736da4
> To:
> <sip:005622408196 at sersip.mydomain.com>;tag=a6a1c5f60faecf035a1ae5b6e96e979a-
> 3932
> Call-ID: 1f629d42-2d9e-73aa-826d-0002a400f1e9 at 64.76.148.242
> CSeq: 462 CANCEL
> Server: Sip EXpress router (0.8.14 (i386/linux))
> Content-Length: 0
> Warning:392 sersip.mydomain.com:5060 "Noisy feedback tells: pid=16760
> req_src_ip=64.76.148.242 req_src_port=5060
> in_uri=sip:005622408196 at sersip.mydomain.com
> out_uri=sip:005622408196 at sersip.mydomain.com via_cnt==1"
>
>
> It seems to be related with my past message. Can someone help me here, i'm
> very confused. Here is my ser.cfg.
> Thanks in advance.
>
> #
> # $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
>
>
> 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 {
>
> # 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 A REALIZARSE SOLO SI ES DE MI
> DOMINIO SIPPROXY.MAGENTA.CL
> if (method=="INVITE" && search("^From: <sip:.*@64.76.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 (todo lo que comienza con 111, 777,
> 333 y 00xxxxxxxx)
> 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
> --------------------------
>
> Ricardo.-
>
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
--
Voice Sistem
http://www.voice-sistem.ro
More information about the sr-users
mailing list