[Freeswitch-users] mod_event_erlang and invalid process type

Gerald Weber gerald.weber at besharp.at
Mon Dec 31 16:12:16 MSK 2012


Some more infos:

Changed the init/1 function to:

init(Node) ->
                {foo, Node} ! register_event_handler,
                {foo, Node} ! register_log_handler,
                {foo, Node} ! {event, 'ALL'},
                {foo, Node} ! {set_log_level, debug}.

Now the "invalid process type" error message disappeared, but i still dont get any events.

Some erlang console command outputs:

freeswitch at fstest> erlang listeners

Listener to test33 at freeswitch.besharp.at with 0 outbound sessions

freeswitch at fstest> erlang bindings

No bindings

freeswitch at fstest> erlang handlers

Listener test33 at freeswitch.besharp.at:
--------------------------------
CLONE
CHANNEL_CREATE
CHANNEL_DESTROY
CHANNEL_STATE
CHANNEL_CALLSTATE
CHANNEL_ANSWER
CHANNEL_HANGUP
CHANNEL_HANGUP_COMPLETE
CHANNEL_EXECUTE
CHANNEL_EXECUTE_COMPLETE
CHANNEL_HOLD
CHANNEL_UNHOLD
CHANNEL_BRIDGE
CHANNEL_UNBRIDGE
CHANNEL_PROGRESS
CHANNEL_PROGRESS_MEDIA
CHANNEL_OUTGOING
CHANNEL_PARK
CHANNEL_UNPARK
CHANNEL_APPLICATION
CHANNEL_ORIGINATE
CHANNEL_UUID
API
LOG
INBOUND_CHAN
OUTBOUND_CHAN
STARTUP
SHUTDOWN
PUBLISH
UNPUBLISH
TALK
NOTALK
SESSION_CRASH
MODULE_LOAD
MODULE_UNLOAD
DTMF
MESSAGE
PRESENCE_IN
NOTIFY_IN
PRESENCE_OUT
PRESENCE_PROBE
MESSAGE_WAITING
MESSAGE_QUERY
ROSTER
CODEC
BACKGROUND_JOB
DETECTED_SPEECH
DETECTED_TONE
PRIVATE_COMMAND
HEARTBEAT
TRAP
ADD_SCHEDULE
DEL_SCHEDULE
EXE_SCHEDULE
RE_SCHEDULE
RELOADXML
NOTIFY
SEND_MESSAGE
RECV_MESSAGE
REQUEST_PARAMS
CHANNEL_DATA
GENERAL
COMMAND
SESSION_HEARTBEAT
CLIENT_DISCONNECTED
SERVER_DISCONNECTED
SEND_INFO
RECV_INFO
RECV_RTCP_MESSAGE
CALL_SECURE
NAT
RECORD_START
RECORD_STOP
PLAYBACK_START
PLAYBACK_STOP
CALL_UPDATE
FAILURE
SOCKET_DATA
MEDIA_BUG_START
MEDIA_BUG_STOP
CONFERENCE_DATA_QUERY
CONFERENCE_DATA
CALL_SETUP_REQ
CALL_SETUP_RESULT
CUSTOM:

Thanks
gw

Von: freeswitch-users-bounces at lists.freeswitch.org [mailto:freeswitch-users-bounces at lists.freeswitch.org] Im Auftrag von Gerald Weber
Gesendet: Montag, 31. Dezember 2012 13:30
An: freeswitch-users at lists.freeswitch.org
Betreff: [Freeswitch-users] mod_event_erlang and invalid process type

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<mailto: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<mailto:test33 at freeswitch.besharp.at)1>> Pid = fsevents:start().
<0.46.0>
(test33 at freeswitch.besharp.at)2<mailto:test33 at freeswitch.besharp.at)2>> fsevents:init('freeswitch at freeswitch.besharp.at').
{event,'ALL'}
(test33 at freeswitch.besharp.at)3<mailto: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<mailto:test33 at freeswitch.besharp.at)4>> {foo, freeswitch at freeswitch.besharp.at<mailto:freeswitch at freeswitch.besharp.at>} ! {api, status, ""}.
{api,status,[]}
(test33 at freeswitch.besharp.at)5<mailto: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<mailto: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<mailto: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/8ca14562/attachment-0001.html 


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