HasNewVoicemail


#1

docs suggest that a variable can be set with this call, saving the number of messages in the variable. I am not getting the variable set.
Syntax issue?

exten => s,3,HasNewVoicemail(1231@default:INBOX|${msgcnt})

The call branches correctly - goes to 104 if there are msgs and 4 if none.


#2

Did you remember to do a SetVar() command in the same context to declare the variable first?

exten => s,n,SetVar(msgcnt=0)

Or, you can make it a global if you wish:

[globals]
msgcnt=0


#3

thanks, i did forget to declare the new local var.

[iknowphilc]
exten => s,1,Answer()
exten => s,2,Wait(1)
exten => s,3,Playback(/tmp/philc)
exten => s,4,SetVar(msgcnt=0)
exten => s,5,HasNewVoicemail(1231@default:INBOX|${msgcnt})
exten => s,6,Hangup()
exten => s,106,NoOp(${msgcnt})
exten => s,107,SayNumber(msgcnt,m)

OK, now it does not blow up on the variable, but it is always 0 even though we branched to 106 because it has a message count is greater than 0!


#4

Hmmmmm…

Did you try:

exten => s,5,HasNewVoicemail(1231@default:INBOX|msgcnt)

I know it’s not what you expect, but…


#5

Thanks,

[iknowphilc]
exten => s,1,Answer()
exten => s,2,Wait(1)
exten => s,3,Playback(/tmp/philc)
exten => s,4,SetVar(msgcnt=0)
exten => s,5,HasNewVoicemail(1231@default:INBOX|msgcnt)
exten => s,6,Hangup()
exten => s,106,Playback(vm-youhave)
exten => s,107,SayNumber(${msgcnt},f)
exten => s,108,Playback(vm-messages)

${at least} (theyare ${Consistent!}())!
:wink: