Search in sources :

Example 1 with SipSecurityException

use of net.java.sipmack.sip.security.SipSecurityException in project Spark by igniterealtime.

the class MessageProcessing method processAuthenticationChallenge.

/**
 * Attempts to re-generate the corresponding request with the proper
 * credentials and terminates the call if it fails.
 *
 * @param clientTransaction the corresponding transaction
 * @param response          the challenge
 */
void processAuthenticationChallenge(ClientTransaction clientTransaction, Response response) {
    try {
        ClientTransaction retryTran = sipManCallback.sipSecurityManager.handleChallenge(response, clientTransaction);
        retryTran.sendRequest();
    } catch (SipSecurityException exc) {
        sipManCallback.fireCommunicationsError(new CommunicationsException("Authorization failed!", exc));
    } catch (Exception exc) {
        sipManCallback.fireCommunicationsError(new CommunicationsException("Failed to resend a request " + "after a security challenge!", exc));
    } finally {
    }
}
Also used : SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) ClientTransaction(javax.sip.ClientTransaction) CommunicationsException(net.java.sipmack.sip.CommunicationsException) SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) SipException(javax.sip.SipException) CommunicationsException(net.java.sipmack.sip.CommunicationsException) InvalidArgumentException(javax.sip.InvalidArgumentException) TransactionUnavailableException(javax.sip.TransactionUnavailableException) ParseException(java.text.ParseException)

Example 2 with SipSecurityException

use of net.java.sipmack.sip.security.SipSecurityException in project Spark by igniterealtime.

the class RegisterProcessing method processAuthenticationChallenge.

/**
 * Attempts to re-generate the corresponding request with the proper
 * credentials and terminates the call if it fails.
 *
 * @param clientTransaction the corresponding transaction
 * @param response          the challenge
 */
void processAuthenticationChallenge(ClientTransaction clientTransaction, Response response) {
    try {
        ClientTransaction retryTran = sipManCallback.sipSecurityManager.handleChallenge(response, clientTransaction);
        retryTran.sendRequest();
        return;
    } catch (SipSecurityException exc) {
        // tell the others we couldn't register
        sipManCallback.fireUnregistered(((FromHeader) clientTransaction.getRequest().getHeader(FromHeader.NAME)).getAddress().toString());
        sipManCallback.fireCommunicationsError(new CommunicationsException("Authorization failed!", exc));
    } catch (Exception exc) {
        // tell the others we couldn't register
        sipManCallback.fireUnregistered(((FromHeader) clientTransaction.getRequest().getHeader(FromHeader.NAME)).getAddress().toString());
        sipManCallback.fireCommunicationsError(new CommunicationsException("Failed to resend a request " + "after a security challenge!", exc));
    }
}
Also used : SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) ClientTransaction(javax.sip.ClientTransaction) SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) SipException(javax.sip.SipException) TransactionUnavailableException(javax.sip.TransactionUnavailableException)

Example 3 with SipSecurityException

use of net.java.sipmack.sip.security.SipSecurityException in project Spark by igniterealtime.

the class CallProcessing method processAuthenticationChallenge.

/**
 * Attempts to re-ogenerate the corresponding request with the proper
 * credentials and terminates the call if it fails.
 *
 * @param clientTransaction the corresponding transaction
 * @param response          the challenge
 */
void processAuthenticationChallenge(ClientTransaction clientTransaction, Response response) {
    try {
        ClientTransaction retryTran = sipManCallback.sipSecurityManager.handleChallenge(response, clientTransaction);
        // There is a new dialog that will be started with this request. Get
        // that dialog and record it into the Call objet for later use (by
        // Bye-s for example).
        Call call = callDispatcher.findCall(clientTransaction.getDialog());
        call.setDialog(retryTran.getDialog());
        call.setInitialRequest(retryTran.getRequest());
        retryTran.sendRequest();
    } catch (SipSecurityException exc) {
        callDispatcher.findCall(clientTransaction.getDialog()).setState(Call.FAILED);
        sipManCallback.fireCommunicationsError(new CommunicationsException("Authorization failed!", exc));
    } catch (Exception exc) {
        callDispatcher.findCall(clientTransaction.getDialog()).setState(Call.FAILED);
        sipManCallback.fireCommunicationsError(new CommunicationsException("Failed to resend a request " + "after a security challenge!", exc));
    }
}
Also used : SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) ClientTransaction(javax.sip.ClientTransaction) SipSecurityException(net.java.sipmack.sip.security.SipSecurityException) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) SipException(javax.sip.SipException) TransactionUnavailableException(javax.sip.TransactionUnavailableException)

Aggregations

ParseException (java.text.ParseException)3 ClientTransaction (javax.sip.ClientTransaction)3 InvalidArgumentException (javax.sip.InvalidArgumentException)3 SipException (javax.sip.SipException)3 TransactionUnavailableException (javax.sip.TransactionUnavailableException)3 SipSecurityException (net.java.sipmack.sip.security.SipSecurityException)3 CommunicationsException (net.java.sipmack.sip.CommunicationsException)1