[Freeswitch-svn] [commit] r11291 - freeswitch/trunk/src/mod/applications/mod_voicemail

FreeSWITCH SVN brian at freeswitch.org
Mon Jan 19 12:58:01 PST 2009


Author: brian
Date: Mon Jan 19 14:58:01 2009
New Revision: 11291

Log:
fix MODAPP-198 Seems pgsql doesn't return things in the expected order but this will fix that just in case

Modified:
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Mon Jan 19 14:58:01 2009
@@ -1739,8 +1739,8 @@
 				case MSG_NEW:
 					{
 						switch_snprintf(sql, sizeof(sql),
-										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0 order by read_flags", myid,
-										domain_name);
+										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0"
+										" order by read_flags, created_epoch", myid, domain_name);
 						total_messages = total_new_messages;
 						heard_auto_new = heard_auto_saved = 1;
 					}
@@ -1749,8 +1749,8 @@
 				default:
 					{
 						switch_snprintf(sql, sizeof(sql),
-										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid,
-										domain_name);
+										"select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0"
+										" order by read_flags, created_epoch", myid, domain_name);
 						total_messages = total_saved_messages;
 						heard_auto_new = heard_auto_saved = 1;
 					}
@@ -3276,7 +3276,8 @@
 	vm_execute_sql(profile, sql, profile->mutex);
 	free(sql);
 
-	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s'", user, domain, file);
+	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s' order by created_epoch",
+						 user, domain, file);
 	memset(&holder, 0, sizeof(holder));
 	holder.profile = profile;
 	holder.stream = stream;
@@ -3298,7 +3299,8 @@
 		ref = switch_event_get_header(stream->param_event, "http-referer");
 	}
 
-	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s'", user, domain, file);
+	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s' order by created_epoch",
+						 user, domain, file);
 	memset(&holder, 0, sizeof(holder));
 	holder.profile = profile;
 	holder.stream = stream;
@@ -3562,7 +3564,7 @@
 	x_tmp = switch_xml_add_child_d(holder.x_channel, "ttl", 0);
 	switch_xml_set_txt_d(x_tmp, "15");
 
-	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' order by read_flags", user, domain);
+	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' order by read_flags, created_epoch", user, domain);
 	vm_execute_sql_callback(profile, profile->mutex, sql, rss_callback, &holder);
 
 	xmlstr = switch_xml_toxml(holder.xml, SWITCH_TRUE);
@@ -3601,7 +3603,7 @@
 	cbt.buf = buf;
 	cbt.len = sizeof(buf);
 
-	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' order by read_flags", user, domain);
+	sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' order by read_flags, created_epoch", user, domain);
 	vm_execute_sql_callback(profile, profile->mutex, sql, web_callback, &holder);
 	switch_safe_free(sql);
 



More information about the Freeswitch-svn mailing list