In my extensions.conf I do the following :
; Lock MySQL/MariaDB access.
same = n,While($[${L} <= 0])
same = n,Set(L=${LOCK(MySQL)})
same = n,EndWhile()
; Mark start of a call attempt.
same = n,Set(history_h1(${nIServer},${IProject},${ANI})=)
; Get unique call id
same = n,Set(CallId=${history_h2()})
; Unlock MySQL acces as the correct CallId was found.
same = n,Set(L=${UNLOCK(MySQL)})
In my func_odbc.conf I do the following :
[h1]
prefix=history
dsn=asterisk
writesql=INSERT INTO callsystem.history SET IServer=${ARG1},IProject=’${ARG2}’,CallerId=’${ARG3}’,Status=‘ONLINE’;
[h2]
prefix=history
dsn=asterisk
readsql=SELECT LAST_INSERT_ID() FROM callsystem.history LIMIT 1;
I also tried readsql=SELECT LAST_INSERT_ID(); to no avail.
With Asterisk 13.7.0 this works like a charm.
With Asterisk 13.8.0 CallId is always 0.
Is this a bug or do I need to set something specific in one of the configuration files for 13.8.0 ?