aboutsummaryrefslogtreecommitdiff
path: root/src/mod_sip_proxy.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_sip_proxy.erl')
-rw-r--r--src/mod_sip_proxy.erl49
1 files changed, 7 insertions, 42 deletions
diff --git a/src/mod_sip_proxy.erl b/src/mod_sip_proxy.erl
index b57e431d6..5e0cfa25e 100644
--- a/src/mod_sip_proxy.erl
+++ b/src/mod_sip_proxy.erl
@@ -24,8 +24,6 @@
%%%-------------------------------------------------------------------
-module(mod_sip_proxy).
--behaviour(ejabberd_config).
-
-define(GEN_FSM, p1_fsm).
-behaviour(?GEN_FSM).
@@ -35,7 +33,7 @@
-export([init/1, wait_for_request/2,
wait_for_response/2, handle_event/3,
handle_sync_event/4, handle_info/3, terminate/3,
- code_change/4, opt_type/1]).
+ code_change/4]).
-include("ejabberd.hrl").
-include("logger.hrl").
@@ -269,8 +267,7 @@ cancel_pending_transactions(State) ->
lists:foreach(fun esip:cancel/1, State#state.tr_ids).
add_certfile(LServer, Opts) ->
- case ejabberd_config:get_option({domain_certfile, LServer},
- fun iolist_to_binary/1) of
+ case ejabberd_config:get_option({domain_certfile, LServer}) of
CertFile when is_binary(CertFile), CertFile /= <<"">> ->
[{certfile, CertFile}|Opts];
_ ->
@@ -316,11 +313,7 @@ is_request_within_dialog(#sip{hdrs = Hdrs}) ->
esip:has_param(<<"tag">>, Params).
need_record_route(LServer) ->
- gen_mod:get_module_opt(
- LServer, mod_sip, always_record_route,
- fun(true) -> true;
- (false) -> false
- end, true).
+ gen_mod:get_module_opt(LServer, mod_sip, always_record_route, true).
make_sign(TS, Hdrs) ->
{_, #uri{user = FUser, host = FServer}, FParams} = esip:get_hdr('from', Hdrs),
@@ -331,7 +324,7 @@ make_sign(TS, Hdrs) ->
LTServer = safe_nameprep(TServer),
FromTag = esip:get_param(<<"tag">>, FParams),
CallID = esip:get_hdr('call-id', Hdrs),
- SharedKey = ejabberd_config:get_option(shared_key, fun(V) -> V end),
+ SharedKey = ejabberd_config:get_option(shared_key),
str:sha([SharedKey, LFUser, LFServer, LTUser, LTServer,
FromTag, CallID, TS]).
@@ -347,41 +340,17 @@ is_signed_by_me(TS_Sign, Hdrs) ->
end.
get_configured_vias(LServer) ->
- gen_mod:get_module_opt(
- LServer, mod_sip, via,
- fun(L) ->
- lists:map(
- fun(Opts) ->
- Type = proplists:get_value(type, Opts),
- Host = proplists:get_value(host, Opts),
- Port = proplists:get_value(port, Opts),
- true = (Type == tcp) or (Type == tls) or (Type == udp),
- true = is_binary(Host) and (Host /= <<"">>),
- true = (is_integer(Port)
- and (Port > 0) and (Port < 65536))
- or (Port == undefined),
- {Type, {Host, Port}}
- end, L)
- end, []).
+ gen_mod:get_module_opt(LServer, mod_sip, via, []).
get_configured_record_route(LServer) ->
gen_mod:get_module_opt(
LServer, mod_sip, record_route,
- fun(IOList) ->
- S = iolist_to_binary(IOList),
- #uri{} = esip:decode_uri(S)
- end, #uri{host = LServer, params = [{<<"lr">>, <<"">>}]}).
+ #uri{host = LServer, params = [{<<"lr">>, <<"">>}]}).
get_configured_routes(LServer) ->
gen_mod:get_module_opt(
LServer, mod_sip, routes,
- fun(L) ->
- lists:map(
- fun(IOList) ->
- S = iolist_to_binary(IOList),
- #uri{} = esip:decode_uri(S)
- end, L)
- end, [#uri{host = LServer, params = [{<<"lr">>, <<"">>}]}]).
+ [#uri{host = LServer, params = [{<<"lr">>, <<"">>}]}]).
mark_transaction_as_complete(TrID, State) ->
NewTrIDs = lists:delete(TrID, State#state.tr_ids),
@@ -455,7 +424,3 @@ safe_nameprep(S) ->
error -> S;
S1 -> S1
end.
-
-opt_type(domain_certfile) -> fun iolist_to_binary/1;
-opt_type(shared_key) -> fun (V) -> V end;
-opt_type(_) -> [domain_certfile, shared_key].