Revision
15193
Author
anthm
Date
2009-10-22 09:54:29 -0500 (Thu, 22 Oct 2009)

Log Message

add SWITCH_MESSAGE_INDICATE_UUID_CHANGE to warn a session when the uuid has changed

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/switch_types.h (15192 => 15193)


--- freeswitch/trunk/src/include/switch_types.h	2009-10-22 14:15:07 UTC (rev 15192)
+++ freeswitch/trunk/src/include/switch_types.h	2009-10-22 14:54:29 UTC (rev 15193)
@@ -660,6 +660,7 @@
 	SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY,
 	SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
 	SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA,
+	SWITCH_MESSAGE_INDICATE_UUID_CHANGE,
 	SWITCH_MESSAGE_INVALID
 } switch_core_session_message_types_t;
 

Modified: freeswitch/trunk/src/switch_core_session.c (15192 => 15193)


--- freeswitch/trunk/src/switch_core_session.c	2009-10-22 14:15:07 UTC (rev 15192)
+++ freeswitch/trunk/src/switch_core_session.c	2009-10-22 14:54:29 UTC (rev 15193)
@@ -1192,6 +1192,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session_t *session, const char *use_uuid)
 {
 	switch_event_t *event;
+	switch_core_session_message_t msg = { 0 };
 
 	switch_assert(use_uuid);
 
@@ -1202,6 +1203,12 @@
         return SWITCH_STATUS_FALSE;
 	}
 
+	msg.message_id = SWITCH_MESSAGE_INDICATE_UUID_CHANGE;
+	msg.from = switch_channel_get_name(session->channel);
+	msg.string_array_arg[0] = session->uuid_str;
+	msg.string_array_arg[1] = use_uuid;
+	switch_core_session_receive_message(session, &msg);
+
 	switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID);
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str);
 	switch_core_hash_delete(session_manager.session_table, session->uuid_str);