Search in sources :

Example 11 with Request

use of javax.sip.message.Request in project XobotOS by xamarin.

the class SipHelper method sendRinging.

/**
     * @param event the INVITE request event
     */
public ServerTransaction sendRinging(RequestEvent event, String tag) throws SipException {
    try {
        Request request = event.getRequest();
        ServerTransaction transaction = getServerTransaction(event);
        Response response = mMessageFactory.createResponse(Response.RINGING, request);
        ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
        toHeader.setTag(tag);
        response.addHeader(toHeader);
        if (DEBUG)
            Log.d(TAG, "send RINGING: " + response);
        transaction.sendResponse(response);
        return transaction;
    } catch (ParseException e) {
        throw new SipException("sendRinging()", e);
    }
}
Also used : Response(javax.sip.message.Response) Request(javax.sip.message.Request) ToHeader(javax.sip.header.ToHeader) ParseException(java.text.ParseException) ServerTransaction(javax.sip.ServerTransaction) SipException(javax.sip.SipException)

Example 12 with Request

use of javax.sip.message.Request in project XobotOS by xamarin.

the class SipHelper method sendInviteBusyHere.

public void sendInviteBusyHere(RequestEvent event, ServerTransaction inviteTransaction) throws SipException {
    try {
        Request request = event.getRequest();
        Response response = mMessageFactory.createResponse(Response.BUSY_HERE, request);
        if (inviteTransaction == null) {
            inviteTransaction = getServerTransaction(event);
        }
        if (inviteTransaction.getState() != TransactionState.COMPLETED) {
            if (DEBUG)
                Log.d(TAG, "send BUSY HERE: " + response);
            inviteTransaction.sendResponse(response);
        }
    } catch (ParseException e) {
        throw new SipException("sendInviteBusyHere()", e);
    }
}
Also used : Response(javax.sip.message.Response) Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 13 with Request

use of javax.sip.message.Request in project XobotOS by xamarin.

the class SipHelper method sendResponse.

public void sendResponse(RequestEvent event, int responseCode) throws SipException {
    try {
        Request request = event.getRequest();
        Response response = mMessageFactory.createResponse(responseCode, request);
        if (DEBUG && (!Request.OPTIONS.equals(request.getMethod()) || DEBUG_PING)) {
            Log.d(TAG, "send response: " + response);
        }
        getServerTransaction(event).sendResponse(response);
    } catch (ParseException e) {
        throw new SipException("sendResponse()", e);
    }
}
Also used : Response(javax.sip.message.Response) Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 14 with Request

use of javax.sip.message.Request in project XobotOS by xamarin.

the class SipHelper method sendReferNotify.

public void sendReferNotify(Dialog dialog, String content) throws SipException {
    try {
        Request request = dialog.createRequest(Request.NOTIFY);
        request.addHeader(mHeaderFactory.createSubscriptionStateHeader("active;expires=60"));
        // set content here
        request.setContent(content, mHeaderFactory.createContentTypeHeader("message", "sipfrag"));
        request.addHeader(mHeaderFactory.createEventHeader(ReferencesHeader.REFER));
        if (DEBUG)
            Log.d(TAG, "send NOTIFY: " + request);
        dialog.sendRequest(mSipProvider.getNewClientTransaction(request));
    } catch (ParseException e) {
        throw new SipException("sendReferNotify()", e);
    }
}
Also used : Request(javax.sip.message.Request) ParseException(java.text.ParseException) SipException(javax.sip.SipException)

Example 15 with Request

use of javax.sip.message.Request in project XobotOS by xamarin.

the class SipHelper method sendOptions.

public ClientTransaction sendOptions(SipProfile caller, SipProfile callee, String tag) throws SipException {
    try {
        Request request = (caller == callee) ? createRequest(Request.OPTIONS, caller, tag) : createRequest(Request.OPTIONS, caller, callee, tag);
        ClientTransaction clientTransaction = mSipProvider.getNewClientTransaction(request);
        clientTransaction.sendRequest();
        return clientTransaction;
    } catch (Exception e) {
        throw new SipException("sendOptions()", e);
    }
}
Also used : ClientTransaction(javax.sip.ClientTransaction) Request(javax.sip.message.Request) SipException(javax.sip.SipException) TransactionAlreadyExistsException(javax.sip.TransactionAlreadyExistsException) InvalidArgumentException(javax.sip.InvalidArgumentException) ParseException(java.text.ParseException) PeerUnavailableException(javax.sip.PeerUnavailableException) SipException(javax.sip.SipException) TransactionUnavailableException(javax.sip.TransactionUnavailableException)

Aggregations

Request (javax.sip.message.Request)38 ParseException (java.text.ParseException)21 SipException (javax.sip.SipException)21 InvalidArgumentException (javax.sip.InvalidArgumentException)13 ClientTransaction (javax.sip.ClientTransaction)9 SipURI (javax.sip.address.SipURI)9 Response (javax.sip.message.Response)9 NotFoundException (org.jivesoftware.util.NotFoundException)7 TooManyListenersException (java.util.TooManyListenersException)6 ServerTransaction (javax.sip.ServerTransaction)6 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)6 Address (javax.sip.address.Address)5 CSeqHeader (javax.sip.header.CSeqHeader)5 ViaHeader (javax.sip.header.ViaHeader)5 SIPRequest (gov.nist.javax.sip.message.SIPRequest)4 FromHeader (javax.sip.header.FromHeader)4 SubscriptionStateHeader (javax.sip.header.SubscriptionStateHeader)4 ToHeader (javax.sip.header.ToHeader)4 SIPClientTransaction (gov.nist.javax.sip.stack.SIPClientTransaction)3 IOException (java.io.IOException)3