Search in sources :

Example 6 with TreatmentManager

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

the class CallSetupAgent method cancelRequest.

/**
     * Cancel a call
     */
public void cancelRequest(String s) {
    if (reasonCallTerminated != null || getState() == CallState.ENDED) {
        return;
    }
    reasonCallTerminated = s;
    if (inviteTimeoutThread != null) {
        inviteTimeoutThread.interrupt();
        inviteTimeoutThread = null;
    }
    if (Logger.logLevel >= Logger.LOG_INFO) {
        Logger.println("Call " + callHandler + ":  cancelling call, " + s);
    }
    if (callAnsweredTreatment != null) {
        callAnsweredTreatment.stopTreatment();
    }
    if (callEstablishedTreatment != null) {
        callEstablishedTreatment.stopTreatment();
    }
    if (getState() == CallState.ESTABLISHED) {
        String endTreatment = cp.getCallEndTreatment();
        if (endTreatment != null && cp.isConferenceMuted() == false) {
            try {
                MediaInfo mediaInfo = callHandler.getConferenceManager().getMediaInfo();
                TreatmentManager callEndTreatment = new TreatmentManager(endTreatment, 0, mediaInfo.getSampleRate(), mediaInfo.getChannels());
                setState(CallState.ENDING, "Reason='" + s + "'");
                if (Logger.logLevel >= Logger.LOG_MOREINFO) {
                    Logger.println("Call " + callHandler + " adding end treatment...");
                }
                callEndTreatment.addTreatmentDoneListener(this);
                callHandler.addTreatment(callEndTreatment);
                return;
            } catch (IOException e) {
                Logger.error("Call " + callHandler + " " + e.getMessage());
            }
        }
    }
    // do subclass specific work
    terminateCall();
    setState(CallState.ENDING, "Reason='" + s + "'");
    done();
}
Also used : MediaInfo(com.sun.voip.MediaInfo) TreatmentManager(com.sun.voip.TreatmentManager) IOException(java.io.IOException)

Aggregations

TreatmentManager (com.sun.voip.TreatmentManager)6 IOException (java.io.IOException)4 InetSocketAddress (java.net.InetSocketAddress)2 ParseException (java.text.ParseException)2 MediaInfo (com.sun.voip.MediaInfo)1 InvalidArgumentException (javax.sip.InvalidArgumentException)1