[Asterisk-Users] Asterisk Gotoif / last called

vocalvoip vocalvoip at mpa.net.au
Fri Jan 2 21:42:10 MST 2004


Hi guys

Ive been trying to get this to work for ages now, basicaly im trying to do if ${woteva} = "" (nothing), or its none existenant then do label 1, else label 2. for my last called function, so it will play a different message if theres no last call in the system or it was anonymous.
ive tried 

exten => 1000,1,GotoIf($[${last-call${CALLERIDNUM}} = ""]?4:5)
and heaps of other combinations, most times it ses syntax error when im in asterisk verbose more when it loads the gotoif. I know the variable ${last-call${CALLERIDNUM}} as i tested it before it loads the gotoif line. Does anyone know howto do this ??
Also say in my example above, its true so it goes to 4, does that mean it goes to extension 4.. or rule 4 in that dialplan ? 

thanks heaps for all your help :)

p.s i dunno if asterisk comes with a last caller function, and theres probs heaps better ways to do it, but if u wana do it all i did was 



;line 2 and 3, makes a variable last-call2001 = whoever called, and sets the time.

exten => 2001,1,Dial(SIP/2001,20)
exten => 2001,2,SetGlobalVar(last-call${EXTEN}=${CALLERIDNUM})
exten => 2001,3,SetGlobalVar(2001date=${DATETIME})
exten => 2001,4,Voicemail(u2001)
exten => 2001,104,Voicemail(b2001)
exten => 2001,105,Hangup

; say your last call ; gets the callerid and then plays last-call'callerid'

exten => 128,1,Answer
exten => 128,2,Wait(1)
exten => 128,3,Playback(lastmisscall)
exten => 128,4,SayDigits(${last-call${CALLERIDNUM}})
exten => 128,5,Playback(lastcallat)
exten => 128,6,Datetime(${2001date})
exten => 128,7,Playback(thankyoucome)
exten => 128,8,Wait(1)
exten => 128,9,Hangup


oh while im asking.. is there a way to make global changes to a context.. cause ive got a dialplan for each user in a context obviously, but instead of having to put these 2 lines
exten => 2001,2,SetGlobalVar(last-call${EXTEN}=${CALLERIDNUM})
exten => 2001,3,SetGlobalVar(2001date=${DATETIME})
in each user dialplan could i just put it once and make it load everytime someone in that context is called ?

thanks again heaps :)



More information about the asterisk-users mailing list