[Freeswitch-users] mod_event_erlang and invalid process type

Gerald Weber gerald.weber at besharp.at
Mon Dec 31 15:30:24 MSK 2012


Hi all,

trying to learn erlang i tried to connect to freeswitch using mod_event_erlang and receive some events:

erlang shell:

[root at fstest ~]# erl -name test33 at freeswitch.besharp.at -setcookie ClueCon
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.3.1  (abort with ^G)
(test33 at freeswitch.besharp.at)1> Pid = fsevents:start().
<0.46.0>
(test33 at freeswitch.besharp.at)2> fsevents:init('freeswitch at freeswitch.besharp.at').
{event,'ALL'}
(test33 at freeswitch.besharp.at)3>


Console output:

2012-12-31 13:18:36.900506 [DEBUG] handle_msg.c:301 ALL events enabled
2012-12-31 13:18:36.900506 [DEBUG] handle_msg.c:314 enable event ALL
2012-12-31 13:18:51.480577 [ERR] ei_helpers.c:274 Invalid process type 0! ((null),, <0.0.0>)
2012-12-31 13:18:51.480577 [ERR] ei_helpers.c:274 Invalid process type 0! ((null),, <0.0.0>)
2012-12-31 13:18:51.500492 [ERR] ei_helpers.c:274 Invalid process type 0! ((null),, <0.0.0>)

Can anyone tell me what i'm doing wrong ? Console log keeps saying invalid process type (until i kill the erlang process)
and i dont receive any events.

Erlang Version: 5.9.3.1
Freeswitch: latest HEAD from 2012-12-31

The fsevents module:

-module(fsevents).
-export([start/0, init/1, loop/0]).

start() ->
                Pid = spawn(?MODULE, loop, []),
                register(?MODULE,Pid),
                Pid.

init(Node) ->
                {foo, Node} ! {event, 'ALL'}.

loop() ->
                receive
                               stop ->
                                               ok;
                               _Anything ->
                                               io:format("received ~p~n", [_Anything]),
                                               loop()
                end.


The communication seems to work basically:


(test33 at freeswitch.besharp.at)4> {foo, freeswitch at freeswitch.besharp.at} ! {api, status, ""}.
{api,status,[]}
(test33 at freeswitch.besharp.at)5> receive Y -> Y after 1000 -> timeout end.
{ok,"UP 0 years, 0 days, 1 hour, 20 minutes, 52 seconds, 534 milliseconds, 225 microseconds\nFreeSWITCH (Version 1.3.13b git 8859eb0 2012-12-30 19:08:55Z) is ready\n0 session(s) since startup\n0 session(s) - 0 out of max 30 per sec \n1000 session(s) max\nmin idle cpu 0.00/99.00\nCurrent Stack Size/Max 240K/8192K\n"}
(test33 at freeswitch.besharp.at)3<mailto:test33 at freeswitch.besharp.at)3>>

Console output:

freeswitch at fstest> load mod_erlang_event
2012-12-31 13:17:21.420611 [INFO] mod_enum.c:872 ENUM Reloaded
2012-12-31 13:17:21.420611 [INFO] switch_time.c:1165 Timezone reloaded 530 definitions
2012-12-31 13:17:21.420611 [DEBUG] mod_erlang_event.c:1816 sections 16
2012-12-31 13:17:21.420611 [CONSOLE] switch_loadable_module.c:1348 Successfully Loaded [mod_erlang_event]
2012-12-31 13:17:21.420611 [NOTICE] switch_loadable_module.c:254 Adding Application 'erlang'
2012-12-31 13:17:21.420611 [NOTICE] switch_loadable_module.c:254 Adding Application 'erlang_sendmsg'
2012-12-31 13:17:21.420611 [NOTICE] switch_loadable_module.c:298 Adding API Function 'erlang'

+OK Reloading XML
+OK

2012-12-31 13:17:21.420611 [DEBUG] mod_erlang_event.c:1915 Socket 48 up listening on 0.0.0.0:8031
2012-12-31 13:17:21.420611 [DEBUG] mod_erlang_event.c:1946 Connected to epmd and published erlang cnode at freeswitch at freeswitch.besharp.at
freeswitch at fstest> 2012-12-31 13:17:43.380527 [DEBUG] mod_erlang_event.c:1986 Launching listener, connection from node test33 at freeswitch.besharp.at, ip 192.168.20.73
2012-12-31 13:17:43.380527 [DEBUG] mod_erlang_event.c:1009 Connection Open from 192.168.20.73

Thanks / regards and Happy New Year :)
Gw

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20121231/1ebd2257/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list