Asterisk call file variables

On Asterisk Wiki i’ve read : "
Asterisk keep track of how many retries the call has already attempted, appending to the call file the following key-pairs in the form:
StartRetry: ()
EndRetry: ()

With the main process ID (pid) of the Asterisk process, the retry number, and the attempts start and end times in time_t format. "

i wish i could put retrycount on a variable…
is there a way to do so?

I’ve used a workaround putting this on call files asterisk’s exten and failed exten

exten => failed,n,MYSQL(Connect connid localhost root password Dialer)
exten => failed,n,MYSQL(QUERY resultid ${connid} UPDATE tracciato SET attemp = attemp +1 WHERE codice like ${destination})