use of gov.nist.javax.sip.ResponseEventExt in project jain-sip.ha by RestComm.
the class SimpleB2BUAHandler method process200.
public void process200(ResponseEvent responseEvent) {
boolean isRetransmission = ((ResponseEventExt) responseEvent).isRetransmission();
ClientTransaction clientTransaction = ((ResponseEventExt) responseEvent).getClientTransaction();
((ClusteredSipStack) sipStack).getStackLogger().logDebug("clientTransaction = " + clientTransaction + ", isRetransmission " + isRetransmission);
try {
final CSeqHeader cSeqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
if (cSeqHeader.getMethod().equals(Request.INVITE)) {
processInvite200(responseEvent, cSeqHeader);
} else if (cSeqHeader.getMethod().equals(Request.BYE) || cSeqHeader.getMethod().equals(Request.SUBSCRIBE) || cSeqHeader.getMethod().equals(Request.NOTIFY)) {
processBye200(responseEvent);
} else {
System.err.println("Unexpected response: " + responseEvent.getResponse());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of gov.nist.javax.sip.ResponseEventExt in project jain-sip.ha by RestComm.
the class SimpleStatefulProxy method processInvite200.
/**
* @param responseEvent
* @throws SipException
* @throws InvalidArgumentException
*/
private void processInvite200(ResponseEvent responseEvent, CSeqHeader cseq) throws InvalidArgumentException, SipException {
// lets ack it ourselves to avoid UAS retransmissions due to
// forwarding of this response and further UAC Ack
// note that the app does not handles UAC ACKs
// String outgoingDialogId = responseEvent.getDialog().getDialogId();
int remotePort = ((ResponseEventExt) responseEvent).getRemotePort();
if (ListeningPoint.TCP.equalsIgnoreCase(transport)) {
remotePort = ((MessageExt) responseEvent.getResponse()).getTopmostViaHeader().getPort();
}
((ClusteredSipStack) sipStack).getStackLogger().logDebug("remotePort = " + remotePort);
// if(remotePort == 5065 || remotePort == 5081) {
// storeOutgoingDialogId(outgoingDialogId);
// }
// if(myPort == 5080 && getOutgoingDialogId() == null) {
// storeOutgoingDialogId(outgoingDialogId);
// }
forwardResponse(responseEvent.getResponse());
}
use of gov.nist.javax.sip.ResponseEventExt in project jain-sip.ha by RestComm.
the class SimpleB2BUAHandler method processInvite200.
/**
* @param responseEvent
* @throws SipException
* @throws InvalidArgumentException
*/
private void processInvite200(ResponseEvent responseEvent, CSeqHeader cseq) throws InvalidArgumentException, SipException {
// lets ack it ourselves to avoid UAS retransmissions due to
// forwarding of this response and further UAC Ack
// note that the app does not handles UAC ACKs
String outgoingDialogId = responseEvent.getDialog().getDialogId();
int remotePort = ((ResponseEventExt) responseEvent).getRemotePort();
if (ListeningPoint.TCP.equalsIgnoreCase(transport)) {
remotePort = ((MessageExt) responseEvent.getResponse()).getTopmostViaHeader().getPort();
}
((ClusteredSipStack) sipStack).getStackLogger().logDebug("remotePort = " + remotePort);
if (remotePort == 5065 || remotePort == 5081) {
storeOutgoingDialogId(outgoingDialogId);
}
if (myPort == 5080 && getOutgoingDialogId() == null) {
storeOutgoingDialogId(outgoingDialogId);
}
if (sendAckOn2xx) {
System.out.println("Generating ACK to 200");
final Request ack = responseEvent.getDialog().createAck(cseq.getSeqNumber());
responseEvent.getDialog().sendAck(ack);
}
forwardResponse(responseEvent.getResponse());
}
use of gov.nist.javax.sip.ResponseEventExt in project jain-sip.ha by RestComm.
the class SimpleStatefulProxy method process200.
public void process200(ResponseEvent responseEvent) {
try {
boolean isRetransmission = ((ResponseEventExt) responseEvent).isRetransmission();
ClientTransaction clientTransaction = ((ResponseEventExt) responseEvent).getClientTransaction();
((ClusteredSipStack) sipStack).getStackLogger().logDebug("clientTransaction = " + clientTransaction + ", isRetransmission " + isRetransmission);
final CSeqHeader cSeqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
if (cSeqHeader.getMethod().equals(Request.INVITE)) {
processInvite200(responseEvent, cSeqHeader);
} else if (cSeqHeader.getMethod().equals(Request.BYE) || cSeqHeader.getMethod().equals(Request.SUBSCRIBE) || cSeqHeader.getMethod().equals(Request.NOTIFY)) {
processBye200(responseEvent);
} else {
System.err.println("Unexpected response: " + responseEvent.getResponse());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of gov.nist.javax.sip.ResponseEventExt in project jain-sip.ha by RestComm.
the class SimpleB2BUA method processResponse.
public void processResponse(ResponseEvent responseEvent) {
Dialog dialog = responseEvent.getDialog();
if (dialog != null) {
System.out.println("dialog is " + dialog.getDialogId() + " for response " + responseEvent.getResponse());
if (((ResponseEventExt) responseEvent).isRetransmission()) {
// retransmission, drop it
System.out.println("dropping retransmission for response " + responseEvent.getResponse() + "on dialog " + dialog.getDialogId());
return;
}
if (b2buaHandler != null) {
switch(responseEvent.getResponse().getStatusCode()) {
case 100:
// ignore
break;
case 180:
b2buaHandler.process180(responseEvent);
break;
case 200:
b2buaHandler.process200(responseEvent);
break;
case 202:
b2buaHandler.process200(responseEvent);
break;
default:
System.err.println("Received unexpected sip response: " + responseEvent.getResponse());
dialog.setApplicationData(null);
break;
}
} else {
((SipStackImpl) sipStack).getStackLogger().logError("Received response on dialog with id that does not matches a active call: " + responseEvent.getResponse());
}
} else {
((SipStackImpl) sipStack).getStackLogger().logError("Received response without dialog: " + responseEvent.getResponse());
}
}
Aggregations