SetGlobalVar and Threads

Hi all,

I want to have a global count when the users select record (i.e: each user will leave a message in the form: question-ID.wav), I use the following:
exten => 1,1,SetGlobalVar(questionID=$[${questionID} + 1])
exten => 1,2,record(/var/lib/asterisk/questions/quest-${questionID}:wav)

It seems to works with 1 user. But I wonder whether it is thread safe. What happen when 2 users calling at the same time? They would get the same questionID and it is bad.

Thanks in advance for any suggestion,


Not 100% sure, and a difficult one to test. You may go to the Asterisk channel on to find out. The sure solution would be to use an external database, such as MySQL, to provide a store of your questionID.