Responding Liverpie

6 views
Skip to first unread message

Adeel Ansari

unread,
Sep 15, 2008, 5:10:08 AM9/15/08
to liverpie...@googlegroups.com
I am sending the response to liverpie as below, from my web app.

===
        response.setStatus(200);
        response.getWriter().println("event plain ALL");
===

And always find it crashed with this message.

===
** Exiting **
** Exiting... **
./lib/liverpie_server.rb:95:in `send': undefined method `+' for nil:NilClass (NoMethodError)
        from ./lib/liverpie_server.rb:65:in `receive_data'
        from /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/eventmachine.rb:224:in `run_machine'
        from /usr/lib64/ruby/gems/1.8/gems/eventmachine-0.12.0/lib/eventmachine.rb:224:in `run'
        from ./bin/liverpie:20
        from ./lib/script_base.rb:87:in `start'
        from ./lib/script_base.rb:52:in `initialize'
        from ./bin/liverpie:19:in `new'
        from ./bin/liverpie:19

===

Am I doing something wrong? Is there any other particular format to send? Oh forget to tell you, I am using Java.

Thanks.


--
Best,
Adeel Ansari

http://www.linkedin.com/in/adeelansari

Adeel Ansari

unread,
Sep 15, 2008, 10:02:55 PM9/15/08
to liverpie...@googlegroups.com
Should I send it as a request attribute?
Thanks.

Alex Deva

unread,
Sep 16, 2008, 2:29:25 AM9/16/08
to liverpie...@googlegroups.com
Hello Adeel,

As said in the documentation, your webapp must return a plaintext YAML, not just a FreeSWITCH command like you're doing.

The YAML must contain the message (actual FS command), and a hook for when the webapp will be next called again. That hook is comprised of an expected_key and an expected_value.

Let me refer to the example in the documentation:

---
msg: |-
  SendMsg
  call-command: execute
  execute-app-name: playback
  execute-app-arg: ivr/8000/ivr-welcome_to_freeswitch.wav
  event-lock:true
expected_value: CHANNEL_EXECUTE_COMPLETE
expected_key: event_name

Here we have a YAML with 3 keys: 
a. msg (sending the command 'execute playback' with arguments to FS);
b. expected_value
c. expected_key

Liverpie will send whatever is in 'msg' towards FreeSWITCH, then wait until in the communication with FS it encounters the variable 'event_name' as having the value 'CHANNEL_EXECUTE_COMPLETE'. When that happens, it calls your webapp again, and so on.

Please use a Java library of your choice to create a well-formed YAML, or I suppose you could create it "by hand". That is what your response should contain.

Good luck and thank you for your feedback,

  Alex

Adeel Ansari

unread,
Sep 18, 2008, 12:34:52 AM9/18/08
to liverpie...@googlegroups.com
Thanks you very much, Alex, for an adequate explanation. Yes, I am doing it by hand, until the use of a library becomes reasonable to me.

Adeel Ansari

unread,
Sep 18, 2008, 12:59:52 AM9/18/08
to liverpie...@googlegroups.com
One more thing, Alex. Its not calling my webapp with any paramter, not even with unique_id.

Adeel Ansari

unread,
Sep 21, 2008, 12:51:57 PM9/21/08
to liverpie...@googlegroups.com
Thanks Alex for all the help. Its working like charm now. There was a problem with my YAML form.

Alex Deva

unread,
Sep 21, 2008, 1:21:34 PM9/21/08
to liverpie...@googlegroups.com
Thank you!

Perhaps you'll consider contributing with an example webapp in Java, for the "examples" sections?

Adeel Ansari

unread,
Sep 22, 2008, 2:05:35 AM9/22/08
to liverpie...@googlegroups.com
Sure thing. I will send one soon.

Alex Deva

unread,
Sep 25, 2008, 6:54:30 AM9/25/08
to liverpie...@googlegroups.com
Hello,

Liverpie 0.2 has just been released. Check it out at www.liverpie.com

There's a doc/CHANGELOG now.

This version's changes:

25 sept 2008 - version 0.2
* fixed a bug that prevented web servers that don't send cookies
with each request (like Tomcat) to work with Liverpie
* fixed a bug where Liverpie would crash if the webapp became
unavailable. Now it just carelessly logs it.

A Java example has also been added to the web site, thanks to Adeel
Ansari.

Alex

Adeel Ansari

unread,
Sep 26, 2008, 12:29:37 AM9/26/08
to liverpie...@googlegroups.com
Thanks, Alex for the update and your efforts.
Reply all
Reply to author
Forward
0 new messages