aboutsummaryrefslogtreecommitdiff
path: root/src/mod_sip.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-05-01 23:35:36 +0400
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-05-02 17:42:45 +0400
commita1337cb73f1b365b8ebd84c02edc44ac82d750e9 (patch)
tree24631039d003d8359555a4292f3c3afc4da22dcb /src/mod_sip.erl
parentDon't use erlang:integer_to_binary/1 (diff)
Do not proxy stray responses statelessly (as per RFC 6026)
Diffstat (limited to 'src/mod_sip.erl')
-rw-r--r--src/mod_sip.erl50
1 files changed, 2 insertions, 48 deletions
diff --git a/src/mod_sip.erl b/src/mod_sip.erl
index 87608d18e..c018924fc 100644
--- a/src/mod_sip.erl
+++ b/src/mod_sip.erl
@@ -75,25 +75,8 @@ message_in(_, _) ->
message_out(_, _) ->
ok.
-response(Resp, SIPSock) ->
- case action(Resp, SIPSock) of
- {relay, LServer} ->
- case esip:split_hdrs('via', Resp#sip.hdrs) of
- {[_], _} ->
- ok;
- {[_MyVia|Vias], TailHdrs} ->
- %% TODO: check if MyVia is really my Via
- NewResp = Resp#sip{hdrs = [{'via', Vias}|TailHdrs]},
- case esip:connect(NewResp, add_certfile(LServer, [])) of
- {ok, SIPSockOut} ->
- esip:send(SIPSockOut, NewResp);
- {error, _} ->
- ok
- end
- end;
- _ ->
- ok
- end.
+response(_Resp, _SIPSock) ->
+ ok.
request(_Req, _SIPSock) ->
error.
@@ -151,35 +134,6 @@ locate(_SIPMsg) ->
%%%===================================================================
%%% Internal functions
%%%===================================================================
-action(#sip{type = response, hdrs = Hdrs}, _SIPSock) ->
- {_, ToURI, _} = esip:get_hdr('to', Hdrs),
- {_, FromURI, _} = esip:get_hdr('from', Hdrs),
- case at_my_host(FromURI) of
- true ->
- case at_my_host(ToURI) of
- true ->
- case ToURI#uri.user of
- <<"">> ->
- to_me;
- _ ->
- {relay, jlib:nameprep(ToURI#uri.host)}
- end;
- false ->
- {relay, jlib:nameprep(FromURI#uri.host)}
- end;
- false ->
- case at_my_host(ToURI) of
- true ->
- case ToURI#uri.user of
- <<"">> ->
- to_me;
- _ ->
- {relay, jlib:nameprep(ToURI#uri.host)}
- end;
- false ->
- pass
- end
- end;
action(#sip{method = <<"REGISTER">>, type = request, hdrs = Hdrs,
uri = #uri{user = <<"">>} = URI} = Req, SIPSock) ->
case at_my_host(URI) of