[Freeswitch-users] mod_erlang_event problem

Timur Irmatov irmatov at gmail.com
Thu Jun 24 21:32:44 PDT 2010


Hi, Andrew!


On Thu, Jun 24, 2010 at 7:57 PM, Andrew Thompson <andrew at hijacked.us> wrote:
>> My application is very simple: it just prints all events received from
>> freeswitch. The problem is, that call is being terminated immidiately.
>> As far as I can see, phonebooth:launch is called successfully, it
>> returns a pid of a new process. This new process is still alive after
>> the call is finished, and it does not receive any events from
>> freeswitch (if it would, it would print them to screen). Freeswitch
>> log tells me that erlang_outbound_function exits as soon as it gets
>> new pid
>>
>
> Yeah, I think this is a bug - Can you show me the code that's running?

The code is very simple, just a gen_server that does nothing excepting
printing info about events via io:format. See attached phonebooth.erl
(I would paste it inline, but it would break formatting).

> I think the bug is in the RPC mechanism vs the ! variant, unfortunately
> I don't have a box with *both* freeswitch and erlang on it handy at the
> moment - can you write a simple daemon that waits for the get_pid
> messages and spawns on demand, as described on the wiki, and see if it
> works that way (that's the way I usually do it).

That's the way it is done on my other server. And it works there fine.
But, also, on that server I also use RPC mechanism the same way I done
it on new one, and it works there fine too. It's just older freeswitch
and older erlang there. Don't know if that matters, or may be RPC
works there simply because I also use registered process and get_pid.

Ok, now I have switched to processing of get_pid messages:

  <extension name="phonebooth">
    <condition field="destination_number" expression="^000([0-9]+)$">
      <!-- <action application="erlang" data="phonebooth:launch
test at test-server" /> -->
      <action application="erlang" data="phonebooth:! test at test-server" />
    </condition>
  </extension>

I have added spawner.erl (attached), which is being registered as
phonebooth process, processes get_new messages and starts new process
for each call. phonebooth.erl is not changed. Same problem:

2010-06-25 09:23:41.891156 [DEBUG] mod_erlang_event.c:1316 got pid!
2010-06-25 09:23:41.891156 [DEBUG] mod_erlang_event.c:1446 exit
erlang_outbound_function

Log is attached. I am ready to perform further testing/ debugging if
you'll tell me what to try next.


-- 
Timur Irmatov, xmpp:irmatov at jabber.ru
-------------- next part --------------
A non-text attachment was scrubbed...
Name: phonebooth.erl
Type: text/x-erlang
Size: 2374 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100625/65735743/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spawner.erl
Type: text/x-erlang
Size: 777 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100625/65735743/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fs.log
Type: text/x-log
Size: 10475 bytes
Desc: not available
Url : http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100625/65735743/attachment-0002.bin 


More information about the FreeSWITCH-users mailing list