Search in sources :

Example 1 with EslMessage

use of org.freeswitch.esl.client.transport.message.EslMessage in project openhab1-addons by openhab.

the class FreeswitchBinding method initMessageItems.

/**
     * query freeswitch for the message count for VM accounts. This should
     * be done every time we connect to the system.
     */
private void initMessageItems() {
    mwiCache.clear();
    for (FreeswitchBindingProvider provider : providers) {
        for (String itemName : provider.getItemNames()) {
            FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName);
            if (config.getType() == FreeswitchBindingType.MESSAGE_WAITING) {
                String account = config.getArgument();
                if (!mwiCache.containsKey(account) && clientValid()) {
                    EslMessage msg = inboudClient.sendSyncApiCommand("vm_boxcount", account);
                    if (msg.getBodyLines().size() == 1) {
                        try {
                            int messages = Integer.parseInt(msg.getBodyLines().get(0));
                            mwiCache.put(account, new MWIModel(messages > 0, messages));
                            updateMessageWaitingItem(config);
                        } catch (Exception e) {
                            logger.error("Could not parse messages", e);
                        }
                    }
                }
            }
        }
    }
}
Also used : EslMessage(org.freeswitch.esl.client.transport.message.EslMessage) FreeswitchBindingProvider(org.openhab.binding.freeswitch.FreeswitchBindingProvider) ConfigurationException(org.osgi.service.cm.ConfigurationException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 2 with EslMessage

use of org.freeswitch.esl.client.transport.message.EslMessage in project bigbluebutton by bigbluebutton.

the class ConnectionManager method hangUp.

public void hangUp(DeskShareHangUpCommand huCmd) {
    Client c = manager.getESLClient();
    if (c.canSend()) {
        System.out.println("ConnectionManager: send to FS: hangUp " + huCmd.getCommandArgs());
        EslMessage response = c.sendSyncApiCommand(huCmd.getCommand(), huCmd.getCommandArgs());
        huCmd.handleResponse(response, conferenceEventListener);
    }
}
Also used : EslMessage(org.freeswitch.esl.client.transport.message.EslMessage) Client(org.freeswitch.esl.client.inbound.Client)

Example 3 with EslMessage

use of org.freeswitch.esl.client.transport.message.EslMessage in project bigbluebutton by bigbluebutton.

the class ConnectionManager method record.

public void record(RecordConferenceCommand rcc) {
    Client c = manager.getESLClient();
    if (c.canSend()) {
        EslMessage response = c.sendSyncApiCommand(rcc.getCommand(), rcc.getCommandArgs());
        rcc.handleResponse(response, conferenceEventListener);
    }
}
Also used : EslMessage(org.freeswitch.esl.client.transport.message.EslMessage) Client(org.freeswitch.esl.client.inbound.Client)

Example 4 with EslMessage

use of org.freeswitch.esl.client.transport.message.EslMessage in project bigbluebutton by bigbluebutton.

the class ConnectionManager method broadcastRTMP.

public void broadcastRTMP(DeskShareBroadcastRTMPCommand rtmp) {
    Client c = manager.getESLClient();
    if (c.canSend()) {
        System.out.println("ConnectionManager: send to FS: broadcastRTMP " + rtmp.getCommandArgs());
        EslMessage response = c.sendSyncApiCommand(rtmp.getCommand(), rtmp.getCommandArgs());
        rtmp.handleResponse(response, conferenceEventListener);
    }
}
Also used : EslMessage(org.freeswitch.esl.client.transport.message.EslMessage) Client(org.freeswitch.esl.client.inbound.Client)

Example 5 with EslMessage

use of org.freeswitch.esl.client.transport.message.EslMessage in project bigbluebutton by bigbluebutton.

the class Client method cancelLogging.

/**
     * Disable any logging previously enabled with setLogLevel().
     * 
     * @return a {@link CommandResponse} with the server's response.
     */
public CommandResponse cancelLogging() {
    checkConnected();
    InboundClientHandler handler = (InboundClientHandler) channel.getPipeline().getLast();
    EslMessage response = handler.sendSyncSingleLineCommand(channel, "nolog");
    return new CommandResponse("nolog", response);
}
Also used : EslMessage(org.freeswitch.esl.client.transport.message.EslMessage) CommandResponse(org.freeswitch.esl.client.transport.CommandResponse)

Aggregations

EslMessage (org.freeswitch.esl.client.transport.message.EslMessage)21 CommandResponse (org.freeswitch.esl.client.transport.CommandResponse)9 Client (org.freeswitch.esl.client.inbound.Client)7 EslEvent (org.freeswitch.esl.client.transport.event.EslEvent)3 InboundConnectionFailure (org.freeswitch.esl.client.inbound.InboundConnectionFailure)2 Test (org.junit.Test)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 IEslEventListener (org.freeswitch.esl.client.IEslEventListener)1 SendMsg (org.freeswitch.esl.client.transport.SendMsg)1 Name (org.freeswitch.esl.client.transport.message.EslHeaders.Name)1 FreeswitchBindingProvider (org.openhab.binding.freeswitch.FreeswitchBindingProvider)1 ConfigurationException (org.osgi.service.cm.ConfigurationException)1