Search in sources :

Example 1 with ConferenceEvent

use of com.sun.voip.ConferenceEvent in project Openfire by igniterealtime.

the class ConferenceManager method getConference.

public static ConferenceManager getConference(String conferenceId, String mediaPreference, String displayName, boolean permanent) {
    ConferenceManager conferenceManager;
    try {
        conferenceManager = findConferenceManager(conferenceId);
        if (Logger.logLevel >= Logger.LOG_INFO) {
            Logger.println("found existing conference:  '" + conferenceId + "'");
        }
        return conferenceManager;
    } catch (ParseException e) {
    }
    try {
        conferenceManager = new ConferenceManager(conferenceId, mediaPreference, displayName);
    } catch (SocketException e) {
        Logger.error("Can't create conference " + conferenceId + " " + e.getMessage());
        return null;
    }
    synchronized (conferenceList) {
        conferenceList.add(conferenceManager);
    }
    Logger.println("starting new conference:  '" + conferenceId + "'.  " + " conferences in progress:  " + conferenceList.size());
    conferenceManager.setPermanent(permanent);
    String id = conferenceManager.getId();
    if (displayName != null) {
        id += ":" + mediaPreference + ":" + displayName;
    }
    ConferenceManager.conferenceEventNotification(new ConferenceEvent(ConferenceEvent.CONFERENCE_STARTED, id));
    return conferenceManager;
}
Also used : SocketException(java.net.SocketException) ParseException(java.text.ParseException) ConferenceEvent(com.sun.voip.ConferenceEvent)

Example 2 with ConferenceEvent

use of com.sun.voip.ConferenceEvent in project Openfire by igniterealtime.

the class ConferenceManager method leave.

/*
     * keepMember is set to true when a member transfers
     * from one conference to another.
     * This is used for incoming calls which require a temporary conference
     * until the caller specified the desired conference to enter.
     */
public void leave(ConferenceMember member, boolean keepMember) {
    conferenceReceiver.removeMember(member);
    synchronized (this) {
        synchronized (memberList) {
            memberList.remove(member);
            totalMembers--;
            if (keepMember == false) {
                member.end();
            }
            Logger.println("conferenceManager:  '" + conferenceId + "':  member " + member.toString() + " leaving, remaining:  " + memberList.size());
        }
        if (member.joinedDistributedConference()) {
            ConferenceEvent event = new ConferenceEvent(ConferenceEvent.MEMBER_LEFT, conferenceId);
            event.setCallId(member.getCallParticipant().getCallId());
            event.setMemberAddress(member.getMemberSender().getSendAddress());
            event.setIsDistributedBridge(member.getCallParticipant().isDistributedBridge());
            ConferenceManager.conferenceEventNotification(event);
        }
        ConferenceEvent event = new ConferenceEvent(ConferenceEvent.MEMBER_LEFT, conferenceId);
        event.setCallId(member.getCallParticipant().getCallId());
        event.setMemberAddress(member.getMemberSender().getSendAddress());
        event.setMemberCount(memberList.size());
        ConferenceManager.conferenceEventNotification(event);
        boolean endOfDistributedConference = true;
        synchronized (memberList) {
            for (int i = 0; i < memberList.size(); i++) {
                ConferenceMember m = (ConferenceMember) memberList.get(i);
                if (m.getCallParticipant().isDistributedBridge() == false) {
                    endOfDistributedConference = false;
                    break;
                }
            }
        }
        if (endOfDistributedConference) {
            endAllCalls();
        }
        if (memberList.size() == 0) {
            // last member left, the conference is over
            end();
        }
    }
}
Also used : ConferenceEvent(com.sun.voip.ConferenceEvent)

Example 3 with ConferenceEvent

use of com.sun.voip.ConferenceEvent in project Openfire by igniterealtime.

the class ConferenceManager method end.

private void end() {
    try {
        recordConference(false, null, null);
    } catch (ParseException e) {
        Logger.println(conferenceId + ":  Failed to stop recording conference! " + e.getMessage());
    }
    Logger.writeFile("ending conf " + conferenceId + ":  permanent " + permanent + ", mediaPreference " + mediaPreference);
    if (permanent) {
        conferenceSender.printStatistics();
        if (mediaPreference != null) {
            try {
                setMediaInfo(mediaPreference);
            } catch (ParseException e) {
                Logger.println(conferenceId + ":  Can't change meeting media setting to " + mediaPreference + ": " + e.getMessage());
            }
            mediaPreference = null;
        }
    } else {
        if (done) {
            return;
        }
        done = true;
        ConferenceManager.conferenceEventNotification(new ConferenceEvent(ConferenceEvent.CONFERENCE_ENDED, conferenceId));
        synchronized (conferenceList) {
            conferenceList.remove(this);
        }
        if (conferenceReceiver != loneConferenceReceiver) {
            conferenceReceiver.end();
        }
        conferenceSender.printStatistics();
    }
    int activeConferences = 0;
    synchronized (conferenceList) {
        for (int i = 0; i < conferenceList.size(); i++) {
            ConferenceManager conferenceManager = (ConferenceManager) conferenceList.get(i);
            if (conferenceManager.getMemberList().size() > 0) {
                activeConferences++;
            }
        }
    }
    Logger.println("");
    Logger.println("Conference:  '" + conferenceId + "' has ended.  " + "conferences still in progress:  " + activeConferences);
    Logger.println("");
    Logger.flush();
    if (totalMembers == 0) {
        /*
             * This is a great time to do a full garbage collection
             */
        Logger.println("No conferences in progress, doing a full GC...");
        System.gc();
    }
}
Also used : ParseException(java.text.ParseException) ConferenceEvent(com.sun.voip.ConferenceEvent)

Example 4 with ConferenceEvent

use of com.sun.voip.ConferenceEvent in project Openfire by igniterealtime.

the class ConferenceManager method joinConference.

private void joinConference(ConferenceMember member) throws IOException {
    synchronized (memberList) {
        memberList.add(member);
        totalMembers++;
        String s = "";
        conferenceReceiver.addMember(member);
        Logger.println("conferenceManager:  '" + conferenceId + "'," + " new member " + member + s + " total members:  " + memberList.size());
    }
    ConferenceEvent event = new ConferenceEvent(ConferenceEvent.MEMBER_JOINED, conferenceId);
    event.setCallId(member.getCallParticipant().getCallId());
    event.setMemberAddress(member.getMemberSender().getSendAddress());
    event.setMemberCount(memberList.size());
    conferenceEventNotification(event);
}
Also used : ConferenceEvent(com.sun.voip.ConferenceEvent)

Example 5 with ConferenceEvent

use of com.sun.voip.ConferenceEvent in project Openfire by igniterealtime.

the class ConferenceManager method joinDistributedConference.

public void joinDistributedConference(ConferenceMember member) {
    ConferenceEvent event = new ConferenceEvent(ConferenceEvent.MEMBER_JOINED, conferenceId);
    event.setCallId(member.getCallParticipant().getCallId());
    event.setMemberAddress(member.getMemberSender().getSendAddress());
    event.setIsDistributedBridge(member.getCallParticipant().isDistributedBridge());
    conferenceEventNotification(event);
}
Also used : ConferenceEvent(com.sun.voip.ConferenceEvent)

Aggregations

ConferenceEvent (com.sun.voip.ConferenceEvent)5 ParseException (java.text.ParseException)2 SocketException (java.net.SocketException)1