コード例 #1
0
  /**
   * Constructor. We create one of these in order to process an incoming message.
   *
   * @param stack is the SIP sipStack.
   * @param messageProcessor is the creating message processor.
   * @param packet is the incoming datagram packet.
   */
  protected UDPMessageChannel(
      SIPTransactionStack stack, UDPMessageProcessor messageProcessor, DatagramPacket packet) {

    this.incomingPacket = packet;
    super.messageProcessor = messageProcessor;
    this.sipStack = stack;

    // jeand : Create a new string message parser to parse the list of messages.
    myParser = sipStack.getMessageParserFactory().createMessageParser(sipStack);

    this.myAddress = messageProcessor.getIpAddress().getHostAddress();
    this.myPort = messageProcessor.getPort();
    mythread = new Thread(this);
    mythread.setDaemon(true);

    mythread.start();
  }
コード例 #2
0
  /**
   * Constructor. We create one of these when we send out a message.
   *
   * @param targetAddr INET address of the place where we want to send messages.
   * @param port target port (where we want to send the message).
   * @param sipStack our SIP Stack.
   */
  protected UDPMessageChannel(
      InetAddress targetAddr,
      int port,
      SIPTransactionStack sipStack,
      UDPMessageProcessor messageProcessor) {
    peerAddress = targetAddr;
    peerPort = port;
    peerProtocol = "UDP";
    super.messageProcessor = messageProcessor;
    this.myAddress = messageProcessor.getIpAddress().getHostAddress();
    this.myPort = messageProcessor.getPort();
    this.sipStack = sipStack;
    // jeand : Create a new string message parser to parse the list of messages.
    myParser = sipStack.getMessageParserFactory().createMessageParser(sipStack);

    if (sipStack.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
      this.sipStack
          .getStackLogger()
          .logDebug("Creating message channel " + targetAddr.getHostAddress() + "/" + port);
    }
  }