lib/oversip/sip/proxy.rb in oversip-1.1.0.beta4 vs lib/oversip/sip/proxy.rb in oversip-1.1.0.beta5

- old
+ new

@@ -263,32 +263,34 @@ # But we must run this method if it's an incoming request asking for Outbound usage (in this # case @num_target is nil so the method continues). return if @num_target and @num_target > 0 add_rr_path = false - if @request.initial? && @request.loose_record_aware? - do_loose_routing = @proxy_conf[:do_loose_routing] - # Request has no previous RR/Path and current proxy performs loose-routing. + # NOTE: As per RFC 6665 the proxy MUST add Record-Route to in-dialog NOTIFY's. + if (@request.initial? and @request.record_routing_aware?) or @request.sip_method == :NOTIFY + do_record_routing = @proxy_conf[:do_record_routing] + + # Request has no previous RR/Path and current proxy performs record-routing. # So add RR/Path. - if ! @request.in_rr && do_loose_routing + if ! @request.in_rr && do_record_routing add_rr_path = true - # Request has previous RR/Path and current proxy does not perform loose-routing. + # Request has previous RR/Path and current proxy does not perform record-routing. # So don't add RR/Path and remove the existing one. - elsif @request.in_rr && ! do_loose_routing + elsif @request.in_rr && ! do_record_routing case @request.in_rr when :rr, :outgoing_outbound_rr, :incoming_outbound_rr, :both_outbound_rr @request.delete_header_top "Record-Route" when :path, :outgoing_outbound_path, :incoming_outbound_path, :both_outbound_path @request.delete_header_top "Path" end @request.in_rr = nil # Remaining cases are: - # - Request has previous RR/Path and current proxy performs loose-routing. - # - Request has no previous RR/Path and current proxy does not perform loose-routing. + # - Request has previous RR/Path and current proxy performs record-routing. + # - Request has no previous RR/Path and current proxy does not perform record-routing. # So don't add RR/Path. end end unless @request.proxied @@ -298,11 +300,10 @@ # Set the Max-Forwards header. @request.headers["Max-Forwards"] = [ @request.new_max_forwards.to_s ] if @request.new_max_forwards end # Add Record-Route or Path header. - # Here we only arrive if @request.loose_record_aware?, so method is INVITE, REGISTER, SUBSCRIBE or REFER. if add_rr_path case @request.sip_method # Path header (RFC 3327) for REGISTER. when :REGISTER @@ -319,10 +320,10 @@ else @request.in_rr = :path @request.insert_header "Path", @request.connection.class.record_route end - # Record-Route for INVITE, SUBSCRIBE, REFER. + # Record-Route for INVITE, SUBSCRIBE, REFER and in-dialog NOTIFY. else if @request.outgoing_outbound_requested? if @request.incoming_outbound_requested? @request.in_rr = :both_outbound_rr else \ No newline at end of file