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
and SetVariables
. Both variables accept different types for the input parameters, ie String and Map respectively.
I am not a Java developer, but I think updating your code like following may fix your issue.
HashMap<String, String> map = new HashMap<String, String>();
map.put("SIPADD","10002");
map.put("VQWAITER","10003");
oc.SetVariables(map);
This is a minor bug in AsterNET v1.3.0 when using Asterisk versions newer than v13. See AsterNET issue #220 for details.
Current workaround is to manually set the VAR_DELIMITER
property on the connection after connecting to the Asterisk server.
managerConnection.VAR_DELIMITER = new char[] { ',' };
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.