code: public int getRemotePort() {
  		int port = -1;
  
  		if(getTransaction() != null) {
  			if(((SIPTransaction)getTransaction()).getPeerPacketSourceAddress() != null) {
  				port = ((SIPTransaction)getTransaction()).getPeerPacketSourcePort();
  			} else {
  				port = ((SIPTransaction)getTransaction()).getPeerPort();
  			}
  		} else {
  			ViaHeader via = (ViaHeader) message.getHeader(ViaHeader.NAME);
  			// https://code.google.com/p/sipservlets/issues/detail?id=137
              boolean isExternal = sipFactoryImpl.getSipApplicationDispatcher().isViaHeaderExternal(via);
              if(message instanceof Request && !isExternal) {
                  // locally generated messages should return -1 as per Javadoc
                  return -1;
              }
  			if(via != null) {
  				port = via.getPort();
  			}
  		}
  		if(port<=0) {
  			return 5060;
  		}
  		else {
  			return port;
  		}
  	}
docs: /*
  (non-Javadoc)
  @see javax.servlet.sip.SipServletMessage#getRemotePort()