*97 voicemail problem [FIXED]

Dears,

When I call the voicemail feature *97 from a DAHDI extension for the firts time after restart Asterisk, the macro-user-callerid sucessfull discover my caller id and ask me for my password normally. After that, all the time that I call the *97 voicemail feature, it acts as the *98 voicemail feature, asking me my mailbox and my password becouse macro-user-callerid don’t discover my caller id anymore. This occurs just from DAHDI extensions.

/etc/asterisk/chandahdi.conf:
[trunkgroups]
[channels]
usecallerid=yes
hidecallerid=no
callwaiting=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
echocancel=yes
echocancelwhenbridged=no
rxgain=5.0
txgain=5.0
busydetect=yes
busycount=2
callprogress=yes
progzone=br
tonezone=20
mohinterpret=default
cidsignalling=dtmf
cidstart=polarity
canpark=yes
callreturn=yes
useincomingcalleridondahditransfer=yes
mwimonitor=fsk,rpas

#include dahdi-channels.conf

/etc/asterisk/dahdi-channels.conf:
;;; line="1 WCTDM/0/0 FXSKS (SWEC: MG2)"
group=0
callgroup=0
pickupgroup=0
signalling=fxs_ks
callerid=asreceived
context=from-zaptel
channel => 1

;;; line="2 WCTDM/0/1 FXSKS (SWEC: MG2)"
group=0
callgroup=0
pickupgroup=0
signalling=fxs_ks
callerid=asreceived
context=from-zaptel
channel => 2

;;; line="3 WCTDM/0/2 FXOKS (SWEC: MG2)"
group=1
callgroup=1
pickupgroup=1
signalling=fxo_ks
callerid=“Quarto” <7000>
mailbox=7000
context=from-internal
channel => 3

;;; line="4 WCTDM/0/3 FXOKS (SWEC: MG2)"
group=1
callgroup=1
pickupgroup=1
signalling=fxo_ks
callerid=“Fax” <7100>
mailbox=7100

/etc/asterisk/extensions_additional.conf [macro-user-callerid]:
exten => s,1,Set(AMPUSER=${IF($[“foo${AMPUSER}” = “foo”]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,GotoIf($["${CHANNEL:0:5}" = “Local”]?report)
exten => s,n,ExecIf($["${REALCALLERIDNUM:1:2}" = “”]?Set(REALCALLERIDNUM=${CALLERID(number)}))
exten => s,n,Set(AMPUSER=${DB(DEVICE/${REALCALLERIDNUM}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,GotoIf($[“x${AMPUSERCIDNAME:1:2}” = “x”]?report)
exten => s,n,Set(AMPUSERCID=${IF($["${DB_EXISTS(AMPUSER/${AMPUSER}/cidnum)}" = “1”]?${DB_RESULT}:${AMPUSER})})
exten => s,n,Set(CALLERID(all)="${AMPUSERCIDNAME}" <${AMPUSERCID}>)
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/language)}" != “”]?Set(CHANNEL(language)=${DB(AMPUSER/${AMPUSER}/language)}))
exten => s,n(report),GotoIf($[ “${ARG1}” = “SKIPTTL” ]?continue)
exten => s,n(report2),Set(__TTL=${IF($[“foo${TTL}” = “foo”]?64:$[ ${TTL} - 1 ])})
exten => s,n,GotoIf($[ ${TTL} > 0 ]?continue)
exten => s,n,Wait(${RINGTIMER})
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(im-sorry&an-error-has-occured&with&call-forwarding)
exten => s,n,Macro(hangupcall,)
exten => s,n,Congestion(20)
exten => s,n(continue),Noop(Using CallerID ${CALLERID(all)})
exten => h,1,Macro(hangupcall,)

Log output when [macro-user-callerid] works fine:
– Starting simple switch on ‘DAHDI/3-1’
– Executing [*97@from-internal:1] Answer(“DAHDI/3-1”, “”) in new stack
– Executing [*97@from-internal:2] Wait(“DAHDI/3-1”, “1”) in new stack
– Executing [*97@from-internal:3] Macro(“DAHDI/3-1”, “user-callerid,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“DAHDI/3-1”, “AMPUSER=7000”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“DAHDI/3-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“DAHDI/3-1”, “1?Set(REALCALLERIDNUM=7000)”) in new stack
– Executing [s@macro-user-callerid:4] Set(“DAHDI/3-1”, “AMPUSER=7000”) in new stack
– Executing [s@macro-user-callerid:5] Set(“DAHDI/3-1”, “AMPUSERCIDNAME=Quarto”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“DAHDI/3-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“DAHDI/3-1”, “AMPUSERCID=7000”) in new stack
– Executing [s@macro-user-callerid:8] Set(“DAHDI/3-1”, “CALLERID(all)=“Quarto” <7000>”) in new stack
– Executing [s@macro-user-callerid:9] ExecIf(“DAHDI/3-1”, “0?Set(CHANNEL(language)=)”) in new stack
– Executing [s@macro-user-callerid:10] GotoIf(“DAHDI/3-1”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:11] Set(“DAHDI/3-1”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“DAHDI/3-1”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] NoOp(“DAHDI/3-1”, “Using CallerID “Quarto” <7000>”) in new stack
– Executing [*97@from-internal:4] Macro(“DAHDI/3-1”, “get-vmcontext,7000”) in new stack
– Executing [s@macro-get-vmcontext:1] Set(“DAHDI/3-1”, “VMCONTEXT=default”) in new stack
– Executing [s@macro-get-vmcontext:2] GotoIf(“DAHDI/3-1”, “0?200:300”) in new stack
– Goto (macro-get-vmcontext,s,300)
– Executing [s@macro-get-vmcontext:300] NoOp(“DAHDI/3-1”, “”) in new stack
– Executing [*97@from-internal:5] MailboxExists(“DAHDI/3-1”, “7000@default”) in new stack
– Executing [*97@from-internal:6] GotoIf(“DAHDI/3-1”, “1?mbexist”) in new stack
– Goto (from-internal,*97,106)
– Executing [*97@from-internal:106] VoiceMailMain(“DAHDI/3-1”, “7000@default”) in new stack
– <DAHDI/3-1> Playing ‘vm-password.g729’ (language ‘en’)

Log output when [macro-user-callerid] doesn’t work:
– Starting simple switch on ‘DAHDI/3-1’
– Executing [*97@from-internal:1] Answer(“DAHDI/3-1”, “”) in new stack
– Executing [*97@from-internal:2] Wait(“DAHDI/3-1”, “1”) in new stack
– Executing [*97@from-internal:3] Macro(“DAHDI/3-1”, “user-callerid,”) in new stack
– Executing [s@macro-user-callerid:1] Set(“DAHDI/3-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“DAHDI/3-1”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“DAHDI/3-1”, “1?Set(REALCALLERIDNUM=)”) in new stack
– Executing [s@macro-user-callerid:4] Set(“DAHDI/3-1”, “AMPUSER=”) in new stack
– Executing [s@macro-user-callerid:5] Set(“DAHDI/3-1”, “AMPUSERCIDNAME=”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“DAHDI/3-1”, “1?report”) in new stack
– Goto (macro-user-callerid,s,10)
– Executing [s@macro-user-callerid:10] GotoIf(“DAHDI/3-1”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:11] Set(“DAHDI/3-1”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:12] GotoIf(“DAHDI/3-1”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,19)
– Executing [s@macro-user-callerid:19] NoOp(“DAHDI/3-1”, “Using CallerID “” <>”) in new stack
– Executing [*97@from-internal:4] Macro(“DAHDI/3-1”, “get-vmcontext,”) in new stack
– Executing [s@macro-get-vmcontext:1] Set(“DAHDI/3-1”, “VMCONTEXT=”) in new stack
– Executing [s@macro-get-vmcontext:2] GotoIf(“DAHDI/3-1”, “1?200:300”) in new stack
– Goto (macro-get-vmcontext,s,200)
– Executing [s@macro-get-vmcontext:200] Set(“DAHDI/3-1”, “VMCONTEXT=default”) in new stack
– Executing [*97@from-internal:5] MailboxExists(“DAHDI/3-1”, “@default”) in new stack
– Executing [*97@from-internal:6] GotoIf(“DAHDI/3-1”, “0?mbexist”) in new stack
– Executing [*97@from-internal:7] VoiceMailMain(“DAHDI/3-1”, “”) in new stack
– <DAHDI/3-1> Playing ‘vm-login.g729’ (language ‘en’)

Anyone can help me?

Thank you so much!!!