예제 #1
0
  @Override
  public void appDisconnect(IConnection conn) {
    String clientId = Red5.getConnectionLocal().getClient().getId();
    String userid = getUserId();
    String username = getUsername();

    String remoteHost = Red5.getConnectionLocal().getRemoteAddress();
    int remotePort = Red5.getConnectionLocal().getRemotePort();
    log.info("[clientid={}] disconnnected from {}.", clientId, remoteHost + ":" + remotePort);
    log.debug(
        "{} [clientid={}] is leaving the voice conf app. Removing from ConnectionManager.",
        username + "[uid=" + userid + "]",
        clientId);

    clientConnManager.removeClient(clientId);

    String peerId = (String) Red5.getConnectionLocal().getAttribute("VOICE_CONF_PEER");
    if (peerId != null) {
      try {
        log.debug(
            "Forcing hang up {} [clientid={}] in case the user is still in the conference.",
            username + "[uid=" + userid + "]",
            clientId);
        sipPeerManager.hangup(peerId, clientId);
      } catch (PeerNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
예제 #2
0
 @Override
 public boolean appStart(IScope scope) {
   log.debug("VoiceConferenceApplication appStart[" + scope.getName() + "]");
   callStreamFactory = new CallStreamFactory();
   callStreamFactory.setScope(scope);
   sipPeerManager.setCallStreamFactory(callStreamFactory);
   sipPeerManager.setClientConnectionManager(clientConnManager);
   sipPeerManager.createSipPeer("default", sipServerHost, sipPort, startAudioPort, stopAudioPort);
   try {
     sipPeerManager.register("default", username, password);
   } catch (PeerNotFoundException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   return true;
 }