How to set the channel variable in ASTERISK ARI
Initiating the call using the code
Map<String,String> channelVar = new HashMap<>();
channelVar.put("UID",callRequest.getUid());
channelVar.put("asterisk_context",outContext);
channelVar.put("sipGateway", suffix);
channelVar.put("outCallerId",outCallerId);
channelVar.put("timeout",timeout);
channelVar.put("TO",callRequest.getExtraParams().get("TO"));
Channel channel = ARIApp.ari.channels().originate("PJSIP/8224XXXXX")
.setApp(ARIApp.APP_NAME)
.setAppArgs(callRequest.getUid())
.setCallerId(outCallerId)
.setVariables(channelVar)
.setTimeout(Integer.parseInt(timeout))
.setChannelId(channelId)
.execute();
Once I get the call and answered the same I am getting stasis start event in application there i am checking these channel variable but i am getting null only.
String uid = ARIApp.ari.channels().getChannelVar(channelId,"UID").execute().getValue();
I tried setting after call initiate also but that is also not working