app_addon_sql_mysql.c: identifier_type 2 not found

I’m getting some warning lately ,I 've never seen them till i upgraded my asterisk from 1.4.30 to 1.4.39 ,and my dialplan is not working perfectly,and strangely ,for example the dial plan reject some phone numbers , especially when i have simultaneous calls.

[Dec 1 13:48:15] WARNING[14017] app_addon_sql_mysql.c: Identifier 0, 
identifier_type 2 not found in identifier list
[Dec 1 13:48:15] WARNING[14017] app_addon_sql_mysql.c: Invalid result 
identifier 0 passed in aMYSQL_clear
exten = _X.,1,Gosub(open-db-conn,111,1)
exten = _X.,n,MYSQL(Query resultid ${MYSQLCONN} ${QUERYSTRING})
exten = _X.,n,MYSQL(Fetch fetchid ${resultid} ${RETURNVARS})
exten = _X.,n,SET(RETURNCODE=${IF($["${fetchid}" = "0"]?-1:0)})
exten = _X.,n,MYSQL(Clear ${resultid})
exten = _X.,n,Return

any ideas ??

The only thing that comes to mind is that use of the ODBC function is preferred to the MySQL function. Does the same problem occur if you connect to your database using the ODBC connector instead of the MySQL native connector?

Same thing happening to me

-- Executing [222@proba:6] MYSQL("SIP/222-00000000", "Clear ") in new stack [Aug 1 13:56:03] WARNING[8323]: app_mysql.c:194 find_identifier: Identifier 0, identifier_type 2 not found in identifier list [Aug 1 13:56:03] WARNING[8323]: app_mysql.c:510 aMYSQL_clear: Invalid result identifier 0 passed in aMYSQL_clear

FYI… if anyone interested stumbles upon this.
There is a mistake in the code of the app_addon_sql_mysql.c
It seems when the code was updated for the new module formats, the clear function was not changed. Just replace the aMYSQL_clear function code of the .c file and recompile with ‘make apps’.

static int aMYSQL_clear(struct ast_channel *chan, char *data) {

	MYSQL_RES *mysqlres;
	char *parse;
	int resultid = -1;

	parse = ast_strdupa(data);
	AST_NONSTANDARD_APP_ARGS(args, parse, ' ');
	sscanf(args.fetchid, "%d", &resultid);

	if ( (resultid >= 0 ) && (mysqlres = find_identifier(resultid, AST_MYSQL_ID_RESID)) != NULL) {
		del_identifier(resultid, AST_MYSQL_ID_RESID);
	} else {
		ast_log(LOG_WARNING,"Invalid result identifier %d passed in aMYSQL_clear\n", resultid);

	return 0;

Enjoy! :smile:
-Cheers, Peter.

If you have found a bug that is still present in current code, you need to report it on after agreeing to the contributor agreement. Contributions without the contributor agreement, from the original author, will be ignored for the official version.

Patches need to be in unified diff version against a supported version or the trunk.