[Freeswitch-svn] [commit] r4832 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia mod/languages/mod_spidermonkey

Freeswitch SVN anthm at freeswitch.org
Mon Apr 2 16:20:47 EDT 2007


Author: anthm
Date: Mon Apr  2 16:20:46 2007
New Revision: 4832

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/switch_event.c

Log:
cleanup

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Mon Apr  2 16:20:46 2007
@@ -796,6 +796,8 @@
 	SWITCH_EVENT_PRESENCE_IN		- Presence in
 	SWITCH_EVENT_PRESENCE_OUT		- Presence out
 	SWITCH_EVENT_PRESENCE_PROBE		- Presence probe
+	SWITCH_EVENT_MESSAGE_WAITING	- A message is waiting
+	SWITCH_EVENT_MESSAGE_QUERY		- A query for MESSAGE_WAITING events
 	SWITCH_EVENT_CODEC				- Codec Change
 	SWITCH_EVENT_BACKGROUND_JOB		- Background Job
 	SWITCH_EVENT_DETECTED_SPEECH	- Detected Speech
@@ -841,6 +843,8 @@
 	SWITCH_EVENT_PRESENCE_IN,
 	SWITCH_EVENT_PRESENCE_OUT,
 	SWITCH_EVENT_PRESENCE_PROBE,
+	SWITCH_EVENT_MESSAGE_WAITING,
+	SWITCH_EVENT_MESSAGE_QUERY,
 	SWITCH_EVENT_ROSTER,
 	SWITCH_EVENT_CODEC,
 	SWITCH_EVENT_BACKGROUND_JOB,

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Mon Apr  2 16:20:46 2007
@@ -454,9 +454,8 @@
 	char *event_name = argv[5];
 
 	if (!strcasecmp(event_name, "message-summary")) {
-		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "no");
-			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "sip:%s@%s", user, host);
+		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", user, host);
 			switch_event_fire(&event);
 		}
 		return 0;

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Mon Apr  2 16:20:46 2007
@@ -128,6 +128,7 @@
 		if ((eo = malloc(sizeof(*eo)))) {
 
 			if (switch_name_event(ename, &etype) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown event %s\n", ename);
 				*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 				return JS_TRUE;
 			}
@@ -146,7 +147,7 @@
 				}
 
 			} else {
-				if (!switch_event_create(&event, etype) != SWITCH_STATUS_SUCCESS) {
+				if (switch_event_create(&event, etype) != SWITCH_STATUS_SUCCESS) {
 					*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
 					return JS_TRUE;
 				}

Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Mon Apr  2 16:20:46 2007
@@ -126,6 +126,8 @@
 	"PRESENCE_IN",
 	"PRESENCE_OUT",
 	"PRESENCE_PROBE",
+	"MESSAGE_WAITING",
+	"MESSAGE_QUERY",
 	"ROSTER",
 	"CODEC",
 	"BACKGROUND_JOB",
@@ -313,7 +315,7 @@
 	assert(RUNTIME_POOL != NULL);
 
 	for (x = 0; x <= SWITCH_EVENT_ALL; x++) {
-		if (!strcasecmp(name, EVENT_NAMES[x])) {
+		if ((strlen(name) > 13 && !strcasecmp(name + 13, EVENT_NAMES[x])) || !strcasecmp(name, EVENT_NAMES[x])) {
 			*type = x;
 			return SWITCH_STATUS_SUCCESS;
 		}



More information about the Freeswitch-svn mailing list