I am trying to use C# AsterNET OriginateAction
method to dial out calls with the Asterisk AMI. Calls are working fine But I am having issue on setting variables on this action. I set 2 variables as following:
oc.SetVariables( new Dictionary<string, string>(){ { "SIPADD", "10001"}, { "VQWAITER", "10002" }});
but when i try to get one of the variables "SIPADD" in dialplan. I get both vairables at once in joined form as "Local/10002|_VQWAITER=10001"
Dialplan:
exten => 999,1,NoOp((Caller ID IS: ${CALLERID(num)}))
same => n,Answer()
same => n,NoOp("Callback Agent Address: "${SIPADD})
same => n,Dial(${SIPADD})
same => n,Hangup()
Follwoing is above CLI trace of above dialplan:
Can anyone please guide me whats the issue here? I want to get these variables separately an not joined like this.
For now as a work arround i am splitting the joined string i get by doing following setps in dialplan:
same => n,NoOp("Callback Agent Address: "${SIPADD})
same => n,Set(localSIPAdd=${CUT(SIPADD,|,1)})
same => n,Set(waiter=${CUT(SIPADD,|,2)})
same => n,NoOp("localSIP: "${localSIPAdd})
same => n,NoOp("waiter: "${waiter})
same => n,Set(CALLERID(num)=waiter)
CLI for above change:
Probably you are using Asterisk-Java library. As per its documentation there are two methods available for variables.
SetVariable
andSetVariables
. Both variables accept different types for the input parameters, i.e String and Map respectively.I am not a Java developer, but I think updating your code like following may fix your issue.