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

Freeswitch SVN anthm at freeswitch.org
Fri Oct 12 20:22:13 EDT 2007


Author: anthm
Date: Fri Oct 12 20:22:13 2007
New Revision: 5867

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

Log:
sort by urgent

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	Fri Oct 12 20:22:13 2007
@@ -598,7 +598,8 @@
 #define VM_HELLO_MACRO "voicemail_hello"
 #define VM_GOODBYE_MACRO "voicemail_goodbye"
 #define VM_MESSAGE_COUNT_MACRO "voicemail_message_count"
-
+#define URGENT_FLAG_STRING "A_URGENT"
+#define NORMAL_FLAG_STRING "B_NORMAL"
 
 
 static switch_status_t vm_macro_get(switch_core_session_t *session,
@@ -880,7 +881,7 @@
                     char *body;
                     int priority = 3;
                     
-                    if (!strcasecmp(cbt->read_flags, "urgent")) {
+                    if (!strcasecmp(cbt->read_flags, URGENT_FLAG_STRING)) {
                         priority = 1;
                     }
                     headers = switch_core_session_sprintf(session, 
@@ -938,10 +939,11 @@
     *total_new_messages = atoi(msg_count);
 
     snprintf(sql, sizeof(sql), 
-             "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='urgent'", 
+             "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'", 
              myid,
              domain_name,
-             myfolder);
+             myfolder, 
+             URGENT_FLAG_STRING);
     vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
     *total_new_urgent_messages = atoi(msg_count);
 
@@ -955,10 +957,11 @@
 
 
     snprintf(sql, sizeof(sql), 
-             "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='urgent'", 
+             "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'", 
              myid,
              domain_name,
-             myfolder);
+             myfolder,
+             URGENT_FLAG_STRING);
     vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
     *total_saved_urgent_messages = atoi(msg_count);
 
@@ -1090,7 +1093,7 @@
                 case MSG_NEW:
                     {
                         snprintf(sql, sizeof(sql),
-                                 "select * from voicemail_data where user='%s' and domain='%s' and read_epoch=0", myid, domain_name);
+                                 "select * from voicemail_data where user='%s' and domain='%s' and read_epoch=0 order by read_flags", myid, domain_name);
                         total_messages = total_new_messages;
                         heard_auto_new = heard_auto_saved = 1;
                     }
@@ -1099,7 +1102,7 @@
                 default:
                     {
                         snprintf(sql, sizeof(sql),
-                                 "select * from voicemail_data where user='%s' and domain='%s' and read_epoch!=0", myid, domain_name);
+                                 "select * from voicemail_data where user='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid, domain_name);
                         total_messages = total_saved_messages;
                         heard_auto_new = heard_auto_saved = 1;                        
                     }
@@ -1407,7 +1410,7 @@
     char *email_vm = NULL;
     int send_mail = 0;
     cc_t cc = { 0 };
-    char *read_flags = "";
+    char *read_flags = NORMAL_FLAG_STRING;
     int priority = 3;
 
     memset(&cbt, 0, sizeof(cbt));
@@ -1504,7 +1507,7 @@
 
             vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, profile->terminator_key, &term, profile->digit_timeout);
             if (*profile->urgent_key == *input) {
-                read_flags = "urgent";
+                read_flags = URGENT_FLAG_STRING;
                 priority = 1;
             }
         }



More information about the Freeswitch-svn mailing list