[asterisk-users] Asterisk 1.4.4 VoiceMail ODBC Storage Help

Remco Post remco at pipsworld.nl
Wed May 2 12:44:33 MST 2007


Bruce McAlister wrote:
> Hi Remco Post,
> 

Having read your patch I suggest you report this bug at bugs.digium.com,
it seems to be legit...

> However, I think I may have got to the bottom of the issue now.
> 
> What look like was happening is that asterisk was trying to delete any
> matching row prior to an insert operation. So, when a user left a message,
> for example, message 1, asterisk would attempt to delete message 1 before
> inserting it for that user. However, message 1 does not exist at that time
> and thus the ODBC driver returns "SQL_NO DATA". 
> 
> The same happens when a user checks their voicemail, once an message has
> been listened to asterisk moves it to the "Old" directory, that way it can
> distinguish between new/old messages. When a user listens to the voicemail,
> asterisk then tries to insert the message into the "Old" tree, prior to
> doing the insert, asterisk tries to delete the last available message
> returned from a select count(*) operation. This message does not exist and
> the odbc driver returns "SQL_NO_DATA".
> 
> The delete_file function in app_voicemail.c does not accommodate for this
> return code SQL_NO_DATA and thus spits out the warning on the console.
> 
> I thus changed the following condition in function delete_file in
> app_voicemail.c from:
> 
> if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
> 	ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
>       SQLFreeHandle (SQL_HANDLE_STMT, stmt);
>       ast_odbc_release_obj(obj);
>       goto yuck;
> }
> 
> To:
> 
> if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res !=
> SQL_NO_DATA)) {
>       ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
>       SQLFreeHandle (SQL_HANDLE_STMT, stmt);
>       ast_odbc_release_obj(obj);
>       goto yuck;
> }
> 
> This seems to have fixed the problem.


-- 

Remco Post

"I didn't write all this code, and I can't even pretend that all of it
makes sense." -- Glen Hattrup


More information about the asterisk-users mailing list