use of org.openhab.library.tel.types.CallType in project openhab1-addons by openhab.
the class FreeswitchBinding method handleNewCallEvent.
/**
* Handle Answer or Media (ringing) events and add an entry to our cache
*
* @param event
*/
private void handleNewCallEvent(EslEvent event) {
String uuid = getHeader(event, UUID);
logger.debug("Adding Call with uuid " + uuid);
Channel channel = new Channel(event);
// we should not get duplicate events, but lets be safe
if (eventCache.containsKey(uuid)) {
return;
}
eventCache.put(uuid, channel);
itemMap.put(uuid, new LinkedList<FreeswitchBindingConfig>());
CallType call = channel.getCall();
logger.debug("new call to : {} from : {}", call.getDestNum(), call.getOrigNum());
for (FreeswitchBindingProvider provider : providers) {
for (String itemName : provider.getItemNames()) {
FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName);
if (config.getType() == FreeswitchBindingType.ACTIVE) {
/*
* Add the item if it is filtered and matches or if it is
* un-filtered and inbound
*/
if ((config.filtered() && matchCall(channel, config.getArgument())) || (!config.filtered() && isInboundCall(channel))) {
itemMap.get(uuid).add(config);
newCallItemUpdate(config, channel);
}
}
}
}
}
Aggregations