[asterisk-users] function SHARED and function IMPORT : 2 questions
Jonas Kellens
jonas.kellens at telenet.be
Wed Mar 2 08:07:13 CST 2016
Hello
I am trying to use the functions SHARED and IMPORT to share variables
across SIP-channels.
During my use I encounter 2 problems/questions.
Question 1. only 1 shared variable per channel ??
When I set 2 shared variables on a channel, and I read them a bit futher
in the dialplan, there is only 1 variable that has its value :
Dialplan :
exten => s,n,Set(SHARED(TheINPUT)=1)
exten => s,n,Set(SHARED(MyVar)=222)
...
exten => s,n,Set(Import=${IMPORT(${CHANNEL},TheINPUT)})
exten => s,n,Set(ImportAdv=${IMPORT(${CHANNEL},MyVar)})
Execution :
[Mar 2 14:19:20] -- Executing [s at routing:56]
Set("SIP/980419-00000016", "SHARED(TheINPUT)=1") in new stack
[Mar 2 14:19:20] -- Executing [s at routing:57]
Set("SIP/980419-00000016", "SHARED(MyVar)=222") in new stack
...
[Mar 2 14:19:26] -- Executing [s at routing:80]
Set("SIP/980419-00000016", "Import=1") in new stack
[Mar 2 14:19:26] -- Executing [s at routing:81]
Set("SIP/980419-00000016", "ImportAdv=") in new stack
As you can see, only variable "TheINPUT" has its value ( 1 ). Variable
'MyVar' is empty.
How come ??
Question 2 : how to set a variable on another channel ??
I try to set a Shared Variable on 1 channel :
exten => s,n,Set(SHARED(TheINPUT,${BRIDGECH})=1)
And read the variable on another channel :
exten => s,n,Set(Import=${IMPORT(${BRIDGECH},TheINPUT)})
exten => s,n,Set(Hell=${IMPORT(TheINPUT)})
Execution :
(here the shared var is set)
[Mar 2 14:58:44] -- Executing [s at routing:58]
NoOp("SIP/980419-00000025", "bridgech = SIP/SipT01-00000021") in new stack
[Mar 2 14:58:44] -- Executing [s at routing:59]
Set("SIP/980419-00000025", "SHARED(TheINPUT,SIP/SipT01-00000021)=1") in
new stack
(here the hared var is read)
[Mar 2 14:58:54] -- Executing [s at routing:42]
Set("SIP/SipT01-00000021", "Import=") in new stack
[Mar 2 14:58:54] -- Executing [s at routing:43]
Set("SIP/SipT01-00000021", "Hell=") in new stack
So why is the shared variable "TheINPUT" empty on the channel
SIP/SipT01-00000021 ?? It clealry has been set by the channel
SIP/980419-00000025.
Thank you for answering these 2 questions of mine.
Kind regards,
Jonas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160302/3ae86620/attachment.html>
More information about the asterisk-users
mailing list