Package net.sourceforge.peers.sip.transport

Examples of net.sourceforge.peers.sip.transport.SipResponse


    //////////////////////////////////////////////////////////

    public void handleInitialInvite(SipRequest sipRequest) {
       
        //generate 180 Ringing
        SipResponse sipResponse = buildGenericResponse(sipRequest,
                RFC3261.CODE_180_RINGING, RFC3261.REASON_180_RINGING);
        Dialog dialog = buildDialogForUas(sipResponse, sipRequest);
        //here dialog is already stored in dialogs in DialogManager
       
        InviteServerTransaction inviteServerTransaction = (InviteServerTransaction)
View Full Code Here


            // TODO manage empty bodies and non-application/sdp content type
        }


        //TODO if mode autoanswer just send 200 without asking any question
        SipResponse sipResponse =
            RequestManager.generateResponse(
                    sipRequest,
                    dialog,
                    RFC3261.CODE_200_OK,
                    RFC3261.REASON_200_OK);

        // TODO 13.3 dialog invite-specific processing
       
        // TODO timer if there is an Expires header in INVITE
       
        // TODO 3xx
       
        // TODO 486 or 600
       
        byte[] offerBytes = sipRequest.getBody();
        SessionDescription answer;
        try {
            if (offerBytes != null && RFC3261.CONTENT_TYPE_SDP.equals(
                    contentType.getValue())) {
                // create response in 200
                try {
                    SessionDescription offer = sdpManager.parse(offerBytes);
                    answer = sdpManager.createSessionDescription(offer);
                    mediaDestination = sdpManager.getMediaDestination(offer);
                } catch (NoCodecException e) {
                    answer = sdpManager.createSessionDescription(null);
                }
            } else {
                // create offer in 200 (never tested...)
                answer = sdpManager.createSessionDescription(null);
            }
            sipResponse.setBody(answer.toString().getBytes());
        } catch (IOException e) {
            logger.error(e.getMessage(), e);
        }
       
        SipHeaders respHeaders = sipResponse.getSipHeaders();
        respHeaders.add(new SipHeaderFieldName(RFC3261.HDR_CONTENT_TYPE),
                new SipHeaderFieldValue(RFC3261.CONTENT_TYPE_SDP));
       
        ArrayList<String> routeSet = dialog.getRouteSet();
        if (routeSet != null) {
View Full Code Here

                new SipHeaderFieldName(RFC3261.HDR_CALLID));
       
        Dialog dialog = dialogManager.getDialog(callId.getValue());
       
        //TODO manage auto reject Do not disturb (DND)
        SipResponse sipResponse =
            RequestManager.generateResponse(
                    sipRequest,
                    dialog,
                    RFC3261.CODE_486_BUSYHERE,
                    RFC3261.REASON_486_BUSYHERE);
View Full Code Here

   
    @Override
    public void received200To699() {
        NonInviteClientTransactionState nextState = nonInviteClientTransaction.COMPLETED;
        nonInviteClientTransaction.setState(nextState);
        SipResponse response = nonInviteClientTransaction.getLastResponse();
        int code = response.getStatusCode();
        if (code < RFC3261.CODE_MIN_REDIR) {
            nonInviteClientTransaction.transactionUser.successResponseReceived(
                    response, nonInviteClientTransaction);
        } else {
            nonInviteClientTransaction.transactionUser.errResponseReceived(
View Full Code Here

   
    @Override
    public void received200To699() {
        NonInviteClientTransactionState nextState = nonInviteClientTransaction.COMPLETED;
        nonInviteClientTransaction.setState(nextState);
        SipResponse response = nonInviteClientTransaction.getLastResponse();
        int code = response.getStatusCode();
        if (code < RFC3261.CODE_MIN_REDIR) {
            nonInviteClientTransaction.transactionUser.successResponseReceived(
                    response, nonInviteClientTransaction);
        } else {
            nonInviteClientTransaction.transactionUser.errResponseReceived(
View Full Code Here

        StringBuffer buf = new StringBuffer();
        for (int i = 2; i < params.length; ++i) {
            buf.append(params[i]).append(" ");
        }
        buf.deleteCharAt(buf.length() - 1);
        return new SipResponse(Integer.parseInt(params[1]), buf.toString());
    }
View Full Code Here

        String message = "SIP/2.0 200 OK\r\n" +
                "From: sip:alice@atlanta.com;tag=abc\r\n" +
                "To: Bob <sip:bob@biloxi.com>;tag=345\r\n" +
                "Call-ID: lijr345lkj3@somehost\r\n" +
                "\r\n";
        SipResponse sipResponse = (SipResponse)parse(message);
        Dialog dialog = dialogManager.createDialog(sipResponse);
        assert dialog != null;
        assert "lijr345lkj3@somehost".equals(dialog.getCallId());
        assert "abc".equals(dialog.getRemoteTag());
        assert "345".equals(dialog.getLocalTag());
View Full Code Here

                "From: sip:alice@atlanta.com;tag=abc\r\n" +
                "To: Bob <sip:bob@biloxi.com>;tag=345\r\n" +
                "Call-ID: lijr345lkj3@somehost\r\n" +
                "Via: SIP/2.0/UDP 192.2.4.2;branch=23456SG/\r\n" +
                "\r\n";
        SipResponse sipResponse = (SipResponse)parse(message);
        Dialog dialog = dialogManager.createDialog(sipResponse);
        assert dialog != null;
        assert "lijr345lkj3@somehost".equals(dialog.getCallId());
        assert "345".equals(dialog.getRemoteTag());
        assert "abc".equals(dialog.getLocalTag());
View Full Code Here

        SipRequest sipRequest = (SipRequest)parse(message);
        String response = "SIP/2.0 200 OK\r\n" +
                "Via: \r\n" +
                "CSeq: 1\r\n" +
                "\r\n";
        SipResponse sipResponse = (SipResponse)parse(response);
        ServerTransactionUser serverTransactionUser =
            new ServerTransactionUser() {
                public void transactionFailure() {
                }
            };
View Full Code Here

        SipRequest sipRequest = (SipRequest)parse(message);
        String response = "SIP/2.0 200 OK\r\n" +
                "Via: \r\n" +
                "CSeq: 1 INVITE\r\n" +
                "\r\n";
        SipResponse sipResponse = (SipResponse)parse(response);
        ServerTransactionUser serverTransactionUser =
            new ServerTransactionUser() {
                public void transactionFailure() {
                }
            };
View Full Code Here

TOP

Related Classes of net.sourceforge.peers.sip.transport.SipResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.