In my extensions.conf I put those lines
same => n,set(CDR(nome)=${ODBC_Phonebook(${CALLERID(num)})})
same => n,set(CDR(nome)=${ODBC_Listanera_2(${CALLERID(num)})})
which recall those functions in func_odbc.conf
[Phonebook]
dsn=asterisk
readsql=Select CDRname from phonebook where CallerID='${ARG1}'
[Listanera]
dsn=asterisk
readsql=SELECT COUNT(*) FROM listanera WHERE callerid='${SQL_ESC(${ARG1})}'
synopsis=Controllo scocciatori
[Listanera_2]
dsn=asterisk
readsql=Select Nome from listanera where CallerID='${ARG1}'
Don’t works because the first overwrite the second (if invert happen the same thing, If I remove a name from a list appear a NULL value)
My idea is this
the caller is in blacklist, and in the cdr custom field “nome” appear his name, if is not in blacklist appear his name too (but is not kicked out of course!).
Any suggestion?