Hi All,
I am currently trying to set up SER to act as a proxy from a device which only sends UDP SIP to a host which only accepts TCP SIP. I have sort of got this working with the following config:
t_relay_to_tcp("10.0.1.108", "5060");
The problem is, the host which only accepts TCP issues a redirect as part of the SIP handshaking, so I need to be able to dynamically select the port to relay to. I currently have the following set up for a few ports which the host seems to use, but the list of ports it could use is rather large, and I'd like to get it working properly with dynamic values e.g. the following is how I'm doing it at the minute:
if (uri=~"^sip:(.+@)?(10.0.1.108):1480(.*)$") { log (1, "port is 1480\n"); t_relay_to_tcp("10.0.1.108", "1480"); } else { log (1, "port is 5060\n"); t_relay_to_tcp("10.0.1.108", "5060"); }
Whereas I'd like something like (with Perl style regexs):
if (uri=~"^sip:(.+@)?10.0.1.108:([0-9]+).*$") { log (1, "port is $2\n"); t_relay_to_tcp("10.0.1.108", "$2"); } else { log (1, "port is 5060\n"); t_relay_to_tcp("10.0.1.108", "5060"); }
So I need to get the value as part of the regular expression in the URI pattern matching, then use this as a value in the t_relay_to_tcp(). I've searched the documentation but I can't seem to find an obvious way to do this.
I've tried using the t_relay() method which doesn't seem to work for me. I need to use the t_relay_to_tcp() method.
Thanks for your help.
Jamie.