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

View File

@@ -1012,7 +1012,7 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len,
char *txt = (xml->parent) ? xml->parent->txt : "";
switch_size_t off = 0;
uint32_t lcount = 0;
// parent character content up to this tag
*s = switch_xml_ampencode(txt + start, xml->off - start, s, len, max, 0);
@@ -1045,11 +1045,13 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len,
switch_xml_ampencode(attr[i][j + 1], 0, s, len, max, 1);
*len += sprintf(*s + *len, "\"");
}
*len += sprintf(*s + *len, xml->child ? ">\n" : "/>\n");
*len += sprintf(*s + *len, (xml->child || xml->txt) ? ">" : "/>\n");
if (xml->child) {
(*count)++;
*s = switch_xml_toxml_r(xml->child, s, len, max, 0, attr, count);
} else {
*s = switch_xml_ampencode(xml->txt, 0, s, len, max, 0); //data
}
@@ -1058,10 +1060,10 @@ static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len,
*s = realloc(*s, *max += SWITCH_XML_BUFSIZE);
if (xml->child) {
for (lcount = 0; lcount < *count; lcount++) {
*len += sprintf(*s + *len, "%s", XML_INDENT); // indent
}
if (xml->child || xml->txt) {
//for (lcount = 0; lcount < *count; lcount++) {
//*len += sprintf(*s + *len, "%s", XML_INDENT); // indent
//}
*len += sprintf(*s + (*len), "</%s>\n", xml->name); // close tag
}