use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class CallSimulator method sendClirEvent.
protected void sendClirEvent() {
if (this.m_currentIdentifiedCall != null) {
IEventBroker evtBroker = this.getRuntime().getEventBroker();
evtBroker.register(this);
this.m_currentIdentifiedCall.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_REASON, Integer.toString(IEventConst.EVENT_TYPE_CALLCLEARED)));
this.m_currentIdentifiedCall.setAttribute(this.getRuntime().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_MISSED));
IEvent ev = evtBroker.createEvent(IEventConst.EVENT_TYPE_CALLCLEARED, this.m_currentIdentifiedCall);
evtBroker.send(this, ev);
evtBroker.unregister(this);
evtBroker.unregister(this, evtBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
}
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class Tellows method receivedValidRule.
public void receivedValidRule(ICall aCall) {
// call is identified already
if (!PhonenumberAnalyzer.getInstance(getRuntime()).isInternal(aCall.getCaller().getPhoneNumber()) && !aCall.getCaller().getPhoneNumber().isClired()) {
if (!aCall.getCaller().getPhoneNumber().getIntAreaCode().equalsIgnoreCase("49") && !aCall.getCaller().getPhoneNumber().getIntAreaCode().equalsIgnoreCase("43") && !aCall.getCaller().getPhoneNumber().getIntAreaCode().equalsIgnoreCase("41")) {
if (this.m_logger.isLoggable(Level.INFO))
this.m_logger.info("Country code not supported by tellows: 00" + aCall.getCaller().getPhoneNumber().getIntAreaCode());
return;
}
String num = aCall.getCaller().getPhoneNumber().getTelephoneNumber();
try {
IAttributeMap m = TellowsProxy.getInstance().getTellowsData(num, aCall.getCaller().getPhoneNumber().getIntAreaCode());
if (m.size() > 0) {
aCall.getCaller().getAttributes().addAll(m);
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.send(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLMARKEDSPAM, aCall));
}
} catch (Exception e) {
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getRuntime().getI18nManagerFactory().getI18nManager().getString(NAMESPACE, "title", "label", getLanguage()), e), "Tray");
}
}
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class Tellows method startup.
public void startup() {
super.startup();
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
eventBroker.register(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_OUTGOING_CALL));
eventBroker.register(this);
if (!this.isTellowsActivated()) {
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_OUTGOING_CALL));
eventBroker.unregister(this);
this.m_logger.warning("No tellows API key found. Service will be stopped.");
String msg = getRuntime().getI18nManagerFactory().getI18nManager().getString(getNamespace(), "no_api_key", "description", getLanguage());
PropagationFactory.getInstance().fire(new Message(Message.WARNING, getRuntime().getI18nManagerFactory().getI18nManager().getString(NAMESPACE, "title", "label", getLanguage()), new Exception(msg)), "Tray");
} else
new URLRequester().go();
this.m_logger.info("Tellows is started ...");
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class TwitterService method shutdown.
public void shutdown() {
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_CALL));
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_OUTGOING_CALL));
super.shutdown();
}
use of de.janrufmonitor.framework.event.IEventBroker in project janrufmonitor by tbrandt77.
the class SynchronizerService method shutdown.
public void shutdown() {
cancelingTimebasedSyncing();
IEventBroker eventBroker = this.getRuntime().getEventBroker();
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_RETURNED_HIBERNATE));
boolean isRefreshAfterCallend = this.m_configuration.getProperty(CFG_REFRESH_AFTER_CALLEND, "false").equalsIgnoreCase("true");
if (isRefreshAfterCallend) {
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_IDENTIFIED_OUTGOING_CALL_ACCEPTED));
eventBroker.unregister(this, eventBroker.createEvent(IEventConst.EVENT_TYPE_CALLACCEPTED));
}
FirmwareManager.getInstance().shutdown();
super.shutdown();
}
Aggregations