shimaore / esl

Node.js client and server for FreeSwitch Event Socket
The Unlicense
128 stars 41 forks source link

Basic streaming of events? #23

Closed avimar closed 9 years ago

avimar commented 9 years ago

Hi sorry to bother you, but can you please provide an example, in normal javascript, of simply connecting and getting all events to display similar to the output in freeswitch.log?

I see all sorts of server and client samples to execute commands, but I can't put my finger on a basic "listen to all events" example.

Thanks!

james-criscuolo commented 9 years ago

Hi avimar,

Firstly, I hope @shimaore doesn't mind me helping out here, and I would defer to him if something I say here is wrong.

Using the event_json function with argument 'ALL' will make all events coming out of FreeSwitch reach your inbound channel. Filtering and other more complex arguments can be found in Freeswitch documentation.

As for a basic example, I'm sure you can loop through all the events, setting up a listener on each one, and have those print out. Maybe there is an easier way without touching the library, but adding a log line at the bottom of parser.process should log every single event that comes in.

Good luck, James

shimaore commented 9 years ago

Thank you @james-onsip ! :) Only thing I wanted to add was Message Tracing: basically setting (process.env.) DEBUG to esl:response will show a lot of information; in this case the emit events and their parameters are what you are looking for.