[Freeswitch-svn] [commit] r3187 - in freeswitch/branches/ptinsley/voicemail: . libs/libdingaling libs/libdingaling/src src/mod/applications/mod_voicemail src/mod/endpoints/mod_dingaling

Freeswitch SVN ptinsley at freeswitch.org
Tue Oct 24 18:28:10 EDT 2006


Author: ptinsley
Date: Tue Oct 24 18:28:08 2006
New Revision: 3187

Modified:
   freeswitch/branches/ptinsley/voicemail/   (props changed)
   freeswitch/branches/ptinsley/voicemail/libs/libdingaling/.update
   freeswitch/branches/ptinsley/voicemail/libs/libdingaling/src/libdingaling.c
   freeswitch/branches/ptinsley/voicemail/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/branches/ptinsley/voicemail/src/mod/endpoints/mod_dingaling/mod_dingaling.c

Log:
Commit so I can catch up with trunk



Modified: freeswitch/branches/ptinsley/voicemail/libs/libdingaling/.update
==============================================================================
--- freeswitch/branches/ptinsley/voicemail/libs/libdingaling/.update	(original)
+++ freeswitch/branches/ptinsley/voicemail/libs/libdingaling/.update	Tue Oct 24 18:28:08 2006
@@ -1 +1 @@
-Fri Oct 20 19:58:38 CDT 2006
+Tue Oct 24 13:51:01 CDT 2006

Modified: freeswitch/branches/ptinsley/voicemail/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/branches/ptinsley/voicemail/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/branches/ptinsley/voicemail/libs/libdingaling/src/libdingaling.c	Tue Oct 24 18:28:08 2006
@@ -796,7 +796,7 @@
 	char *to = iks_find_attrib(pak->x, "to");
 
 	if (handle->session_callback) {
-		handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL);
+		handle->session_callback(handle, NULL, LDL_SIGNAL_UNSUBSCRIBE, to, from, NULL, NULL);
 	}
 
 	return IKS_FILTER_EAT;

Modified: freeswitch/branches/ptinsley/voicemail/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/ptinsley/voicemail/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/branches/ptinsley/voicemail/src/mod/applications/mod_voicemail/mod_voicemail.c	Tue Oct 24 18:28:08 2006
@@ -93,7 +93,7 @@
 	//see if we already have a mailbox
 	if(!strlen(vm_user->mailbox)) {
 		//try to get the mailbox # from the user
-		switch_play_and_get_digits(vm_user->session, 3, 3, 3, 7000, "#", "/usr/local/freeswitch/voicemail/prompts/en-us/mailbox.gsm", "NULL", input, sizeof(input), "^13[68]$");
+		switch_play_and_get_digits(vm_user->session, 3, 3, 3, 7000, "#", "/usr/local/freeswitch/voicemail/prompts/en-us/mailbox.wav", "NULL", input, sizeof(input), "^13[68]$");
 
 		//see if we got a mailbox back
 		if(!strlen(input)) {
@@ -108,7 +108,7 @@
 	//See if we need the password
 	if(!vm_user->nopass) {
 		//try and get the password
-		switch_play_and_get_digits(vm_user->session, 1, 10, 3, 7000, "#", "/usr/local/freeswitch/voicemail/prompts/en-us/password.gsm", "NULL", input, sizeof(input), NULL);
+		switch_play_and_get_digits(vm_user->session, 1, 10, 3, 7000, "#", "/usr/local/freeswitch/voicemail/prompts/en-us/password.wav", "NULL", input, sizeof(input), NULL);
 
 		//see if we got the password
 		if(!strlen(input)) {
@@ -259,12 +259,14 @@
 
 		if(vm_user->isvalid) {
 			break;
+		} else {
+			memset(vm_user->mailbox, 0, sizeof(vm_user->mailbox));
 		}
 	}
 
 	if(!vm_user->isvalid) {
 		// say goodbye
-		switch_ivr_play_file(session, NULL, "/usr/local/freeswitch/voicemail/prompts/en-us/goodbye.gsm", NULL, NULL, NULL, 0);
+		switch_ivr_play_file(session, NULL, "/usr/local/freeswitch/voicemail/prompts/en-us/goodbye.wav", NULL, NULL, NULL, 0);
 		return;
 	}
 
@@ -275,7 +277,7 @@
 	status = _main_menu(vm_user);
 
 	//If we get here we should be done
-	switch_ivr_play_file(session, NULL, "/usr/local/freeswitch/voicemail/prompts/en-us/goodbye.gsm", NULL, NULL, NULL, 0);
+	switch_ivr_play_file(session, NULL, "/usr/local/freeswitch/voicemail/prompts/en-us/goodbye.wav", NULL, NULL, NULL, 0);
 	return;
 }
 

Modified: freeswitch/branches/ptinsley/voicemail/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/ptinsley/voicemail/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/ptinsley/voicemail/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue Oct 24 18:28:08 2006
@@ -141,6 +141,8 @@
 	char local_user[17];
 	char local_pass[17];
 	char *remote_user;
+	char *us;
+	char *them;
 	unsigned int cand_id;
 	unsigned int desc_id;
 	unsigned int dc;
@@ -184,10 +186,13 @@
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
 										   switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
+
 static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t signal, char *to, char *from, char *subject, char *msg);
 static ldl_status handle_response(ldl_handle_t *handle, char *id);
 static switch_status_t load_config(void);
 
+#define is_special(s) (strstr(s, "ext+") || strstr(s, "user+") || strstr(s, "conf+"))
+
 static char *translate_rpid(char *in, char *ext)
 {
 	char *r = NULL;
@@ -474,7 +479,7 @@
 	//char *sub_from = argv[0];
 	char *sub_to = argv[1];
 	
-	if (strstr(sub_to, "ext+") || strstr(sub_to, "user+") || strstr(sub_to, "conf+")) {
+	if (is_special(sub_to)) {
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
@@ -568,15 +573,6 @@
 			return;
 		}
 
-		if (tech_pvt->dlsession) {
-			if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
-				ldl_session_terminate(tech_pvt->dlsession);
-			}
-			ldl_session_destroy(&tech_pvt->dlsession);
-		}
-
-		switch_set_flag_locked(tech_pvt, TFLAG_TERM);
-	
 		if (state < CS_HANGUP) {
 			switch_channel_hangup(channel, cause);
 		}
@@ -1044,7 +1040,7 @@
 {
 	switch_channel_t *channel = NULL;
 	struct private_object *tech_pvt = NULL;
-
+	
 	channel = switch_core_session_get_channel(session);
 	assert(channel != NULL);
 
@@ -1054,7 +1050,15 @@
 	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
 	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
 	switch_set_flag_locked(tech_pvt, TFLAG_BYE);
-	
+
+	/* Dunno why, but if googletalk calls us for the first time, as soon as the call ends
+	 they think we are offline for no reason so we send this presence packet to stop it from happening
+	 We should find out why.....
+	*/
+	if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) {	
+		ldl_handle_send_presence(tech_pvt->profile->handle,
+								 tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call");
+	}
 	if (tech_pvt->dlsession) {
 		if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
 			ldl_session_terminate(tech_pvt->dlsession);
@@ -1540,7 +1544,8 @@
 		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 		
 		switch_stun_random_string(sess_id, 10, "0123456789");
-
+		tech_pvt->us = switch_core_session_strdup(session, user);
+		tech_pvt->them = switch_core_session_strdup(session, full_id);
 		ldl_session_create(&dlsession, mdl_profile->handle, sess_id, full_id, user);
 		tech_pvt->profile = mdl_profile;
 		ldl_session_set_private(dlsession, *new_session);
@@ -2073,11 +2078,12 @@
 
 			case LDL_SIGNAL_SUBSCRIBE:
 				
-				if ((sql = switch_mprintf("insert into subscriptions values('%q','%q','%q','%q')", from, to, msg, subject))) {
+				if ((sql = switch_mprintf("delete from subscriptions where sub_from='%q' and sub_to='%q';\n"
+										  "insert into subscriptions values('%q','%q','%q','%q');\n", from, to, from, to, msg, subject))) {
 					execute_sql(profile->dbname, sql, profile->mutex);
 					switch_core_db_free(sql);
 				}
-				if (strstr(to, "ext+") || strstr(to, "user+") || strstr(to, "conf+") ) {
+				if (is_special(to)) {
 					if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
@@ -2111,7 +2117,7 @@
 					switch_event_fire(&event);
 				}
 
-				if (strstr(to, "ext+") || strstr(to, "user+") || strstr(to, "conf+")) {
+				if (is_special(to)) {
 					if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
 						switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", profile->login);
@@ -2486,6 +2492,9 @@
 							context = profile->name;
 						}
 			
+						tech_pvt->them = switch_core_session_strdup(session, ldl_session_get_callee(dlsession));
+						tech_pvt->us = switch_core_session_strdup(session, ldl_session_get_caller(dlsession));
+						
 						if (!tech_pvt->caller_profile) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating an identity for %s %s <%s> %s\n", 
 											  ldl_session_get_id(dlsession), cid_name, cid_num, exten);



More information about the Freeswitch-svn mailing list