[Freeswitch-svn] [commit] r11019 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event

FreeSWITCH SVN andrew at freeswitch.org
Tue Dec 30 20:47:58 PST 2008


Author: andrew
Date: Tue Dec 30 23:47:58 2008
New Revision: 11019

Log:
send the call's uniqueid, if any, as the first element of the event's parameter list.
unlock the session returned by core_session_locate like I should've been doing.


Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	Tue Dec 30 23:47:58 2008
@@ -271,6 +271,8 @@
 static void ei_encode_switch_event_headers(ei_x_buff *ebuf, switch_event_t *event)
 {
 	int i;
+	char *uuid = switch_event_get_header(event, "unique-id");
+
 	switch_event_header_t *hp;
 
 	for (i = 0, hp = event->headers; hp; hp = hp->next, i++);
@@ -278,7 +280,13 @@
 	if (event->body)
 		i++;
 
-	ei_x_encode_list_header(ebuf, i);
+	ei_x_encode_list_header(ebuf, i+1);
+
+	if (uuid) {
+		ei_x_encode_string(ebuf, switch_event_get_header(event, "unique-id"));
+	} else {
+		ei_x_encode_atom(ebuf, "undefined");
+	}
 
 	for (hp = event->headers; hp; hp = hp->next) {
 		ei_x_encode_tuple_header(ebuf, 2);
@@ -983,7 +991,9 @@
 					ei_x_encode_atom(rbuf, "error");
 					ei_x_encode_atom(rbuf, "badmem");
 				}
-				/* switch_core_session_rwunlock(session); */ /* XXX is this needed? */
+
+				/* release the lock returned by switch_core_locate_session */
+				switch_core_session_rwunlock(session);
 				break;
 
 sendmsg_fail:



More information about the Freeswitch-svn mailing list