use of gov.nist.javax.sip.message.MessageExt in project jain-sip.ha by RestComm.
the class SimpleB2BUAHandler method processBye.
public void processBye(RequestEvent requestEvent) {
try {
int remotePort = ((RequestEventExt) requestEvent).getRemotePort();
if (ListeningPoint.TCP.equalsIgnoreCase(transport)) {
remotePort = ((MessageExt) requestEvent.getRequest()).getTopmostViaHeader().getPort();
}
((ClusteredSipStack) sipStack).getStackLogger().logDebug("remotePort = " + remotePort);
requestEvent.getServerTransaction().sendResponse(messageFactory.createResponse(200, requestEvent.getRequest()));
Dialog dialog = getOutgoingDialog();
if (remotePort == 5060 || remotePort == 5065) {
dialog = getIncomingDialog();
}
Request request = dialog.createRequest(Request.BYE);
final ClientTransaction ct = sipProvider.getNewClientTransaction(request);
dialog.sendRequest(ct);
} catch (Exception e) {
((SipStackImpl) sipStack).getStackLogger().logError("unexpected exception", e);
}
}
use of gov.nist.javax.sip.message.MessageExt 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.message.MessageExt in project jain-sip.ha by RestComm.
the class SimpleStatefulProxy method processAck.
public void processAck(RequestEvent requestEvent) {
int remotePort = ((RequestEventExt) requestEvent).getRemotePort();
if (ListeningPoint.TCP.equalsIgnoreCase(transport)) {
remotePort = ((MessageExt) requestEvent.getRequest()).getTopmostViaHeader().getPort();
}
((ClusteredSipStack) sipStack).getStackLogger().logDebug("remotePort = " + remotePort);
try {
final Request ack = (Request) requestEvent.getRequest().clone();
String branchId = getClientTransactionId();
ack.addHeader(headerFactory.createViaHeader(ipAddress, myPort, transport, branchId));
((SipURI) ack.getRequestURI()).setPort(getClientTransactionPort());
ack.removeLast(RouteHeader.NAME);
RouteHeader routeHeader = (RouteHeader) ack.getHeader(RouteHeader.NAME);
if (routeHeader != null && (((SipURI) routeHeader.getAddress().getURI()).getPort() == 5080 || ((SipURI) routeHeader.getAddress().getURI()).getPort() == 5081)) {
ack.removeFirst(RouteHeader.NAME);
}
sipProvider.sendRequest(ack);
} catch (Exception e) {
((SipStackImpl) sipStack).getStackLogger().logError("unexpected exception", e);
}
}
Aggregations