Morning Paul:

Thanks a million, mate!
So, if I understood correctly, in the:

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

!t_relay will check the error condition in sending out the stateful message.  
However, in this code snippet, t_relay is not explicitly called. Therefore, as 
in kamailio-advanced-config, route[relay] should be performing this.

But it is not the case. Instead the main routing block first calls several 
other routes:

route(REQINIT);
route(NATDETECT);

and then # CANCEL processing
    if (is_method("CANCEL")) {
        if (t_check_trans())   ????????
            t_relay();
        exit;

Please forgive my ignorance, but I am baffled here.

The next occurrence of t_relay is:

if ( is_method("ACK") ) {
        if ( t_check_trans() ) {
            # no loose-route, but stateful ACK;
            # must be an ACK after a 487
            # or e.g. 404 from upstream server
            t_relay();
            exit;


Many anticipatory thanks again!

Have an awesome day!

Zaka

________________________________________
From: sr-users-boun...@lists.sip-router.org 
[sr-users-boun...@lists.sip-router.org] on behalf of Paul Smith 
[paul.sm...@claritytele.com]
Sent: Thursday, November 13, 2014 9:38 AM
To: sr-users@lists.sip-router.org
Subject: Re: [SR-Users] Kamailio Routing Logic

Hi Zaka,
The stageful forwarding takes place in the t_relay() function. If relaying is 
unsuccessful then an error is returned and the conditional block executed to 
send an error back to the originator using sl_reply_error().

Your other question is about why to use the call to route(1): Yes you could 
just put the content of route[1] into the main route block and it would work 
fine. In more complex scripts it is neater to put code which is executed in 
lots of different place into a separate block and then call the block. That way 
if you need to modify that code you only have one place to maintain. The 
t_relay() function is a good example of a block of functionality that is 
reached from loads of places … so generally a route[relay] block is a good idea.

Paul Smith

On 13 Nov 2014, at 07:52, Zaka Ul Isam <zaka...@albtelecom.al> wrote:

> Hello Friends and Gurus:
>
> I am struggling with routing and need a bit of clarification WRT following:
>
> route {
> if ($fU=="601"&&is_method("INVITE"))
> record_route();
> rewritehost("10.0.10.111"); //SS IP
> route(1);
> }
> route[1] {
> # send it out now; use stateful forwarding as it works reliably
> # even for UDP2TCP
> if (!t_relay()) {
> sl_reply_error();
> };
> exit;
> }
> * In the above stateful forwarding what is the rationale of calling route (1) 
> within main route block? Could the t_relay statement afyer rewriting the host 
> part of URI not have performed the stateful forwarding?
>
> ** In route[1] there is is only an expression abt logical not condition about 
> t_relay() (if methods in this function are not invoked??)
> I wonder where exactly is stateful forwarding taking place?
>
> 1- Is it the default action?
> 2- Or in function sl_reply_error()?
>
> Thanks a lot in advance!
>
> Zaka
>
> ________________________________
>
> Albtelecom & Eagle Mobile invite you to protect together the Environment. 
> Please do not print the e-mail unless really necessary.
>
> Albtelecom & Eagle Mobile iu ftojnë të mbrojmë së bashku Mjedisin. Lutemi të 
> mos e printoni këtë komunikim elektronik nëse nuk është vërtet i nevojshëm.
>
> ________________________________
>
> This e-mail and any files transmitted with it are confidential and intended 
> solely for the use of the addressee/s. If you are not the intended recipient 
> you are hereby notified that any dissemination, forwarding, copying or use of 
> any of the information is strictly prohibited. If you receive this e-mail in 
> error, please notify the sender immediately and delete it! Albtelecom makes 
> no warranty as to the accuracy or completeness of any information contained 
> in this message and hereby excludes any liability of any kind for the 
> information contained therein or for the information transmission, reception, 
> storage or use of such in any way whatsoever. The opinions expressed in this 
> message may belong to sender alone and may not necessarily reflect the 
> opinions of Albtelecom. Albtelecom shall bear no liability for any loss or 
> damage caused by software or e-mail viruses.
>
> Ky mesazh dhe çdo informacion i transmetuar në përmbajtje te këtij mesazhi 
> është konfidencial dhe është i destinuar vetëm për marrësin e destinuar. Nëse 
> nuk jeni marrësi i destinuar, Ju bëjmë me dije se çdo përhapje, transmetim, 
> kopjim apo përdorim i çdo informacioni është i ndaluar. Nëse e merrni këtë 
> mesazh gabimisht, ju lutem kontaktoni urgjentisht nisësin e tij dhe fshijeni 
> atë. Albtelecom nuk jep asnjë garanci për saktësinë apo plotësinë e 
> informacionit në përmbajtje të këtij mesazhi dhe nuk mban asnjë përgjegjësi 
> për informacionin e përmbajtur, transmetimin, marrjen, ruajtjen apo 
> përdorimin e tij në çfarëdolloj mënyre. Mendimet e shprehura në këtë mesazh 
> mund t'i përkasin vetë nisësit dhe nuk mund të reflektojnë domosdoshmërisht 
> qëndrimet e Albtelecom. Albtelecom nuk do të mbaje asnjë përgjegjësi për 
> humbje ose dëme te shkaktuara nga programet apo viruset.
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to