[Asterisk-Users] Why ${EXTEN} variable changes after Goto ?

Umar Sear
Thu, 03 Mar 2005 15:01:13 -0000

On Thu, 3 Mar 2005 22:11:23 +0100, Robert Rozman <rozman@fri.uni-lj.si>
wrote:
> Hi,
>
> I'm trying to implement dynamic routing of incoming calls to local
extension
> if previous outgoing call was unanswered.
> But after I do Goto to s-NOANSWER, variable ${EXTEN} changes to
> 's-NOANSWER'. I guess this is normal, but I don't understand
why ? How to
> workaround on this one ?
>
> Thanks in advance,
>
> regards,
>
> Rob.
>
> [outbound-capi-ISDN]
> exten => _0.,1,NoOp(Calling ISDN number ${EXTEN:1} on CAPI/7104370 from
> ${CALLERIDNUM})
> exten => _0.,2,Dial,CAPI/7104370:b${EXTEN:1}|10|Tt
> exten => _0.,3,Goto(s-${DIALSTATUS},1)
> exten => _0.,103,NoOp(Calling ISDN number ${EXTEN:1} on CAPI/7104371)
> exten => _0.,104,Dial,CAPI/7104371:b${EXTEN:1}|30|Tt
> exten => _0.,105,Goto(s-${DIALSTATUS},1)
> exten => _0.,205,Macro(outisbusy)
>
> exten => s-NOANSWER,1,NoOp(NOANSWER - Setting dynamic autoroute for ISDN
> number ${EXTEN:1} to local ext. ${CALLERIDNUM})
> exten => s-NOANSWER,2,DBput(DYNAMIC/${EXTEN}=${CALLERIDNUM})
> exten => s-NOANSWER,3,Congestion
>
> exten => _s-.,1,Congestion
> exten => _s-.,2,Macro(hangupcall)
>

Save the original extension to a variable like ...

exten => _0.,1,SetVar(myvar=${EXTEN})