Hello everyone. So, we have been using a script for CID Lookup and it has worked for years, but we have problems with the latest Sangoma iso.
This is the code which is included inside extensions_override:
[cidlookup]
include => cidlookup-custom
exten => cidlookup_1,1,MYSQL(Connect connid localhost *dbuser dbpass dbname*)
exten => cidlookup_1,n,Set(miocid=${CALLERID(num)})
exten => cidlookup_1,n,Set(miocid=${IF($[${ISNULL(${miocid})}]?"":${miocid})})
exten => cidlookup_1,n,MYSQL(Query resultid ${connid} SELECT name FROM personalpbook WHERE cell LIKE '${miocid}' OR tel LIKE '${miocid}' OR tel2 LIKE '${miocid}' OR tel3 LIKE '${miocid}' OR cell2 LIKE '${miocid}' OR cell3 LIKE '${miocid}')
exten => cidlookup_1,n,MYSQL(Fetch fetchid ${resultid} CALLERID(name))
exten => cidlookup_1,n,Noop(Nome chiamante: ${CALLERID(name)})
exten => cidlookup_1,n,MYSQL(Clear ${resultid})
exten => cidlookup_1,n,MYSQL(Disconnect ${connid})
exten => cidlookup_1,n,Return()
exten => cidlookup_return,1,ExecIf($["${DB(cidname/${CALLERID(num)})}" != ""]?Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})}))
exten => cidlookup_return,n,Return()
There’s a variation we use in case of a pre-selection digit.
Anyway, lately we always get these errors when the script executes:
-- Executing [cidlookup_1@cidlookup:1] MYSQL("SIP/REDACTED-0000002c", "Connect connid localhost *dbuser dbpass dbname*") in new stack
[2024-08-29 12:31:30] WARNING[22463][C-00000015]: app_mysql.c:383 aMYSQL_connect: mysql_real_connect(mysql,localhost,*dbuser,dbpass,dbname*,...) failed(1045): Access denied for user 'dbuser'@'localhost' (using password: YES)
-- Executing [cidlookup_1@cidlookup:2] Set("SIP/REDACTED-0000002c", "miocid=REDACTED") in new stack
-- Executing [cidlookup_1@cidlookup:3] Set("SIP/REDACTED-0000002c", "miocid=REDACTED") in new stack
-- Executing [cidlookup_1@cidlookup:4] MYSQL("SIP/REDACTED-0000002c", "Query resultid SELECT name FROM personalpbook WHERE cell LIKE 'REDACTED' OR tel LIKE 'REDACTED' OR tel2 LIKE 'REDACTED' OR tel3 LIKE 'REDACTED' OR cell2 LIKE 'REDACTED' OR cell3 LIKE 'REDACTED'") in new stack
[2024-08-29 12:31:30] WARNING[22463][C-00000015]: app_mysql.c:409 aMYSQL_query: missing some arguments
-- Executing [cidlookup_1@cidlookup:5] MYSQL("SIP/REDACTED-0000002c", "Fetch fetchid CALLERID(name)") in new stack
[2024-08-29 12:31:30] WARNING[22463][C-00000015]: app_mysql.c:521 aMYSQL_fetch: aMYSQL_fetch: missing some arguments
I think the authentication error is the cause of all the following errors.
But user and password are correct, I checked and I can connect with no problems to that db with said user and password.
So I was wondering if there’s another mistake, maybe the connect command has changed in recent versions of Asterisk?
Does anybody have ideas? Thanks.