当前位置: 首页>>代码示例>>Java>>正文


Java RequestEvent.getSource方法代码示例

本文整理汇总了Java中javax.sip.RequestEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java RequestEvent.getSource方法的具体用法?Java RequestEvent.getSource怎么用?Java RequestEvent.getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sip.RequestEvent的用法示例。


在下文中一共展示了RequestEvent.getSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processBye

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    Dialog dialog = requestEvent.getDialog();
    logger.info("shootme: local party = " + dialog.getLocalParty());
    try {
        logger.info("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootme: Dialog State is "
                + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        logger.error("UNexpected exception",ex);
        fail("UNexpected exception");

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:ClientTransactionCallingAlertTest.java

示例2: processAck

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the ACK request. Send the bye and complete the call flow.
 */
public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    try {
        // System.out.println("*** shootme: got an ACK "
        // + requestEvent.getRequest());
        if (serverTransaction == null) {
            System.out.println("null server transaction -- ignoring the ACK!");
            return;
        }
        Dialog dialog = serverTransaction.getDialog();

        System.out.println("Dialog Created = " + dialog.getDialogId() + " Dialog State = " + dialog.getState());

        System.out.println("Waiting for INFO");

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process ACK", ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例3: processInvite

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the invite request.
 */
public void processInvite(RequestEvent requestEvent, ServerTransaction serverTransaction) {
    try {
        // System.out.println("ProcessInvite");
        Request request = requestEvent.getRequest();
        SipProvider sipProvider = (SipProvider) requestEvent.getSource();
        // Note you need to create the Server Transaction
        // before the listener returns but you can delay sending the
        // response

        ServerTransaction st = sipProvider.getNewServerTransaction(request);

        TTask ttask = new TTask(requestEvent, st);
        int ttime = 100;

        new Timer().schedule(ttask, ttime);
    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process INVITE", ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例4: processBye

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    Dialog dialog = requestEvent.getDialog();
    System.out.println("local party = " + dialog.getLocalParty());
    try {
        System.out.println("shootme:  got a bye sending OK.");
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("Dialog State is "
                + serverTransactionId.getDialog().getState());

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:ShootmeNotImplementingListener.java

示例5: processAck

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the ACK request. Send the bye and complete the call flow.
 */
public void processAck(RequestEvent requestEvent,
		ServerTransaction serverTransaction) {
	try {
		this.ackReceived = true;
		System.out.println("Got an ACK! ");
		System.out.println("Dialog State = " + dialog.getState());
		SipProvider provider = (SipProvider) requestEvent.getSource();

		Request messageRequest = dialog.createRequest(Request.MESSAGE);
		CSeqHeader cseq = (CSeqHeader)messageRequest.getHeader(CSeqHeader.NAME);

		// We will test if the CSEq validation is off by sending CSeq 1 again

		ClientTransaction ct = provider
				.getNewClientTransaction(messageRequest);
		cseq.setSeqNumber(1);
		ct.sendRequest();

	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:WebsocketSelfTest.java

示例6: processAck

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the ACK request. Send the bye and complete the call flow.
 */
public void processAck(RequestEvent requestEvent,
        ServerTransaction serverTransaction) {
    acks++;
    // We will wait for 5 acks to test if retransmissions are filtered. With loose dialog
    // validation the ACK retransmissions are not filtered by the stack.
    if(acks == 5)
    {
        try {
            System.out.println("shootme: got an ACK! ");
            System.out.println("Dialog State = " + dialog.getState());
            SipProvider provider = (SipProvider) requestEvent.getSource();

            Request messageRequest = dialog.createRequest(Request.MESSAGE);
            CSeqHeader cseq = (CSeqHeader)messageRequest.getHeader(CSeqHeader.NAME);

            // We will test if the CSEq validation is off by sending CSeq 1 again

            ClientTransaction ct = provider
            .getNewClientTransaction(messageRequest);
            cseq.setSeqNumber(1);
            ct.sendRequest();

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:32,代码来源:SIPMessageValveTest.java

示例7: processRequest

import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
    try {
        Request request = requestEvent.getRequest();
        SipProvider sipProvider = (SipProvider) requestEvent.getSource();
        this.inviteServerTxProvider = sipProvider;
        if (request.getMethod().equals(Request.INVITE)) {

            ListeningPoint lp = sipProvider.getListeningPoint(transport);
            String host = lp.getIPAddress();
            int port = lp.getPort();

            ServerTransaction st = null;
            if (requestEvent.getServerTransaction() == null) {
                st = sipProvider.getNewServerTransaction(request);

            }
            
            for ( int i = 0; i < ntargets; i++ ) {
                this.sendTo(st,request,5080 + i);
            }

         
           

        } else {
            // Remove the topmost route header
            // The route header will make sure it gets to the right place.
            logger.info("proxy: Got a request " + request.getMethod());
            Request newRequest = (Request) request.clone();
            newRequest.removeFirst(RouteHeader.NAME);
            sipProvider.sendRequest(newRequest);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:40,代码来源:Proxy.java

示例8: processInvite

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the invite request.
 */
public void processInvite(RequestEvent requestEvent,
        ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    logger.info("Got an INVITE  " + request);
    timer.schedule(new DelayedInviteResponsesTask(requestEvent, sipProvider), 100);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:11,代码来源:ReconnectTCPTest.java

示例9: processRequest

import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
    Request request = requestEvent.getRequest();
    ServerTransaction serverTransactionId = requestEvent
            .getServerTransaction();

    logger.info("\n\nRequest " + request.getMethod()
            + " received at " + sipStack.getStackName()
            + " with server transaction id " + serverTransactionId);

    if (request.getMethod().equals(Request.INVITE)) {
        processInvite(requestEvent, serverTransactionId);
    } else if (request.getMethod().equals(Request.ACK)) {
        processAck(requestEvent, serverTransactionId);
    } else if (request.getMethod().equals(Request.BYE)) {
        processBye(requestEvent, serverTransactionId);
    } else if (request.getMethod().equals(Request.CANCEL)) {
        processCancel(requestEvent, serverTransactionId);
    } else {
        try {
            serverTransactionId.sendResponse(messageFactory
                    .createResponse(202, request));

            // send one back
            SipProvider prov = (SipProvider) requestEvent.getSource();
            Request refer = requestEvent.getDialog().createRequest(
                    "REFER");
            requestEvent.getDialog().sendRequest(
                    prov.getNewClientTransaction(refer));

        } catch (Exception e) {
            fail("Unexpected exception");
        }
    }

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:36,代码来源:ServerTransactionRetransmissionTimerTest.java

示例10: sendInviteOK

import javax.sip.RequestEvent; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
    try {
        logger.info("sendInviteOK: " + inviteTid);
        if (inviteTid.getState() != TransactionState.COMPLETED) {
            logger.info("shootme: Dialog state before OK: "
                    + inviteTid.getDialog().getState());

            SipProvider sipProvider = (SipProvider) requestEvent.getSource();
            Request request = requestEvent.getRequest();
            Response okResponse = messageFactory.createResponse(Response.OK,
                    request);
                ListeningPoint lp = sipProvider.getListeningPoint(transport);
            int myPort = lp.getPort();


            ((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);


            Address address = addressFactory.createAddress("Shootme <sip:"
                    + myAddress + ":" + myPort + ">");
            ContactHeader contactHeader = headerFactory
                    .createContactHeader(address);
            okResponse.addHeader(contactHeader);
            inviteTid.sendResponse(okResponse);
            logger.info("shootme: Dialog state after OK: "
                    + inviteTid.getDialog().getState());
            TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
        } else {
            logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:35,代码来源:Shootme.java

示例11: processCancel

import javax.sip.RequestEvent; //导入方法依赖的package包/类
public void processCancel(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    Request request = requestEvent.getRequest();
    SipProvider sipProvider = (SipProvider)requestEvent.getSource();
    try {
        logger.info("shootme:  got a cancel. " );
        // Because this is not an In-dialog request, you will get a null server Tx id here.
        if (serverTransactionId == null) {
            serverTransactionId = sipProvider.getNewServerTransaction(request);
        }
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);

        String serverTxId = ((ViaHeader)response.getHeader(ViaHeader.NAME)).getBranch();
        ServerTransaction serverTx = (ServerTransaction) this.serverTxTable.get(serverTxId);
        if ( serverTx != null && (serverTx.getState().equals(TransactionState.TRYING) ||
                serverTx.getState().equals(TransactionState.PROCEEDING))) {
            Request originalRequest = serverTx.getRequest();
            Response resp = messageFactory.createResponse(Response.REQUEST_TERMINATED,originalRequest);
            serverTx.sendResponse(resp);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:29,代码来源:Shootme.java

示例12: sendInviteOK

import javax.sip.RequestEvent; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
    try {
        
        logger.info("sendInviteOK: " + inviteTid);
        if (inviteTid.getState() != TransactionState.COMPLETED) {
            logger.info("shootme: Dialog state before OK: "
                    + inviteTid.getDialog().getState());

            SipProvider sipProvider = (SipProvider) requestEvent.getSource();
            Request request = requestEvent.getRequest();
            Response okResponse = messageFactory.createResponse(Response.OK,
                    request);
                ListeningPoint lp = sipProvider.getListeningPoint(transport);
            int myPort = lp.getPort();


            ((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);


            Address address = addressFactory.createAddress("Shootme <sip:"
                    + myAddress + ":" + myPort + ">");
            ContactHeader contactHeader = headerFactory
                    .createContactHeader(address);
            okResponse.addHeader(contactHeader);
            inviteTid.sendResponse(okResponse);
            logger.info("shootme: Dialog state after OK: "
                    + inviteTid.getDialog().getState());
            TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
        } else {
            logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:36,代码来源:Shootme.java

示例13: processInvite

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the invite request.
 */
public void processInvite(RequestEvent requestEvent,
        ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    this.inviteRequest = request;
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:10,代码来源:ClientTransactionCallingAlertTest.java

示例14: processInvite

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
     * Process the invite request.
     */
    public void processInvite(RequestEvent requestEvent,
            ServerTransaction serverTransaction) {
        SipProvider sipProvider = (SipProvider) requestEvent.getSource();
        Request request = requestEvent.getRequest();
        try {
            logger.info("shootme: got an Invite "+ request +"sending Trying");
            // logger.info("shootme: " + request);

            ServerTransaction st = requestEvent.getServerTransaction();

            if (st == null) {
                logger.info("null server tx -- getting a new one");
                st = sipProvider.getNewServerTransaction(request);
            }

            logger.info("getNewServerTransaction : " + st);

            // https://java.net/jira/browse/JSIP-476 Non regression test 
            if(request.getContentLength().getContentLength() < 1) {
            	throw new Exception("Content Length shouldn't be lower than zero, bad parsing occured along the way");
            }
            
            String value = ((HeaderExt)request.getHeader(PPreferredServiceHeader.NAME)).getValue();
            if(value == null || !value.equalsIgnoreCase(InviteTest.PREFERRED_SERVICE_VALUE)) {
            	throw new Exception("Bad value " + value);
            }
            String txId = ((ViaHeader)request.getHeader(ViaHeader.NAME)).getBranch();
            this.serverTxTable.put(txId, st);

            // Create the 100 Trying response.
//            Response response = messageFactory.createResponse(Response.TRYING,
//                    request);
//                ListeningPoint lp = sipProvider.getListeningPoint(transport);
//            int myPort = lp.getPort();
//
            Address address = addressFactory.createAddress("Shootme <sip:"
                    + myAddress + ":" + myPort + ">");
//
//            // Add a random sleep to stagger the two OK's for the benifit of implementations
//            // that may not be too good about handling re-entrancy.
//            int timeToSleep = (int) ( Math.random() * 1000);
//
//            Thread.sleep(timeToSleep);
//
//            st.sendResponse(response);

            Response ringingResponse = messageFactory.createResponse(Response.RINGING,
                    request);
            ContactHeader contactHeader = headerFactory.createContactHeader(address);
            ringingResponse.addHeader(contactHeader);
            ToHeader toHeader = (ToHeader) ringingResponse.getHeader(ToHeader.NAME);
            String toTag =  "shootme-" + myPort + "-" + new Integer(new Random().nextInt()).toString();             
            toHeader.setTag(toTag);
            if ( sendRinging ) {
                ringingResponse.addHeader(contactHeader);
                Thread.sleep(this.ringingDelay / 2);
                st.sendResponse(ringingResponse);
            }
            Dialog dialog =  st.getDialog();
            dialog.setApplicationData(st);

            this.inviteSeen = true;

            timer.schedule(new MyTimerTask(requestEvent,st,toTag), this.okDelay);
        } catch (Exception ex) {
            ex.printStackTrace();
            System.exit(0);
        }
    }
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:73,代码来源:Shootme.java

示例15: processInvite

import javax.sip.RequestEvent; //导入方法依赖的package包/类
/**
 * Process the invite request.
 */
public void processInvite(RequestEvent requestEvent,
        ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    Request request = requestEvent.getRequest();
    try {
        logger.info("shootme: got an Invite sending Trying");
        // logger.info("shootme: " + request);

        ServerTransaction st = requestEvent.getServerTransaction();

        if (st == null) {
            logger.info("null server tx -- getting a new one");
            st = sipProvider.getNewServerTransaction(request);
        }

        logger.info("getNewServerTransaction : " + st);

        String txId = ((ViaHeader)request.getHeader(ViaHeader.NAME)).getBranch();
        this.serverTxTable.put(txId, st);

        // Create the 100 Trying response.
        Response response = messageFactory.createResponse(Response.TRYING,
                request);
            ListeningPoint lp = sipProvider.getListeningPoint(transport);
        int myPort = lp.getPort();

        Address address = addressFactory.createAddress("Shootme <sip:"
                + myAddress + ":" + myPort + ">");

        // Add a random sleep to stagger the two OK's for the benifit of implementations
        // that may not be too good about handling re-entrancy.
        int timeToSleep = (int) ( Math.random() * 1000);

        Thread.sleep(timeToSleep);

        st.sendResponse(response);

        Response ringingResponse = messageFactory.createResponse(Response.RINGING,
                request);
        ContactHeader contactHeader = headerFactory.createContactHeader(address);
        response.addHeader(contactHeader);
        ToHeader toHeader = (ToHeader) ringingResponse.getHeader(ToHeader.NAME);
        String toTag;
        if ( ((ToHeader) ringingResponse.getHeader(ToHeader.NAME)).getTag() == null ) {
            toTag =  new Integer(new Random().nextInt()).toString();
            toHeader.setTag(toTag);
        } else {
            toTag = ((ToHeader) ringingResponse.getHeader(ToHeader.NAME)).getTag();
        }
        if ( sendRinging ) {
            ringingResponse.addHeader(contactHeader);
            st.sendResponse(ringingResponse);
        }
        Dialog dialog =  st.getDialog();
        dialog.setApplicationData(st);

        this.inviteSeen = true;

        this.sendInviteOK(requestEvent,st,toTag);
    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:68,代码来源:Shootme.java


注:本文中的javax.sip.RequestEvent.getSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。