Revision
16564
Author
anthm
Date
2010-02-03 13:40:24 -0600 (Wed, 03 Feb 2010)

Log Message

fire presence_out when reg is flushed manually

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c (16563 => 16564)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	2010-02-03 19:19:10 UTC (rev 16563)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	2010-02-03 19:40:24 UTC (rev 16564)
@@ -511,6 +511,25 @@
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", argv[7]);
 			switch_event_fire(&s_event);
 		}
+
+		if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "away");
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->url);
+
+			if (argv[4]) {
+				switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", argv[4]);
+			}
+
+			if (argv[1] && argv[2]) {
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", argv[1], argv[2]);
+			}
+
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Unregistered");
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+			switch_event_fire(&s_event);
+		}
+
 	}
 	return 0;
 }
@@ -1190,7 +1209,7 @@
 
 
 	} else {
-
+		
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);