[Serusers] retargeting - rerouting - redirecting

Miklos Tirpak miklos at iptel.org
Tue Jul 29 09:32:50 CEST 2008


On 07/28/2008 05:42 PM, .:: Francesco la Torre ::. wrote:
> I help myself  :-)
> the function is t_forward_noack example 
> 
>          if (method=="...") { # here put method name which should be
> forwarded
>                  if (!t_newtran()) {
>                          log(1, "newtran error\n");
>                          sl_reply_error();
>                          break;
>                  };
>                 
>                  if (!t_forward_nonack("machine.domain.com", 5060)) {
>                          log(1, "forward failed\n");
>                          t_reply("500", "Forward failed");
>                  }

You can use t_relay("machine.domain.com", 5060) instead of 
t_forward_nonack(...), it automatically creates the transaction, and 
handles ACKs as well, so you do not need to call t_newtran().

It is worth calling t_newtran() at the beginning of the script, if you 
have a huge config file, and lots of expensive DB queries, checks,... 
are done between t_newtran() and t_relay(). t_newtran() catches the 
re-transmissions early, so they do not increase the load in this case.

Be aware that neither t_relay() nor t_forward_nonack() modify the 
Request URI. If you want to rewrite it do it this way:

rewritehostport(""machine.domain.com:5060");
if (!t_relay()) {
	sl_reply_error();
	break;
}

You can find more info in the readme file of tm module.

Regards,
Miklos

>                  break;
>          }
>  
> Regards,
> Flt
> 
> 
> Il giorno lun, 28/07/2008 alle 15.45 +0200, .:: Francesco la Torre ::.
> ha scritto:
>> Dear all, 
>> few days ago I found in a script posted in this mail-list a function
>> that allow to forward a sip message to another host in this way
>>
>> function_name("ip.host.target.message","port");
>>
>> Is there anyone that know the name of this function ?
>>
>> Thank a lot,
>> Flt
>> _______________________________________________
>> Serusers mailing list
>> Serusers at lists.iptel.org
>> http://lists.iptel.org/mailman/listinfo/serusers
> _______________________________________________
> Serusers mailing list
> Serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers



More information about the sr-users mailing list