Add more akka fsesl logs
- add more logs to trace messages - add FS status check by sending ESL message to FS
This commit is contained in:
parent
80486f8f5d
commit
9893e352be
@ -22,10 +22,13 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bigbluebutton.freeswitch.voice.events.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FreeswitchConferenceEventListener implements ConferenceEventListener {
|
||||
private static Logger log = LoggerFactory.getLogger(FreeswitchConferenceEventListener.class);
|
||||
|
||||
private static final int SENDERTHREADS = 1;
|
||||
private static final Executor msgSenderExec = Executors.newFixedThreadPool(SENDERTHREADS);
|
||||
private static final Executor runExec = Executors.newFixedThreadPool(SENDERTHREADS);
|
||||
@ -43,7 +46,7 @@ public class FreeswitchConferenceEventListener implements ConferenceEventListene
|
||||
messages.offer(event, 5, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
log.error("Exception queueing message: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +106,7 @@ public class FreeswitchConferenceEventListener implements ConferenceEventListene
|
||||
sendMessageToBigBlueButton(message);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
log.error("Exception taking message form queue: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ public class ConnectionManager {
|
||||
private final ConferenceEventListener conferenceEventListener;
|
||||
private final ESLEventListener eslEventListener;
|
||||
|
||||
private long lastStatusCheck = 0L;
|
||||
|
||||
public ConnectionManager(ManagerConnection connManager,
|
||||
ESLEventListener eventListener, ConferenceEventListener confListener) {
|
||||
this.manager = connManager;
|
||||
@ -62,6 +64,7 @@ public class ConnectionManager {
|
||||
}
|
||||
|
||||
private void connect() {
|
||||
//log.info("Connecting to FS ESL");
|
||||
try {
|
||||
Client c = manager.getESLClient();
|
||||
if (!c.canSend()) {
|
||||
@ -74,10 +77,18 @@ public class ConnectionManager {
|
||||
c.cancelEventSubscriptions();
|
||||
c.addEventListener(eslEventListener);
|
||||
c.setEventSubscriptions("plain", "all");
|
||||
c.addEventFilter(EVENT_NAME, "heartbeat");
|
||||
//c.addEventFilter(EVENT_NAME, "heartbeat");
|
||||
c.addEventFilter(EVENT_NAME, "custom");
|
||||
c.addEventFilter(EVENT_NAME, "background_job");
|
||||
subscribed = true;
|
||||
} else {
|
||||
// Let's check for status every minute.
|
||||
Long now = System.currentTimeMillis();
|
||||
if ((now - lastStatusCheck) > 60000) {
|
||||
lastStatusCheck = now;
|
||||
CheckFreeswitchStatusCommand fsStatusCmd = new CheckFreeswitchStatusCommand("foo", "bar");
|
||||
checkFreeswitchStatus(fsStatusCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (InboundConnectionFailure e) {
|
||||
@ -125,6 +136,7 @@ public class ConnectionManager {
|
||||
}
|
||||
|
||||
public void checkIfConfIsRunningCommand(CheckIfConfIsRunningCommand command) {
|
||||
log.info("Sending CheckIfConfIsRunningCommand to FreeSWITCH");
|
||||
Client c = manager.getESLClient();
|
||||
if (c.canSend()) {
|
||||
EslMessage response = c.sendSyncApiCommand(command.getCommand(),
|
||||
@ -133,6 +145,15 @@ public class ConnectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void checkFreeswitchStatus(CheckFreeswitchStatusCommand ccrc) {
|
||||
Client c = manager.getESLClient();
|
||||
if (c.canSend()) {
|
||||
EslMessage response = c.sendSyncApiCommand(ccrc.getCommand(),
|
||||
ccrc.getCommandArgs());
|
||||
ccrc.handleResponse(response, conferenceEventListener);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkIfConferenceIsRecording(ConferenceCheckRecordCommand ccrc) {
|
||||
Client c = manager.getESLClient();
|
||||
if (c.canSend()) {
|
||||
|
@ -44,6 +44,7 @@ public class ESLEventListener implements IEslEventListener {
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ExceptionEvent e) {
|
||||
log.warn("Exception caught: ", e);
|
||||
// setChanged();
|
||||
// notifyObservers(e);
|
||||
}
|
||||
@ -237,13 +238,14 @@ public class ESLEventListener implements IEslEventListener {
|
||||
|
||||
@Override
|
||||
public void eventReceived(EslEvent event) {
|
||||
// System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]" +
|
||||
// event.getEventHeaders().toString());
|
||||
// if (event.getEventName().equals(FreeswitchHeartbeatMonitor.EVENT_HEARTBEAT)) {
|
||||
//System.out.println("ESL Event Listener received event=[" + event.getEventName() + "]" +
|
||||
// event.getEventHeaders().toString());
|
||||
if (event.getEventName().equals("heartbeat")) {
|
||||
log.info("Received heartbeat from FreeSWITCH");
|
||||
//// setChanged();
|
||||
// notifyObservers(event);
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private Integer getMemberIdFromEvent(EslEvent e) {
|
||||
|
@ -66,10 +66,11 @@ public class FreeswitchApplication implements IDelayedCommandListener{
|
||||
|
||||
private void queueMessage(FreeswitchCommand command) {
|
||||
try {
|
||||
log.info("Queue message: " + command.getCommand() + " " + command.getCommandArgs());
|
||||
messages.offer(command, 5, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
log.error("Exception queueing message: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +95,7 @@ public class FreeswitchApplication implements IDelayedCommandListener{
|
||||
sendMessageToFreeswitch(message);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
log.error("Exception taking message from queue: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,6 +154,7 @@ public class FreeswitchApplication implements IDelayedCommandListener{
|
||||
private void sendMessageToFreeswitch(final FreeswitchCommand command) {
|
||||
Runnable task = new Runnable() {
|
||||
public void run() {
|
||||
log.info("Sending message: " + command.getCommand() + " " + command.getCommandArgs());
|
||||
if (command instanceof GetAllUsersCommand) {
|
||||
GetAllUsersCommand cmd = (GetAllUsersCommand) command;
|
||||
manager.getUsers(cmd);
|
||||
|
@ -0,0 +1,35 @@
|
||||
package org.bigbluebutton.freeswitch.voice.freeswitch.actions;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bigbluebutton.freeswitch.voice.events.ConferenceEventListener;
|
||||
import org.freeswitch.esl.client.transport.message.EslMessage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CheckFreeswitchStatusCommand extends FreeswitchCommand {
|
||||
private static Logger log = LoggerFactory.getLogger(CheckFreeswitchStatusCommand.class);
|
||||
|
||||
public CheckFreeswitchStatusCommand(String room, String requesterId) {
|
||||
super(room, requesterId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand() {
|
||||
return "status";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandArgs() {
|
||||
log.debug("Check FreeSWITCH Status.");
|
||||
return "";
|
||||
}
|
||||
|
||||
public void handleResponse(EslMessage response, ConferenceEventListener eventListener) {
|
||||
|
||||
Gson gson = new Gson();
|
||||
log.info(gson.toJson(response.getBodyLines()));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -32,7 +32,7 @@ class RxJsonMsgHdlrActor(val fsApp: FreeswitchApplication) extends Actor with Ac
|
||||
}
|
||||
|
||||
def handle(envelope: BbbCoreEnvelope, jsonNode: JsonNode): Unit = {
|
||||
log.debug("Route envelope name " + envelope.name)
|
||||
//log.debug("Route envelope name " + envelope.name)
|
||||
envelope.name match {
|
||||
case GetUsersInVoiceConfSysMsg.NAME =>
|
||||
routeGetUsersInVoiceConfSysMsg(envelope, jsonNode)
|
||||
|
Loading…
Reference in New Issue
Block a user