Search in sources :

Example 6 with IEventBroker

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));
    }
}
Also used : IEvent(de.janrufmonitor.framework.event.IEvent) IEventBroker(de.janrufmonitor.framework.event.IEventBroker)

Example 7 with IEventBroker

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");
        }
    }
}
Also used : Message(de.janrufmonitor.exception.Message) IAttributeMap(de.janrufmonitor.framework.IAttributeMap) IEventBroker(de.janrufmonitor.framework.event.IEventBroker) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 8 with IEventBroker

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 ...");
}
Also used : Message(de.janrufmonitor.exception.Message) IEventBroker(de.janrufmonitor.framework.event.IEventBroker) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 9 with IEventBroker

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();
}
Also used : IEventBroker(de.janrufmonitor.framework.event.IEventBroker)

Example 10 with IEventBroker

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();
}
Also used : IEventBroker(de.janrufmonitor.framework.event.IEventBroker)

Aggregations

IEventBroker (de.janrufmonitor.framework.event.IEventBroker)52 ICall (de.janrufmonitor.framework.ICall)5 Message (de.janrufmonitor.exception.Message)4 IEvent (de.janrufmonitor.framework.event.IEvent)4 ICaller (de.janrufmonitor.framework.ICaller)3 ICip (de.janrufmonitor.framework.ICip)3 ICallManager (de.janrufmonitor.repository.ICallManager)3 IWriteCallRepository (de.janrufmonitor.repository.types.IWriteCallRepository)3 IOException (java.io.IOException)3 List (java.util.List)3 ICallList (de.janrufmonitor.framework.ICallList)2 IMsn (de.janrufmonitor.framework.IMsn)2 IName (de.janrufmonitor.framework.IName)2 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)2 IReadCallRepository (de.janrufmonitor.repository.types.IReadCallRepository)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 MalformedURLException (java.net.MalformedURLException)2 IAttributeMap (de.janrufmonitor.framework.IAttributeMap)1 FritzBoxCallCsv (de.janrufmonitor.fritzbox.FritzBoxCallCsv)1 FirmwareManager (de.janrufmonitor.fritzbox.firmware.FirmwareManager)1