Search in sources :

Example 31 with InvalidArgumentException

use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.

the class HeaderFactoryImpl method createContentLengthHeader.

/**
     * Creates a new CSeqHeader based on the newly supplied contentLength value.
     *
     * @param contentLength - the new integer value of the contentLength.
     * @throws InvalidArgumentException if supplied contentLength is less
     * than zero.
     * @return the newly created ContentLengthHeader object.
     */
public ContentLengthHeader createContentLengthHeader(int contentLength) throws InvalidArgumentException {
    if (contentLength < 0)
        throw new InvalidArgumentException("bad contentLength");
    ContentLength c = new ContentLength();
    c.setContentLength(contentLength);
    return c;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 32 with InvalidArgumentException

use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.

the class HeaderFactoryImpl method createRetryAfterHeader.

/**
     * Creates a new RetryAfterHeader based on the newly supplied retryAfter
     * value.
     *
     * @param retryAfter - the new integer value of the retryAfter.
     * @throws InvalidArgumentException if supplied retryAfter is less
     * than zero.
     * @return the newly created RetryAfterHeader object.
     */
public RetryAfterHeader createRetryAfterHeader(int retryAfter) throws InvalidArgumentException {
    if (retryAfter < 0)
        throw new InvalidArgumentException("bad retryAfter arg");
    RetryAfter r = new RetryAfter();
    r.setRetryAfter(retryAfter);
    return r;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 33 with InvalidArgumentException

use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.

the class HeaderFactoryImpl method createRAckHeader.

/**
     * Creates a new RAckHeader based on the newly supplied rSeqNumber,
     * cSeqNumber and method values.
     *
     * @param rSeqNumber - the new integer value of the rSeqNumber.
     * @param cSeqNumber - the new integer value of the cSeqNumber.
     * @param method - the new string value of the method.
     * @throws InvalidArgumentException if supplied rSeqNumber or cSeqNumber is
     * less than zero or greater than than 2**31-1.
     * @throws ParseException which signals that an error has been reached
     * unexpectedly while parsing the method value.
     * @return the newly created RAckHeader object.
     * @since v1.1
     */
public RAckHeader createRAckHeader(long rSeqNumber, long cSeqNumber, String method) throws InvalidArgumentException, ParseException {
    if (method == null)
        throw new NullPointerException("Bad method");
    if (cSeqNumber < 0 || rSeqNumber < 0)
        throw new InvalidArgumentException("bad cseq/rseq arg");
    RAck rack = new RAck();
    rack.setMethod(method);
    rack.setCSequenceNumber(cSeqNumber);
    rack.setRSequenceNumber(rSeqNumber);
    return rack;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 34 with InvalidArgumentException

use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.

the class TimeStamp method setTime.

public void setTime(long timeStamp) throws InvalidArgumentException {
    if (timeStamp < -1)
        throw new InvalidArgumentException("Illegal timestamp");
    this.timeStamp = timeStamp;
    this.timeStampFloat = -1;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 35 with InvalidArgumentException

use of javax.sip.InvalidArgumentException in project XobotOS by xamarin.

the class MessageProcessor method getViaHeader.

/**
     * Get the Via header to assign for this message processor. The topmost via
     * header of the outoging messages use this.
     *
     * @return the ViaHeader to be used by the messages sent via this message processor.
     */
public Via getViaHeader() {
    try {
        Via via = new Via();
        if (this.sentByHostPort != null) {
            via.setSentBy(sentByHostPort);
            via.setTransport(this.getTransport());
        } else {
            Host host = new Host();
            host.setHostname(this.getIpAddress().getHostAddress());
            via.setHost(host);
            via.setPort(this.getPort());
            via.setTransport(this.getTransport());
        }
        return via;
    } catch (ParseException ex) {
        ex.printStackTrace();
        return null;
    } catch (InvalidArgumentException ex) {
        ex.printStackTrace();
        return null;
    }
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException) Host(gov.nist.core.Host) ParseException(java.text.ParseException) Via(gov.nist.javax.sip.header.Via)

Aggregations

InvalidArgumentException (javax.sip.InvalidArgumentException)38 ParseException (java.text.ParseException)10 IOException (java.io.IOException)9 SipException (javax.sip.SipException)9 SipURI (javax.sip.address.SipURI)7 SIPRequest (gov.nist.javax.sip.message.SIPRequest)6 Via (gov.nist.javax.sip.header.Via)5 From (gov.nist.javax.sip.header.From)4 To (gov.nist.javax.sip.header.To)4 DialogDoesNotExistException (javax.sip.DialogDoesNotExistException)4 ObjectInUseException (javax.sip.ObjectInUseException)4 TransactionDoesNotExistException (javax.sip.TransactionDoesNotExistException)4 CSeq (gov.nist.javax.sip.header.CSeq)3 ClientTransaction (javax.sip.ClientTransaction)3 Hop (javax.sip.address.Hop)3 Request (javax.sip.message.Request)3 ListeningPointImpl (gov.nist.javax.sip.ListeningPointImpl)2 MaxForwards (gov.nist.javax.sip.header.MaxForwards)2 SIPHeader (gov.nist.javax.sip.header.SIPHeader)2 TimeStamp (gov.nist.javax.sip.header.TimeStamp)2