[OpenSIPS-Users] Adding data to a request before relaying it

Najib Hara lebron_najib at hotmail.com
Mon Oct 11 11:06:54 CEST 2010


Hi everyone,

Here is the routing logic that I did to implement this type of scenario, but I have some remarks and I would like to share it with you so I can have your opinion:
I used the 380 reply (Alternative Service) instead of the 6xx replies because OpenSIPS seems like it can't resend my INVITE after receiving this type of replies.
Here is the errors in the log file:

ERROR:tm:t_forward_nonack: discarding fwd for a cancelled/6xx transaction
ERROR:tm:w_t_relay: t_forward_nonack failed

What do you think about those errors? And how could I use the 6xx replies (a 603 reply for example) to get my data and resend my INVITE ?

Here is my routing logic (with 380 replies):

####### Routing Logic ########


# main request routing logic

route{
    if (!mf_process_maxfwd_header("10")) {
        sl_send_reply("483","Too Many Hops");
        exit;
    }

    if(is_method("INVITE")) {
        if($rU=='1000') {  
            t_relay("x.x.x.x:5060"); # sending the INVITE to a SIP server who answer with a 380 reply
            
            t_on_failure("1");
           
            exit;
        }
    }
    else {
        route(1);
    }
}

failure_route[1] {
    if(t_check_status("380")) {
        xlog("$(<reply>hdr(via)[*])\r\n");
        xlog("$(<reply>hdr(From)[*])\r\n");
        xlog("$(<reply>hdr(To)[*])\r\n");
        xlog("$(<reply>hdr(Call-ID)[*])\r\n");
        xlog("$(<reply>hdr(CSeq)[*])\r\n");
        xlog("$(<reply>hdr(Contact)[*])\r\n");
        xlog("$(<reply>hdr(Error-Info)[*])\r\n");

        append_hf("Error-Info: $(<reply>hdr(Error-Info)[*])\r\n");
       
        t_relay();
      
    }
}
route[1] {
   
    if (!t_relay()) {
        sl_reply_error();
        exit;
    }
}



From: lebron_najib at hotmail.com
To: users at lists.opensips.org
Date: Tue, 5 Oct 2010 13:54:57 +0000
Subject: Re: [OpenSIPS-Users] Adding data to a request before relaying it











Hi Anca,

Thank you for your quick response. It would be great if you can give me your opinion on the routing logic that I made to respond to this type of scenario:

---
loadmodule "tm.so"
loadmodule "textops.so"
...
---
route{
    if(is_method("INVITE")) {
        t_relay("tcp:server_adress:5060");
        t_on_failure("1");
    }
}
failure_route[1] {
    if(t_check_status("600") {
        add_body("$<reply>rb)", "Data");
# this function adds a body to a message or replace it if existing, but I'm not sure I can use a pseudo-variable as a parameter
        $(<request>rb) = $(<reply>rb);
# another possibility and again I'm not sure that those are R/W variables
        t_relay();
    }
}

Date: Tue, 5 Oct 2010 14:28:54 +0300
From: anca at opensips.org
To: users at lists.opensips.org
Subject: Re: [OpenSIPS-Users] Adding data to a request before relaying it






  
  Message body


Hi Najib,





More information about the Users mailing list