/** When the TransactionClient goes into the "Completed" state receiving a 300-699 response */ public void onTransFailureResponse(TransactionClient tc, Message msg) { // SESCA // Autentikointi String method = tc.getTransactionMethod(); StatusLine status_line = msg.getStatusLine(); int code = status_line.getCode(); // AUTHENTICATION-BEGIN if ((code == 401 && msg.hasWwwAuthenticateHeader() && msg.getWwwAuthenticateHeader().getRealmParam().equalsIgnoreCase(user_profile.realm)) || (code == 407 && msg.hasProxyAuthenticateHeader() && msg.getProxyAuthenticateHeader() .getRealmParam() .equalsIgnoreCase(user_profile.realm))) { // req:ssa on cseq:ua kasvatettu Message req = tc.getRequestMessage(); req.setCSeqHeader(req.getCSeqHeader().incSequenceNumber()); WwwAuthenticateHeader wah; if (code == 401) wah = msg.getWwwAuthenticateHeader(); else wah = msg.getProxyAuthenticateHeader(); String qop_options = wah.getQopOptionsParam(); qop = (qop_options != null) ? "auth" : null; RequestLine rl = req.getRequestLine(); // SESCA // BUGI client ei saa lähettää qop:ia // DigestAuthentication digest=new // DigestAuthentication(rl.getMethod(),rl.getAddress().toString(),wah,qop,null,username,passwd); DigestAuthentication digest = new DigestAuthentication( rl.getMethod(), rl.getAddress().toString(), wah, null, null, user_profile.authID, user_profile.passwd); AuthorizationHeader ah; if (code == 401) ah = digest.getAuthorizationHeader(); else ah = digest.getProxyAuthorizationHeader(); req.setAuthorizationHeader(ah); // transactions.remove(tc.getTransactionId()); // SESCA // BUGI // Päivitetään invite_req:uun uusin invite-viesti. // Lähetämme uuden inviten, joten teemme uuden invitetransactionclientin, eikä transaction // clientia // if (method.equals(SipMethods.INVITE)) { // invite_req = req; // tc=new InviteTransactionClient(sip_provider,req,this); tc = new TransactionClient(sip_provider, req, this); // tc=new TransactionClient(sip_provider,req,this); // } // else { // tc=new TransactionClient(sip_provider,req,this); // } // transactions.put(tc.getTransactionId(),tc); tc.request(); } // AUTHENTICATION-END else onDeliveryFailure(tc, msg.getStatusLine().getReason()); }
/** When the TransactionClient goes into the "Completed" state receiving a 2xx response */ public void onTransSuccessResponse(TransactionClient tc, Message resp) { onDeliverySuccess(tc, resp.getStatusLine().getReason()); }