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

Freeswitch SVN anthm at freeswitch.org
Wed Nov 28 20:27:48 EST 2007


Author: anthm
Date: Wed Nov 28 20:27:48 2007
New Revision: 6427

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

Log:
basic framework for built-in web stuff on voicemail

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	Wed Nov 28 20:27:48 2007
@@ -1128,7 +1128,10 @@
                     int total_saved_urgent_messages = 0;
                     int32_t message_len = 0;
                     char *p;
-
+                    long l_duration = 0;
+                    switch_core_time_duration_t duration;
+                    char duration_str[80];
+                    
                     if (!strcasecmp(cbt->read_flags, URGENT_FLAG_STRING)) {
                         priority = 1;
                     }
@@ -1159,7 +1162,19 @@
                     snprintf(tmp,sizeof(tmp), "%d", priority);
                     switch_channel_set_variable(channel, "voicemail_priority", tmp);
                     message_len = atoi(cbt->message_len);
-                    switch_channel_set_variable(channel, "voicemail_message_len", cbt->message_len);
+
+                    l_duration = atol(cbt->message_len) * 1000000;
+                    switch_core_measure_time(l_duration, &duration);
+                    duration.day += duration.yr * 365;
+                    duration.hr += duration.day * 24;
+                    
+                    snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
+                             duration.hr,
+                             duration.min,
+                             duration.sec
+                             );
+
+                    switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
                     switch_channel_set_variable(channel, "voicemail_email", cbt->email);
                     
                     if(switch_strlen_zero(profile->email_headers)) {
@@ -1922,7 +1937,10 @@
         int total_new_urgent_messages = 0;
         int total_saved_urgent_messages = 0;
         char *p;
-        
+        long l_duration = 0;
+        switch_core_time_duration_t duration;
+        char duration_str[80];
+
         message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
                       &total_new_urgent_messages, &total_saved_urgent_messages);
 
@@ -1949,8 +1967,21 @@
         switch_channel_set_variable(channel, "voicemail_priority", tmp);
         switch_channel_set_variable(channel, "voicemail_email", email_vm);
 
-        snprintf(tmp,sizeof(tmp), "%"SWITCH_SIZE_T_FMT, message_len);
-        switch_channel_set_variable(channel, "voicemail_message_len", tmp);
+
+        
+        l_duration = (long)message_len * 1000000;
+        switch_core_measure_time(l_duration, &duration);
+        duration.day += duration.yr * 365;
+        duration.hr += duration.day * 24;
+        snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+                 duration.hr,
+                 duration.min,
+                 duration.sec
+                 );
+        
+
+        
+        switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
 
         if (switch_strlen_zero(profile->email_from)) {
             from = switch_core_session_sprintf(session, "%s@%s", id, domain_name);
@@ -2378,8 +2409,8 @@
                                    "type=\"application/x-shockwave-flash\" \n"
                                    "data=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\">\n"
                                    "<param name=movie value=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\"></object><br><br>\n"
-                                   "[<a href=%s>delete</a>] [<a href=%s>download</a>] <br><br><br></font>\n",
-                                   holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get);
+                                   "[<a href=%s>delete</a>] [<a href=%s>download</a>] [<a href=tel:%s>call</a>] <br><br><br></font>\n",
+                                   holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get, argv[6]);
 
     free(get);
     free(del);



More information about the Freeswitch-svn mailing list