]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_voicemail: Fix data-type mismatch between app_voicemail and database
authorNic Colledge <nic@njcolledge.net>
Tue, 27 Mar 2018 23:53:07 +0000 (00:53 +0100)
committerNic Colledge <nic@njcolledge.net>
Sat, 12 May 2018 10:22:23 +0000 (11:22 +0100)
Fix data-type mismatch between app_voicemail and database columns
exposed by new version of MariaDB

ASTERISK-27760

Change-Id: I8543ad480a08c98be78bde1ee870e6e6c84b2c5b

apps/app_voicemail.c

index 86f2873a5c21405fd1c4769fe8b6e14825387f6f..f5d4b6518dd103131bc148512de9f0e24f2e3801 100644 (file)
@@ -4412,6 +4412,14 @@ static int store_file(const char *dir, const char *mailboxuser, const char *mail
                else
                        snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,flag,msg_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
 
+               if (ast_strlen_zero(idata.origtime)) {
+                       idata.origtime = "0";
+               }
+
+               if (ast_strlen_zero(idata.duration)) {
+                       idata.duration = "0";
+               }
+
                if ((stmt = ast_odbc_direct_execute(obj, insert_data_cb, &idata))) {
                        SQLFreeHandle(SQL_HANDLE_STMT, stmt);
                } else {