Subject: | Net::SIP::StatelessProxy PRACK route failure when using custom contact |
Date: | Mon, 24 Apr 2017 10:11:58 +0000 |
To: | "bug-Net-SIP [...] rt.cpan.org" <bug-Net-SIP [...] rt.cpan.org> |
From: | Richard Carver <richard.carver [...] cloudmont.co.uk> |
I am specifying the contact on my legs to use the host name as I am using TLS. I set the contact for a leg to 'sip:full.host.name:5061;transport=tls' (the system I am integrating to does not like 'sips' so I have to use 'sip'). On call setup when a PRACK arrives with route headers, StatelessProxy fails to match the route against a leg as it only checks for address and port, resulting in it treating it as the next hop and sending the message to itself:
Net::SIP::StatelessProxy::__forward_request_getleg[389]: no legs which can deliver to full.host.name:5061 (route)
The following patch adds a lookup against contact to resolve this issue.
*** /usr/local/share/perl5/Net/SIP/StatelessProxy.pm.orig 2017-04-24 10:03:54.866516615 +0000
--- /usr/local/share/perl5/Net/SIP/StatelessProxy.pm 2017-04-24 09:59:02.759900745 +0000
*************** sub __forward_request_getleg {
*** 383,388 ****
--- 383,393 ----
port => $port
);
}
+ if ( ! @legs ) {
+ @legs = $self->{dispatcher}->get_legs(
+ sub => [ sub { sip_uri_eq( $_[0], $_[1]->{contact} ) }, $data ]
+ );
+ }
if ( @legs ) {
DEBUG( 50,"setting leg from our route header: $data -> ".$legs[0]->dump );
$entry->{outgoing_leg} = \@legs;