Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 40 additions & 40 deletions include/nksip.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@
id :: nksip_sipmsg:id(),
class :: {req, nksip:method()} | {resp, nksip:sip_code(), binary()},
srv_id :: nkserver:id(),
dialog_id :: nksip_dialog_lib:id(),
ruri :: nksip:uri(),
dialog_id :: nksip_dialog_lib:id() | undefined,
ruri :: nksip:uri() | undefined,
vias = [] :: [nksip:via()],
from :: {nksip:uri(), FromTag::binary()},
to :: {nksip:uri(), ToTag::binary()},
from :: {nksip:uri(), FromTag::binary()} | undefined,
to :: {nksip:uri(), ToTag::binary()} | undefined,
call_id :: nksip:call_id(),
cseq :: {nksip:cseq(), nksip:method()},
forwards :: non_neg_integer(),
cseq :: {nksip:cseq(), nksip:method()} | undefined,
forwards :: non_neg_integer() | undefined,
routes = [] :: [nksip:uri()],
contacts = [] :: [nksip:uri()],
content_type :: nksip:token() | undefined,
Expand All @@ -152,7 +152,7 @@
headers = [] :: [nksip:header()],
body = <<>> :: nksip:body(),
to_tag_candidate = <<>> :: nksip:tag(),
nkport :: nkpacket:nkport(),
nkport :: nkpacket:nkport() | undefined,
start :: nklib_util:l_timestamp(),
meta = [] :: nksip:optslist() % No current use
}).
Expand All @@ -166,7 +166,7 @@
}).

-record(via, {
transp = udp :: nkpacket:transport(),
transp = udp :: nkpacket:transport() | binary(),
domain = <<"invalid.invalid">> :: binary(),
port = 0 :: inet:port_number(),
opts = [] :: nksip:optslist()
Expand All @@ -175,33 +175,33 @@

-record(invite, {
status :: nksip_dialog:invite_status(),
answered :: nklib_util:timestamp(),
class :: uac | uas | proxy,
request :: nksip:request(),
response :: nksip:response(),
ack :: nksip:request(),
local_sdp :: nksip_sdp:sdp(),
remote_sdp :: nksip_sdp:sdp(),
media_started :: boolean(),
answered :: nklib_util:timestamp() | undefined,
class :: uac | uas | proxy | undefined,
request :: nksip:request() | undefined,
response :: nksip:response() | undefined,
ack :: nksip:request() | undefined,
local_sdp :: nksip_sdp:sdp() | undefined,
remote_sdp :: nksip_sdp:sdp() | undefined,
media_started :: boolean() | undefined,
sdp_offer :: nksip_call_dialog:sdp_offer(),
sdp_answer :: nksip_call_dialog:sdp_offer(),
timeout_timer :: reference(),
retrans_timer :: reference(),
next_retrans :: integer()
timeout_timer :: reference() | undefined,
retrans_timer :: reference() | undefined,
next_retrans :: integer() | undefined
}).


-record(subscription, {
id :: nksip_subscription_lib:id(),
event :: nksip:token(),
expires :: pos_integer(),
expires :: pos_integer() | undefined,
status :: nksip_subscription:status(),
class :: uac | uas,
answered :: nklib_util:timestamp(),
timer_n :: reference(),
timer_expire :: reference(),
timer_middle :: reference(),
last_notify_cseq :: nksip:cseq()
answered :: nklib_util:timestamp() | undefined,
timer_n :: reference() | undefined,
timer_expire :: reference() | undefined,
timer_middle :: reference() | undefined,
last_notify_cseq :: nksip:cseq() | undefined
}).


Expand All @@ -214,18 +214,18 @@
call_id :: nksip:call_id(),
created :: nklib_util:timestamp(),
updated :: nklib_util:timestamp(),
local_seq :: 0 | nksip:cseq(),
remote_seq :: 0 | nksip:cseq(),
local_uri :: nksip:uri(),
remote_uri :: nksip:uri(),
local_seq :: 0 | nksip:cseq() | undefined,
remote_seq :: 0 | nksip:cseq() | undefined,
local_uri :: nksip:uri() | undefined,
remote_uri :: nksip:uri() | undefined,
local_target :: nksip:uri(), % Only for use in proxy
remote_target :: nksip:uri(),
route_set :: [nksip:uri()],
blocked_route_set :: boolean(),
early :: boolean(),
secure :: boolean(),
caller_tag :: nksip:tag(),
invite :: nksip:invite(),
invite :: nksip:invite() | undefined,
subscriptions = [] :: [#subscription{}],
supported = [] :: [nksip:token()],
meta = [] :: nksip:optslist()
Expand All @@ -239,10 +239,10 @@
nports = 1 :: integer(),
proto = <<"RTP/AVP">> :: binary(),
fmt = [] :: [binary()], % <<"0">>, <<"101">> ...
info :: binary(),
connect :: nksip_sdp:address(),
info :: binary() | undefined,
connect :: nksip_sdp:address() | undefined,
bandwidth = [] :: [binary()],
key :: binary(),
key :: binary() | undefined,
attributes = [] :: [nksip_sdp:sdp_a()]
}).

Expand All @@ -253,15 +253,15 @@
vsn = 0 :: non_neg_integer(),
address = {<<"IN">>, <<"IP4">>, <<"0.0.0.0">>} :: nksip_sdp:address(),
session = <<"nksip">> :: binary(),
info :: binary(),
uri :: binary(),
email :: binary(),
phone :: binary(),
connect :: nksip_sdp:address(),
info :: binary() | undefined,
uri :: binary() | undefined,
email :: binary() | undefined,
phone :: binary() | undefined,
connect :: nksip_sdp:address() | undefined,
bandwidth = [] :: [binary()],
time = [] :: [nksip_sdp:sdp_t()],
zone :: binary(),
key :: binary(),
zone :: binary() | undefined,
key :: binary() | undefined,
attributes = [] :: [nksip_sdp:sdp_a()],
medias = [] :: [nksip_sdp:sdp_m()]
}).
Expand Down
32 changes: 16 additions & 16 deletions include/nksip_call.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,27 @@
-record(trans, {
id :: nksip_call:trans_id(),
class :: uac | uas,
status :: nksip_call_uac:status() | nksip_call_uas:status(),
status :: nksip_call_uac:status() | nksip_call_uas:status() | undefined,
start :: nklib_util:timestamp(),
from :: none | {srv, {pid(), term()}} | {fork, nksip_call_fork:id()},
from :: none | {srv, {pid(), term()}} | {fork, nksip_call_fork:id()} | undefined,
opts :: nksip:optslist(),
trans_id :: integer(),
request :: nksip:request(),
trans_id :: integer() | undefined,
request :: nksip:request() | undefined,
method :: nksip:method(),
ruri :: nksip:uri(),
transp :: nkpacket:transport(),
response :: nksip:response(),
transp :: nkpacket:transport() | undefined,
response :: nksip:response() | undefined,
code :: 0 | nksip:sip_code(),
to_tags = [] :: [nksip:tag()],
stateless :: boolean(),
stateless :: boolean() | undefined,
iter = 1 :: pos_integer(),
cancel :: undefined | to_cancel | cancelled,
loop_id :: integer(),
timeout_timer :: {nksip_call_lib:timeout_timer(), reference()},
retrans_timer :: {nksip_call_lib:retrans_timer(), reference()},
next_retrans :: non_neg_integer(),
expire_timer :: {nksip_call_lib:expire_timer(), reference()},
ack_trans_id :: integer(),
loop_id :: integer() | undefined,
timeout_timer :: {nksip_call_lib:timeout_timer(), reference()} | undefined,
retrans_timer :: {nksip_call_lib:retrans_timer(), reference()} | undefined,
next_retrans :: non_neg_integer() | undefined,
expire_timer :: {nksip_call_lib:expire_timer(), reference()} | undefined,
ack_trans_id :: integer() | undefined,
meta = [] :: nksip:optslist()
}).

Expand Down Expand Up @@ -120,7 +120,7 @@

-type call_auth() :: {
nksip_dialog_lib:id(),
nkpacket:nkport(),
nkpacket:transport(),
inet:ip_address(),
inet:port_number()
}.
Expand Down Expand Up @@ -173,8 +173,8 @@
event_expires :: integer(),
event_expires_offset :: integer(),
nonce_timeout :: integer(),
from :: #uri{},
accept :: [binary()],
from :: #uri{} | undefined,
accept :: [binary()] | undefined,
events :: [binary()],
route :: [#uri{}],
no_100 :: boolean(),
Expand Down
2 changes: 1 addition & 1 deletion include/nksip_event_compositor.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

-record(reg_publish, {
data :: nksip:body(),
expires :: nklib_util:timestamp(),
expires :: nklib_util:timestamp() | undefined,
meta = [] :: nksip:optslist()
}).

Expand Down
24 changes: 12 additions & 12 deletions include/nksip_registrar.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@


-record(reg_contact, {
index :: nksip_registrar_lib:index(),
contact :: nksip:uri(),
updated :: nklib_util:l_timestamp(),
expire :: nklib_util:timestamp(),
q :: float(),
call_id :: nksip:call_id(),
cseq :: nksip:cseq(),
nkport :: nkpacket:nkport(),
path = [] :: [nksip:uri()],
meta = [] :: nksip:optslist()
index :: nksip_registrar_lib:index() | undefined,
contact :: nksip:uri() | undefined,
updated :: nklib_util:l_timestamp() | undefined,
expire :: nklib_util:timestamp() | undefined,
q :: float() | undefined,
call_id :: nksip:call_id() | undefined,
cseq :: nksip:cseq() | undefined,
nkport :: nkpacket:nkport() | undefined,
path = [] :: [nksip:uri()] | undefined,
meta = [] :: nksip:optslist() | undefined
}).

-record(nksip_registrar_time, {
min :: pos_integer(),
max :: pos_integer(),
default :: pos_integer(),
time :: pos_integer(),
time_long :: pos_integer()
time :: pos_integer() | undefined,
time_long :: pos_integer() | undefined
}).


Expand Down
4 changes: 2 additions & 2 deletions include/nksip_uac_auto_outbound.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
id :: term(),
pos :: integer(),
cseq :: nksip:cseq(),
conn_monitor :: reference(),
conn_pid :: pid(),
conn_monitor :: reference() | undefined,
conn_pid :: pid() | undefined,
fails :: non_neg_integer()
}).

Expand Down
4 changes: 2 additions & 2 deletions include/nksip_uac_auto_register.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
interval :: non_neg_integer(),
from :: any(),
cseq :: nksip:cseq(),
next :: nklib_util:timestamp(),
ok :: boolean()
next :: nklib_util:timestamp() | undefined,
ok :: boolean() | undefined
}).


Expand Down
2 changes: 2 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@
{nkpacket, {git, "https://github.com/netcomposer/nkpacket", {branch, "master"}}},
{nkserver, {git, "https://github.com/netcomposer/nkserver", {branch, "master"}}}
]}.

{dialyzer, [{plt_extra_apps, [ nklib, nkpacket, nkserver, cowboy, cowlib, ranch ]}]}.
4 changes: 2 additions & 2 deletions src/nksip.erl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

-type config() ::
#{
plugins => [atom()],
plugins => [any()],
sip_listen => binary(),
sip_allow => binary(),
sip_supported => binary(),
Expand Down Expand Up @@ -224,7 +224,7 @@ stop(Id) ->

%% @doc Retrieves a service as a supervisor child specification
-spec get_sup_spec(id(), config()) ->
{ok, supervisor:child_spec()} | {error, term()}.
supervisor:child_spec().

get_sup_spec(Id, Config) ->
Config2 = nklib_util:to_map(Config),
Expand Down
8 changes: 4 additions & 4 deletions src/nksip_auth.erl
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,13 @@ ha1_test() ->
?assertMatch(
<<"194370e184088fb011b140d770936009">>,
make_auth_response([], 'INVITE', <<"test@test.com">>, HA1,
<<"gfedcba">>, <<"abcdefg">>, 1)),
<<"gfedcba">>, <<"abcdefg">>, <<"00000001">>)),
?assertMatch(
<<"788a70e3b5d371dc5f9dee5e59bb80cd">>,
<<"bf47fa2667ddc2be29b88d0cec6ae35e">>,
make_auth_response([other, auth], 'INVITE', <<"test@test.com">>, HA1,
<<"gfedcba">>, <<"abcdefg">>, 1)),
<<"gfedcba">>, <<"abcdefg">>, <<"00000001">>)),
?assertMatch(<<>>, make_auth_response([other], 'INVITE', <<"any">>, HA1, <<"any">>,
<<"any">>, 1)),
<<"any">>, <<"00000001">>)),
[
{scheme,digest},
{realm,<<"av">>},
Expand Down
4 changes: 2 additions & 2 deletions src/nksip_call_proxy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

%% @doc Tries to route a request to set of uris, serially and/or in parallel.
-spec route(nksip:uri_set(), nksip:optslist(), nksip_call:trans(), nksip_call:call()) ->
{fork, nksip_call:trans(), nksip:uri_set()} | noreply |
{fork, nksip_call:trans(), nksip:uri_set()} |
{reply, nksip:sipreply(), nksip_call:call()}.

route(UriList, ProxyOpts, UAS, Call) ->
Expand Down Expand Up @@ -197,7 +197,7 @@ check_request(#sipmsg{class={req, Method}, forwards=Forwards}=Req, Opts) ->

%% @doc Process a UriSet generating a standard `[[nksip:uri()]]'.
%% See test code for examples.
-spec normalize_uriset(nksip:uri_set()) ->
-spec normalize_uriset(nksip:uri_set() | atom() | [atom()]) ->
[[nksip:uri()]].

normalize_uriset(#uri{}=Uri) ->
Expand Down
1 change: 1 addition & 0 deletions src/nksip_call_uac.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
-export([is_stateless/1, response/2]).
-export_type([status/0, uac_from/0]).
-import(nksip_call_lib, [update/2]).
-dialyzer(no_missing_calls).

-include("nksip.hrl").
-include("nksip_call.hrl").
Expand Down
4 changes: 2 additions & 2 deletions src/nksip_call_uac_make.erl
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ make_ack(#sipmsg{vias=[Via|_], cseq={CSeq, _}}=Req) ->


%% @private
-spec parse_opts(nksip:optslist(), nksip:request(), nksip:optslist()) ->
-spec parse_opts([nksip_uac:req_option()], nksip:request(), nksip:optslist()) ->
{nksip:request(), nksip:optslist()}.


Expand Down Expand Up @@ -494,7 +494,7 @@ parse_opts([Term|Rest], Req, Opts) ->

%% @private
-spec parse_plugin_opts(nksip:request(), map()) ->
{nksip:request(), map()}.
{nksip:request(), [nksip_uac:req_option()]}.

parse_plugin_opts(#sipmsg{srv_id=SrvId}=Req, Opts) ->
case ?CALL_SRV(SrvId, nksip_parse_uac_opts, [Req, Opts]) of
Expand Down
3 changes: 2 additions & 1 deletion src/nksip_call_uac_transp.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
-author('Carlos Gonzalez <carlosj.gf@gmail.com>').

-export([send_request/3, resend_request/2, add_headers/6]).
-dialyzer(no_missing_calls).

-include_lib("nklib/include/nklib.hrl").
-include_lib("nkpacket/include/nkpacket.hrl").
Expand Down Expand Up @@ -128,7 +129,7 @@ send_request(Req, Call, Opts) ->
-spec resend_request(nksip:request(), nksip:optslist()) ->
{ok, nksip:request()} | error.

resend_request(#sipmsg{ srv_id=SrvId, nkport=NkPort}=Req, Opts) ->
resend_request(#sipmsg{ srv_id=SrvId, nkport=NkPort}=Req, Opts) when NkPort =/= undefined ->
Msg = fun(NkPort2) -> Req#sipmsg{nkport=NkPort2} end,
nksip_util:send(SrvId, [NkPort], Msg, Opts).

Expand Down
1 change: 1 addition & 0 deletions src/nksip_call_uas.erl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

-export([request/2, reply/3, do_reply/3]).
-export_type([status/0, incoming/0]).
-dialyzer(no_missing_calls).

-import(nksip_call_lib, [update/2]).
-include_lib("nklib/include/nklib.hrl").
Expand Down
Loading