Search in sources :

Example 1 with ResponseEvent

use of javax.sip.ResponseEvent in project XobotOS by xamarin.

the class SipSessionGroup method expectResponse.

/**
     * @return true if the event is a response event and the CSeqHeader method
     * match the given arguments; false otherwise
     */
private static boolean expectResponse(String expectedMethod, EventObject evt) {
    if (evt instanceof ResponseEvent) {
        ResponseEvent event = (ResponseEvent) evt;
        Response response = event.getResponse();
        return expectedMethod.equalsIgnoreCase(getCseqMethod(response));
    }
    return false;
}
Also used : Response(javax.sip.message.Response) SIPResponse(gov.nist.javax.sip.message.SIPResponse) ResponseEvent(javax.sip.ResponseEvent)

Example 2 with ResponseEvent

use of javax.sip.ResponseEvent in project XobotOS by xamarin.

the class SipSessionGroup method expectResponse.

/**
     * @return true if the event is a response event and the response code and
     *      CSeqHeader method match the given arguments; false otherwise
     */
private static boolean expectResponse(int responseCode, String expectedMethod, EventObject evt) {
    if (evt instanceof ResponseEvent) {
        ResponseEvent event = (ResponseEvent) evt;
        Response response = event.getResponse();
        if (response.getStatusCode() == responseCode) {
            return expectedMethod.equalsIgnoreCase(getCseqMethod(response));
        }
    }
    return false;
}
Also used : Response(javax.sip.message.Response) SIPResponse(gov.nist.javax.sip.message.SIPResponse) ResponseEvent(javax.sip.ResponseEvent)

Example 3 with ResponseEvent

use of javax.sip.ResponseEvent in project XobotOS by xamarin.

the class SipProviderImpl method handleEvent.

/**
     * Handle the SIP event - because we have only one listener and we are
     * already in the context of a separate thread, we dont need to enque the
     * event and signal another thread.
     *
     * @param sipEvent
     *            is the event to process.
     *
     */
public void handleEvent(EventObject sipEvent, SIPTransaction transaction) {
    if (sipStack.isLoggingEnabled()) {
        sipStack.getStackLogger().logDebug("handleEvent " + sipEvent + "currentTransaction = " + transaction + "this.sipListener = " + this.getSipListener() + "sipEvent.source = " + sipEvent.getSource());
        if (sipEvent instanceof RequestEvent) {
            Dialog dialog = ((RequestEvent) sipEvent).getDialog();
            if (sipStack.isLoggingEnabled())
                sipStack.getStackLogger().logDebug("Dialog = " + dialog);
        } else if (sipEvent instanceof ResponseEvent) {
            Dialog dialog = ((ResponseEvent) sipEvent).getDialog();
            if (sipStack.isLoggingEnabled())
                sipStack.getStackLogger().logDebug("Dialog = " + dialog);
        }
        sipStack.getStackLogger().logStackTrace();
    }
    EventWrapper eventWrapper = new EventWrapper(sipEvent, transaction);
    if (!sipStack.reEntrantListener) {
        // Run the event in the context of a single thread.
        this.eventScanner.addEvent(eventWrapper);
    } else {
        // just call the delivery method
        this.eventScanner.deliverEvent(eventWrapper);
    }
}
Also used : SIPDialog(gov.nist.javax.sip.stack.SIPDialog) Dialog(javax.sip.Dialog) RequestEvent(javax.sip.RequestEvent) ResponseEvent(javax.sip.ResponseEvent)

Aggregations

ResponseEvent (javax.sip.ResponseEvent)3 SIPResponse (gov.nist.javax.sip.message.SIPResponse)2 Response (javax.sip.message.Response)2 SIPDialog (gov.nist.javax.sip.stack.SIPDialog)1 Dialog (javax.sip.Dialog)1 RequestEvent (javax.sip.RequestEvent)1