Hello,

 

I’m using Kamailio as a proxy behind freeswitch to alter some packets (183 packets precisely).

 

Here is my scenario:

 

(---Customer---) à ((port 5065)---Kamailio---) à ((port5060)---Freeswitch---) à (---Supplier---)

 

Here is my request route :

 

route{

 

if (is_method("INVITE")) {

        xlog("L_INFO","INSIDE request route $si \n");

          insert_hf("X-AUTH-IP: $si\r\n");

}

 

route(FWD);

}

 

 

reply_route {

#xlog("L_INFO","INSDE reply \n");

    if (status == "183") {

        change_reply_status(180, "Ringing");

        exit;

    }

}

 

route[FWD] {

#xlog("L_INFO","INSIDE FWD \n");

forward(X.X.X.X,5060);

}

Where X.X.X.X is the Freeswitch IP

 

This script is working normally as long as the customer is sending the requests(INVITE,BYE,ACK,CANCEL..) . But when the supplier or freeswitch initiated the request , above script causes loop where the packet is bounced between kamailio and freeswitch.

 

As I know , loose_route is used to handle such requests , but I’m not sure how to forward these packets to the customer after receiving them from freeswitch.

 

I’m not sure also if what’s I’m doing is statefull or stateless.

 

Any help is appreciated.

 

Thanks,

Ali Taher