Search in sources :

Example 71 with ParseException

use of java.text.ParseException 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 72 with ParseException

use of java.text.ParseException 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 73 with ParseException

use of java.text.ParseException in project Openfire by igniterealtime.

the class ConferenceManager method playTreatment.

/**
     * Play a treatment to the specified conference
     */
public static void playTreatment(String conferenceId, String treatment) throws ParseException {
    if (Logger.logLevel >= Logger.LOG_MOREINFO) {
        Logger.println("playing treatment " + treatment + " to " + conferenceId);
    }
    synchronized (conferenceList) {
        ConferenceManager conferenceManager;
        conferenceManager = findConferenceManager(conferenceId);
        try {
            conferenceManager.addTreatment(treatment);
        } catch (IOException e) {
            throw new ParseException("bad treatment " + " " + e.getMessage(), 0);
        }
        return;
    }
}
Also used : IOException(java.io.IOException) ParseException(java.text.ParseException)

Example 74 with ParseException

use of java.text.ParseException in project Openfire by igniterealtime.

the class ConferenceMember method addCall.

public void addCall(String whisperGroupId) throws ParseException {
    synchronized (conferenceManager) {
        synchronized (whisperGroups) {
            WhisperGroup whisperGroup = wgManager.findWhisperGroup(whisperGroupId);
            if (whisperGroup == null) {
                Logger.println("Call " + cp + " Whisper group " + whisperGroupId + " doesn't exist.  " + "Automatically creating it with attenuation 0 " + "and locked");
                try {
                    whisperGroup = conferenceManager.createWhisperGroup(whisperGroupId, 0.0D);
                    whisperGroup.setTransient(true);
                    whisperGroup.setLocked(true);
                } catch (ParseException e) {
                    Logger.println("Can't create whisper group " + whisperGroupId + " " + e.getMessage());
                    throw new ParseException("Can't create whisper group " + whisperGroupId + " " + e.getMessage(), 0);
                }
            }
            addCall(whisperGroup);
        }
    }
}
Also used : ParseException(java.text.ParseException)

Example 75 with ParseException

use of java.text.ParseException in project Openfire by igniterealtime.

the class NSOutgoingCallAgent method initiateCall.

public void initiateCall() throws IOException {
    InetSocketAddress isa = callHandler.getReceiveAddress();
    if (isa == null) {
        throw new IOException("can't get receiver socket!");
    }
    setState(CallState.INVITED);
    TreatmentManager treatmentManager = null;
    if (cp.getInputTreatment() != null) {
        if (cp.getInputTreatment().length() > 0) {
            try {
                /*
				 * Just make sure we can open the file
				 */
                treatmentManager = new TreatmentManager(cp.getInputTreatment(), RtpPacket.PCM_ENCODING, mixerMediaPreference.getSampleRate(), mixerMediaPreference.getChannels());
                treatmentManager.stopTreatment(false);
            } catch (IOException e) {
                Logger.println("Invalid input treatment:  " + cp.getInputTreatment());
                throw new IOException("Invalid input treatment:  " + cp.getInputTreatment());
            }
        }
        /*
			 * This is a special call which is used to play
			 * an input treatment as its input.
			 * There is no remote endpoint.
			 */
        try {
            setRemoteMediaInfo(treatmentManager);
        } catch (ParseException e) {
            throw new IOException(e.getMessage());
        }
    }
}
Also used : InetSocketAddress(java.net.InetSocketAddress) TreatmentManager(com.sun.voip.TreatmentManager) IOException(java.io.IOException) ParseException(java.text.ParseException)

Aggregations

ParseException (java.text.ParseException)1141 Date (java.util.Date)435 SimpleDateFormat (java.text.SimpleDateFormat)387 IOException (java.io.IOException)118 DateFormat (java.text.DateFormat)117 Calendar (java.util.Calendar)104 ArrayList (java.util.ArrayList)98 Test (org.junit.Test)58 HashMap (java.util.HashMap)45 Matcher (java.util.regex.Matcher)39 File (java.io.File)38 GregorianCalendar (java.util.GregorianCalendar)34 Map (java.util.Map)28 BigDecimal (java.math.BigDecimal)23 Timestamp (java.sql.Timestamp)21 List (java.util.List)21 Locale (java.util.Locale)20 SipException (javax.sip.SipException)20 InputStream (java.io.InputStream)19 TimeZone (java.util.TimeZone)19