Commit ede046c2 authored by Steffen Ullrich's avatar Steffen Ullrich

StatelessProxy: make sure that idfrom/idto in NAT helper are based on

  normalized URL, so that different writing (with comment, with <..>..) do
  not affect the value. This is needed if peers use a different syntax for
  the same URI during the dialog.
parent 66edb91f
......@@ -659,21 +659,17 @@ sub do_nat {
# Leg, delimited by "\0"
my ($idfrom,$idto);
if ( my $from = $packet->get_header( 'from' ) ) {
my ($data,$param) = sip_hdrval2parts( from => $from );
my $tag = $param->{tag} || '';
$idfrom = "$data\0$tag";
} else {
return [ 0,'no FROM header in packet' ]
for([from => \$idfrom], [to => \$idto]) {
my ($k,$idref) = @$_;
if (my $v = $packet->get_header($k) ) {
my ($uri,$param) = sip_hdrval2parts(from => $v);
my ($dom,$user,$proto) = sip_uri2parts($uri);
$$idref = "$proto:$user\@$dom\0".($param->{tag} || '');
} else {
return [ 0,'no '.uc($k).' header in packet' ]
}
}
if ( my $to = $packet->get_header( 'to' ) ) {
my ($data,$param) = sip_hdrval2parts( from => $to );
my $tag = $param->{tag} || '';
$idto = "$data\0$tag";
} else {
return [ 0,'no TO header in packet' ]
}
# side is either 0 (request) or 1 (response)
# If a request comes in 'from' points to the incoming_leg while
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment