Exmpp bot start from ejabberd module

Hello,

I try to run jabber bot in ejabberd, written with exmpp.

My bot is usual gen_server remade from example: https://github.com/onlyshk/exmpp/blob/master/examples/echo_client.erl

If i run it from terminal it's ok i see online bot in admin page. But if i try to run it with my ejabberd module, inside in it, i get crash report:

=CRASH REPORT==== 2-Nov-2011::16:29:25 ===
crasher:
initial call: xmpp_talker:init/1
pid: <0.415.0>
registered_name: []
exception exit: {timeout,{gen_fsm,sync_send_event,
[<0.416.0>,
{connect_socket,"localhost",5222,[]},
5000]}}
in function gen_server:init_it/6
ancestors: [ejabberd_sup,<0.40.0>]
messages: []
links: [<0.245.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 610
stack_size: 24
reductions: 320
neighbours:

=ERROR REPORT==== 2-Nov-2011::16:30:25 ===
** State machine <0.416.0> terminating
** Last event in was tcp_closed (for all states)
** When State == stream_opened
** Data == {state,digest,
{{jid,<<"mybot localhost/exmpp#1320251360207273">>,
<<"mybot">>,<<"localhost">>,
<<"exmpp#1320251360207273">>},
"password"},
{0,0},
false,false,false,
[{compression,enabled},{starttls,enabled}],
"localhost","localhost",<0.415.0>,exmpp_socket,
{gen_tcp,#Port<0.5947>},
{xml_stream,
{gen_fsm,<0.416.0>},
{xml_parser,
[{max_size,infinity},
{root_depth,1},
{names_as_atom,true},
{emit_endtag,true},
{check_nss,xmpp},
{check_elems,xmpp},
{check_attrs,xmpp}],
#Port<0.5840>},
new,false,undefined},
"3244568556",undefined,<0.428.0>,undefined,undefined}
** Reason for termination =
** tcp_closed

=CRASH REPORT==== 2-Nov-2011::16:30:25 ===
crasher:
initial call: exmpp_session:init/1
pid: <0.416.0>
registered_name: []
exception exit: tcp_closed
in function gen_fsm:terminate/7
ancestors: [mybot,ejabberd_sup,<0.40.0>]
messages: []
links: []
dictionary: [{random_seed,{1320,8904,23723}}]
trap_exit: false
status: running
heap_size: 1597
stack_size: 24
reductions: 1162
neighbours:

How can i fix it? How can i run it with ejabberd module?

Thank you.

Syndicate content