Hello Paul:

Thanks very much, indeed!

KR,

Zaka


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


Hi Zaka
You have misunderstood this line : if (!t_relay()) {

That line explicitly calls t_relay() and the packet is relayed at that time.  If the packet cannot be relayed then the t_relay() function returns an error and the conditional block is executed.

Paul Smith



On 13 Nov 2014, at 09:10, Zaka Ul Isam <Zaka.Ul@albtelecom.al> wrote:

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-bounces@lists.sip-router.org [sr-users-bounces@lists.sip-router.org] on behalf of Paul Smith [paul.smith@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.Ul@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