Upgrade Dingaling to meet new googletalk spec upgrade your client if you have issues.

codecs need more work...

Expose events into javascript so you can create and fire events and 
and pick up chat events with chat-enabled clients like googletalk
EXAMPLE:

session.answer();

e = new Event("custom", "JS::Custom");
e.addHeader("subject", "cool");
e.addBody("hello this is a test");
e.fire;

while(session.ready()) {
    session.execute("sleep", "1000");
    event = session.getEvent();
    if (event) {
      str = event.serialize(); // or ("xml")
      console_log("debug", "Dump Event:\n" + str + "\n");


        e = new Event("custom", "JS::Chat");
        e.addHeader("works", "yes");
        e.addBody("you said: " + event.getBody());
        session.sendEvent(e);
      event.destroy();
    }
}





git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2323 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-08-18 01:28:50 +00:00
parent 099a771ddf
commit 47192db741
10 changed files with 520 additions and 38 deletions
+8
View File
@@ -443,6 +443,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_session_t *session, switch_event_t **event);
/*!
\brief Indicate the number of waiting events on a session
\param session the session to check
\return the number of events
*/
SWITCH_DECLARE(int32_t) switch_core_session_event_count(switch_core_session_t *session);
/*!
\brief DE-Queue an event on a given session
\param session the session to de-queue the message on
+7
View File
@@ -155,6 +155,13 @@ SWITCH_DECLARE(switch_status_t) switch_event_set_priority(switch_event_t *event,
*/
SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
/*!
\brief Retrieve the body value from an event
\param event the event to read the body from
\return the value of the body or NULL
*/
SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
/*!
\brief Add a header to an event
\param event the event to add the header to