Help on variable

Hi, Can someone kindly help me or give me some hint on the following problem:

I am trying to send out voicemail email with the email body containing a variable that is set during the call.

lets say in one of the extension, I do

exten => 2,1,Set(Press=2)

Then in voicemail.conf I have


Which intends to tell me what digit the caller press. However the variable “Press” became empty string when sending out the email.

I tried using SetGlobalVar(Press=2), and it works, but as it is a global variable, if there are any other caller, they are going to mess up the result.

Basically how can I set a variable to the scope of one call/channel and being able to email it out?

Let me know if this is confusing, I can try to explain in a bit more detail :smile:

You can try to lock up the global variable using another global variable (or AstDB), if voice mail volume is not too high, e.g., (untested)

exten => 2,1,While(${LOCK}) exten => 2,n,Wait(0.5) exten => 2,n,EndWhilte exten => 2,n,SetGlobalVar(LOCK=1) exten => 2,n,SetGlobalVar(Press=2) exten => 2,n,<do voice mail> exten => 2,n,SetGlobalVar(LOCK="")

If every extension uses this, users shouldn’t mess up each other. But if voice mail volume is too high, callers can lose patience.

Thanx for the reply.

So the method is to serve the caller one by one, but that would not work for my case, there will be at least 4 simultanious callers calling into the IVR at one time :frowning:

The use of DB does gives me some idea, that is to save the variable into the DBfor each call/channel, and retreive it during the email sending. However is there some other way of doing it? I have not yet familiarize myself in using the DB :unamused:

Nah, unless you must set the flag before answering. Well, I’m not familiar with voice mail, but I was hoping that the E-mail part was a separate step, so you could set the flag right before sending E-mail, and reset it immediately after.

AstDB is just a group (family) of hash tables (key-value pair). Very straight forward. No relations - good or bad.