From ab725b5cc73559c50eb1fe17c9c6f43b2a0528d1 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 19 Oct 2011 22:57:44 +0200 Subject: [PATCH] allow users to bind to a subsystem number on all local point codes binding to {SSN,undefined} basically corresponds to binding to a UDP port with INADDR_ANY. --- src/sccp_user.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sccp_user.erl b/src/sccp_user.erl index 0795afb..0df5c7d 100644 --- a/src/sccp_user.erl +++ b/src/sccp_user.erl @@ -56,6 +56,10 @@ init(_Arg) -> % client side code +bind_ssn(Ssn) when is_integer(Ssn) -> + gen_server:call(?MODULE, {bind_ssn, Ssn, undefined}). +bind_ssn(Ssn, undefined) when is_integer(Ssn) -> + gen_server:call(?MODULE, {bind_ssn, Ssn, undefined}); bind_ssn(Ssn, Pc) when is_integer(Ssn), is_integer(Pc) -> gen_server:call(?MODULE, {bind_ssn, Ssn, Pc}); bind_ssn(Ssn, Pc) when is_integer(Ssn), is_tuple(Pc) -> @@ -76,7 +80,13 @@ pid_for_ssn(Ssn, Pc) when is_integer(Ssn), is_integer(Pc) -> [#scu_record{user_pid = UserPid}] -> {ok, UserPid}; _ -> - {error, no_such_ssn} + % check if somebody has bound a SSN to all point codes + case ets:lookup(sccp_user_tbl, {Ssn, undefined}) of + [#scu_record{user_pid = UserPid}] -> + {ok, UserPid}; + _ -> + {error, no_such_ssn} + end end; pid_for_ssn(Ssn, Pc) when is_integer(Ssn), is_tuple(Pc) -> PcInt = osmo_util:pointcode2int(Pc),