Revision
16453
Author
gmaruzz
Date
2010-01-21 21:16:06 -0600 (Thu, 21 Jan 2010)

Log Message

gsmopen: fixed CUSTOM gsmopen::dump_event EVENT during active session

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (16452 => 16453)


--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2010-01-22 02:59:01 UTC (rev 16452)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2010-01-22 03:16:06 UTC (rev 16453)
@@ -2938,15 +2938,10 @@
 int dump_event(private_t * tech_pvt)
 {
 	switch_event_t *event;
-	switch_core_session_t *session = NULL;
-	int event_sent_to_esl = 0;
 	char value[512];
 
-	DEBUGA_GSMOPEN("STATUS of interface %s: \n", GSMOPEN_P_LOG, tech_pvt->name );
+	DEBUGA_GSMOPEN("DUMP of interface %s: \n", GSMOPEN_P_LOG, tech_pvt->name );
 
-	if (!zstr(tech_pvt->session_uuid_str)) {
-		session = switch_core_session_locate(tech_pvt->session_uuid_str);
-	}
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_DUMP) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_name", tech_pvt->name);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_id", tech_pvt->id);
@@ -3009,100 +3004,16 @@
 		snprintf(value, sizeof(value)-1, "%d", tech_pvt->phone_callflow);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "phone_callflow", value);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "session_uuid_str", tech_pvt->session_uuid_str);
-		if (session) {
+		if (strlen(tech_pvt->session_uuid_str)) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true");
-			if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) {
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
-				switch_event_fire(&event);
-			}
 		} else {				//no session
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "false");
-			switch_event_fire(&event);
-			event_sent_to_esl = 1;
 		}
-
+		switch_event_fire(&event);
 	} else {
 		ERRORA("cannot create event on interface %s. WHY?????\n", GSMOPEN_P_LOG, tech_pvt->name);
 	}
 
-	if (!event_sent_to_esl) {
-
-		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_name", tech_pvt->name);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_id", tech_pvt->id);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->active);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "active", value);
-			if(!tech_pvt->network_creg_not_supported){
-				snprintf(value, sizeof(value)-1, "%d", tech_pvt->not_registered);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "not_registered", value);
-				snprintf(value, sizeof(value)-1, "%d", tech_pvt->home_network_registered);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "home_network_registered", value);
-				snprintf(value, sizeof(value)-1, "%d", tech_pvt->roaming_registered);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "roaming_registered", value);
-			}else{
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "not_registered", "N/A");
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "home_network_registered", "N/A");
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "roaming_registered", "N/A");
-			}
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->got_signal);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "got_signal", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->running);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "running", value);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imei", tech_pvt->imei);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "imsi", tech_pvt->imsi);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->controldev_dead);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "controldev_dead", value);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "controldevice_name", tech_pvt->controldevice_name);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->no_sound);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "no_sound", value);
-#ifdef GSMOPEN_ALSA
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alsacname", tech_pvt->alsacname);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alsapname", tech_pvt->alsapname);
-#endif// GSMOPEN_ALSA
-#ifdef GSMOPEN_PORTAUDIO
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->portaudiocindex);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "portaudiocindex", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->portaudiopindex);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "portaudiopindex", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->speexecho);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "speexecho", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->speexpreprocess);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "speexpreprocess", value);
-#endif// GSMOPEN_PORTAUDIO
-			snprintf(value, sizeof(value)-1, "%f", tech_pvt->playback_boost);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "playback_boost", value);
-			snprintf(value, sizeof(value)-1, "%f", tech_pvt->capture_boost);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "capture_boost", value);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialplan", tech_pvt->dialplan);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "context", tech_pvt->context);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "destination", tech_pvt->destination);
-			snprintf(value, sizeof(value)-1, "%lu", tech_pvt->ib_calls);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ib_calls", value);
-			snprintf(value, sizeof(value)-1, "%lu", tech_pvt->ob_calls);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ob_calls", value);
-			snprintf(value, sizeof(value)-1, "%lu", tech_pvt->ib_failed_calls);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ib_failed_calls", value);
-			snprintf(value, sizeof(value)-1, "%lu", tech_pvt->ob_failed_calls);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ob_failed_calls", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->interface_state);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "interface_state", value);
-			snprintf(value, sizeof(value)-1, "%d", tech_pvt->phone_callflow);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "phone_callflow", value);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "session_uuid_str", tech_pvt->session_uuid_str);
-			if (session) {
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true");
-			} else {			//no session
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "false");
-			}
-			switch_event_fire(&event);
-		} else {
-			ERRORA("cannot create event on interface %s. WHY?????\n", GSMOPEN_P_LOG, tech_pvt->name);
-		}
-	}
-
-	if (session) {
-		switch_core_session_rwunlock(session);
-	}
 	return 0;
 }