summaryrefslogtreecommitdiff
path: root/src/pbx_conn.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/pbx_conn.erl')
-rw-r--r--src/pbx_conn.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pbx_conn.erl b/src/pbx_conn.erl
index af3dbc0..3b7465a 100644
--- a/src/pbx_conn.erl
+++ b/src/pbx_conn.erl
@@ -13,7 +13,7 @@ start_link() ->
gen_server:start_link({local, ?SERVER}, ?MODULE, [?HOST, ?PORT], []).
init(Args) ->
- send(pbx_acse:associate()),
+ send(pbx_acse:encode(associate)),
[Host, Port] = Args,
gen_tcp:connect(Host, Port, [binary, {packet, 2}]).
@@ -22,7 +22,9 @@ handle_call(_Request, _From, Socket) ->
handle_cast({ok, Reply}, Socket) ->
gen_tcp:send(Socket, Reply),
- {noreply, Socket}.
+ {noreply, Socket};
+handle_cast({error, Reason}, Socket) ->
+ {stop, Reason, Socket}.
handle_info({tcp, _, Data}, Socket) ->
case pbx_acse:decode(Data) of
@@ -38,7 +40,7 @@ handle_info({tcp_closed, _}, Socket) ->
{stop, normal, Socket}.
terminate(_Reason, Socket) ->
- send(pbx_acse:release()),
+ send(pbx_acse:encode(release)),
gen_tcp:close(Socket).
code_change(_OldVsn, Socket, _Extra) ->