Esempio n. 1
0
  /**
   * {@inheritDoc}
   *
   * <p>Very basic way of framing a sip message. It makes a lot of assumption but in the framing
   * phase we are, well, just framing.
   */
  @Override
  public SipPacket frame(final TransportPacket parent, final Buffer buffer) throws IOException {

    if (parent == null) {
      throw new IllegalArgumentException("The parent frame cannot be null");
    }

    final SipMessage sip = SipParser.frame(buffer);
    if (sip.isRequest()) {
      return new SipRequestPacketImpl(parent, sip.toRequest());
    }

    return new SipResponsePacketImpl(parent, sip.toResponse());
  }
Esempio n. 2
0
 /**
  * @param buffer
  * @return
  * @throws IOException
  */
 static SipMessage frame(final String buffer) throws SipParseException, IOException {
   assertNotEmpty(buffer, "Buffer cannot be null or the empty string");
   return SipParser.frame(Buffers.wrap(buffer));
 }
Esempio n. 3
0
 static SipMessage frame(final byte[] buffer) throws SipParseException, IOException {
   assertNotNull(buffer, "Byte-array cannot be null");
   return SipParser.frame(Buffers.wrap(buffer));
 }
Esempio n. 4
0
 /**
  * Frame the supplied buffer into a {@link SipMessage}. No deep analysis of the message will be
  * performed so there is no guarantee that this {@link SipMessage} is actually a well formed
  * message.
  *
  * @param buffer
  * @return the framed {@link SipMessage}
  */
 static SipMessage frame(final Buffer buffer) throws SipParseException, IOException {
   assertNotNull(buffer);
   return SipParser.frame(buffer);
 }