Search in sources :

Example 11 with InvalidArgumentException

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

the class HeaderFactoryImpl method createSessionExpiresHeader.

/**
     * Creates a new SessionExpiresHeader based on the newly supplied expires value.
     *
     * @param expires - the new integer value of the expires.
     * @throws InvalidArgumentException if supplied expires is less
     * than zero.
     * @return the newly created SessionExpiresHeader object.
     *
     */
public SessionExpiresHeader createSessionExpiresHeader(int expires) throws InvalidArgumentException {
    if (expires < 0)
        throw new InvalidArgumentException("bad value " + expires);
    SessionExpires s = new SessionExpires();
    s.setExpires(expires);
    return s;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 12 with InvalidArgumentException

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

the class HeaderFactoryImpl method createPMediaAuthorizationHeader.

/**
     * P-Media-Authorization header
     * @param token - token string
     * @return newly created P-Media-Authorizarion header
     * @throws InvalidArgumentException
     * @throws ParseException
     */
public PMediaAuthorizationHeader createPMediaAuthorizationHeader(String token) throws InvalidArgumentException, ParseException {
    if (token == null || token == "")
        throw new InvalidArgumentException("The Media-Authorization-Token parameter is null or empty");
    PMediaAuthorization mediaAuthorization = new PMediaAuthorization();
    mediaAuthorization.setMediaAuthorizationToken(token);
    return mediaAuthorization;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 13 with InvalidArgumentException

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

the class HeaderFactoryImpl method createExpiresHeader.

/**
     * Creates a new ExpiresHeader based on the newly supplied expires value.
     *
     * @param expires - the new integer value of the expires.
     * @throws InvalidArgumentException if supplied expires is less
     * than zero.
     * @return the newly created ExpiresHeader object.
     */
public ExpiresHeader createExpiresHeader(int expires) throws InvalidArgumentException {
    if (expires < 0)
        throw new InvalidArgumentException("bad value " + expires);
    Expires e = new Expires();
    e.setExpires(expires);
    return e;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 14 with InvalidArgumentException

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

the class HeaderFactoryImpl method createMaxForwardsHeader.

/**
    * Creates a new MaxForwardsHeader based on the newly
    * supplied maxForwards value.
    *
    * @param maxForwards The new integer value of the maxForwards.
    * @throws InvalidArgumentException if supplied maxForwards is less
    * than zero or greater than 255.
    * @return the newly created MaxForwardsHeader object.
    */
public MaxForwardsHeader createMaxForwardsHeader(int maxForwards) throws InvalidArgumentException {
    if (maxForwards < 0 || maxForwards > 255)
        throw new InvalidArgumentException("bad maxForwards arg " + maxForwards);
    MaxForwards m = new MaxForwards();
    m.setMaxForwards(maxForwards);
    return m;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

Example 15 with InvalidArgumentException

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

the class HeaderFactoryImpl method createCSeqHeader.

/**
     * Creates a new CSeqHeader based on the newly supplied sequence number and
     * method values.
     *
     * @param sequenceNumber - the new integer value of the sequence number.
     * @param method - the new string value of the method.
     * @throws InvalidArgumentException if supplied sequence number is less
     * than zero.
     * @throws ParseException which signals that an error has been reached
     * unexpectedly while parsing the method value.
     * @return the newly created CSeqHeader object.
     */
public CSeqHeader createCSeqHeader(long sequenceNumber, String method) throws ParseException, InvalidArgumentException {
    if (sequenceNumber < 0)
        throw new InvalidArgumentException("bad arg " + sequenceNumber);
    if (method == null)
        throw new NullPointerException("null arg method");
    CSeq cseq = new CSeq();
    cseq.setMethod(method);
    cseq.setSeqNumber(sequenceNumber);
    return cseq;
}
Also used : InvalidArgumentException(javax.sip.InvalidArgumentException)

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