|
> sub receive {
> my ($packet,$leg,$from_addr) = @_;
> ...
> my $resp = $request->create_response('200', 'OK');
> print "\nPacket OUT:\n";
> print $resp->as_string;
> $disp->deliver($resp);
>
> Can't locate object method "uri" via package "Net::SIP::Response" at /usr/local/share/perl/5.10.0
+/Net/SIP/Dispatcher.pm line 498.
It does not know where to deliver the packet, so it tries to look
at a route header (non given) or at the URI.
The latter fails, because it's a response object, not a request,
and thus has no URI.
Yes, it would be better to have a better error correction at this point :)
Look at Net::SIP::Registrar where it solves the same problem.
You have to give the leg and dst_addr to deliver, so that it knows
where to deliver it:
$disp->deliver($resp, leg => $leg, dst_addr => $from_addr )
>
> By the way we can see as well that create_response doesn't switch the From / To of the received p
+acked ;-)
It should not switch them.
See rfc3261, 8.2.6.2:
The From field of the response MUST equal the From header field of
the request.....
If a request contained a To tag in the request, the To header field
in the response MUST equal that of the request.
|