[asterisk-users] Howto create variable from the name of another one and get content of it

Administrator TOOTAI admin at tootai.net
Fri Mar 22 10:13:58 CDT 2013


Le 22/03/2013 06:08, Satish Barot a écrit :
>
>
>     > I found the problem, it's (I think) a bug with queue command. My
>     > dialplan:
>     >
>     > [context]
>     > ...
>     > exten => 33123,n,macro(unpauseQueueMembers,q820,104,105,136,,)
>     > exten => 33123,n(back2Queue),Queue(${myQueue},nit,,,14400)
>     > exten => 33123,n,NoOp(Queue ${myQueue} call status is ${QUEUESTATUS}
>     > -
>     > Dial status is ${DIALSTATUS} - Our status is ${${myQueue}STATUS})  ;
>     > value is empty
>     > exten => 33123,n,GotoIf($["${${myQueue}STATUS}" =
>     > "myTIMEOUT"]?back2Queue)
>     >
>     > [to-q820]
>     >
>     > exten => 104,1,Dial(SIP/${EXTEN},,Tt)
>     > exten => 105,1,Dial(SIP/${EXTEN},,Tt)
>     > exten => 136,1,Dial(SIP/${EXTEN},,Tt)
>     > exten => _XXX,2,macro(queueCallStatus,${EXTEN})
>     >
>     > [macro-queueCallStatus]
>     >
>     > exten => s,1,Set(__myExten=${ARG1})
>     >     same => n,NoOp(Call status to ${myExten}@${myQueue} is
>     >     ${DIALSTATUS})
>     >     same => n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?exitMacro)
>     >     same => n,GotoIf($["${DIALSTATUS}" != "NOANSWER"]?Pause)
>     >     same => n(exitMacro),MacroExit
>     > ...
>     >     same =>
>     > n(Pause),NoOp(PauseQueueMember(,Local/${myExten}@to-${myQueue}))
>     >     same => n,Set(__${myQueue}STATUS=myTIMEOUT)
>     >     same => n,NoOp(Value of my variable is ${${myQueue}STATUS})
>     >                           ; here I get correct value
>     > ...
>     > [macro-unpauseQueueMembers]
>     >
>     > exten => s,1,Set(__myQueue=${ARG1})
>     >     same => n,Set(__${myQueue}STATUS=)
>     >     same => n,UnpauseQueueMember(,Local/${ARG2}@to-${myQueue})
>     >     same => n,UnpauseQueueMember(,Local/${ARG3}@to-${myQueue})
>     >     same => n,UnpauseQueueMember(,Local/${ARG4}@to-${myQueue})
>     >
>     > If I 33123  the NoOp(Value of my variable is ${${myQueue}STATUS}) in
>     > macro-queueCallStatus shows the right value which is text myTIMEOUT.
>     > But
>     > this value isn't anymore present in
>     > NoOp(Queue ${myQueue} call status is ${QUEUESTATUS} - Dial status is
>     > ${DIALSTATUS} - Our status is ${${myQueue}STATUS}) from [context]
>     > which
>     > is *after* the queue cmd exit.
>
Richard wrote:

>     The the parent channel (the incoming channel on exten 33123) sets the
>     variable to empty.  A child channel (Dialed by app Queue) running a
>     local channel in the context [to-q820] sets the variable to the status
>     you are wanting.  The child cannot send that variable value back
>     to the
>     parent channel.  Channel variable inheritance only goes one way: from
>     parent to child.
>

OK, understand


Satish wrote:

> SHARED function is your best pal here.

Exactly. I tested your dialplan sample and now I get the right value.

Many thanks to all of you for your help

[...]

-- 
Daniel



More information about the asterisk-users mailing list