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


Java RequestEvent类代码示例

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


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

示例1: processBye

import javax.sip.RequestEvent; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    Request request = requestEvent.getRequest();
    try {
        logger.info("shootme:  got a bye sending OK.");
        logger.info("shootme:  dialog = " + requestEvent.getDialog());
        logger.info("shootme:  dialogState = " + requestEvent.getDialog().getState());
        Response response = messageFactory.createResponse(200, request);
        if ( serverTransactionId != null) {
            serverTransactionId.sendResponse(response);
        }
        logger.info("shootme:  dialogState = " + requestEvent.getDialog().getState());

        this.byeSeen = true;


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

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

示例2: 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();
    try {
        System.out.println("shootme:  got a bye sending OK.");
        Response response =
            messageFactory.createResponse(200, request, null, null);
        serverTransactionId.sendResponse(response);
        System.out.println("Dialog State is " + serverTransactionId.getDialog().getState());

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

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

示例3: 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 {
        System.out.println("shootme: got an ACK! ");
        System.out.println("Dialog State = " + dialog.getState());
        SipProvider provider = (SipProvider) requestEvent.getSource();
        if (!callerSendsBye) {
            Request byeRequest = dialog.createRequest(Request.BYE);
            ClientTransaction ct = provider
                    .getNewClientTransaction(byeRequest);
            dialog.sendRequest(ct);
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }

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

示例4: processRequest

import javax.sip.RequestEvent; //导入依赖的package包/类
public void processRequest(RequestEvent requestReceivedEvent) {
    Request request = requestReceivedEvent.getRequest();
    ServerTransaction serverTransactionId = requestReceivedEvent
            .getServerTransaction();
    String viaBranch = ((ViaHeader)(request.getHeaders(ViaHeader.NAME).next())).getParameter("branch");

    logger.info("\n\nRequest " + request.getMethod() + " received at "
            + sipStack.getStackName() + " with server transaction id "
            + serverTransactionId +
            " branch ID = " + viaBranch);
    //logger.info( request );
    if (request.getMethod().equals(Request.NOTIFY)) {
        processNotify(requestReceivedEvent, serverTransactionId);
    } else if ( request.getMethod().equals(Request.INVITE)) {
        processInvite( requestReceivedEvent );
    } else if ( request.getMethod().equals(Request.ACK)) {
        processAck( requestReceivedEvent );
    } else if ( request.getMethod().equals(Request.BYE)) {
        processBye( requestReceivedEvent );
    } else {
        TestHarness.fail( "Unexpected request type:" + request.getMethod() );
    }

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

示例5: processRequest

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

    System.out.println("\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);
    }

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

示例6: 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 " + protocolObjects.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);
    }

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

示例7: processInvite

import javax.sip.RequestEvent; //导入依赖的package包/类
public void processInvite(RequestEvent requestEvent) {
	//System.out.println("Got invite: "+requestEvent.getRequest());
	try {
		serverTransaction = requestEvent.getServerTransaction();
		if (serverTransaction == null) {
			try {
				serverTransaction = sipProvider.getNewServerTransaction(requestEvent.getRequest());
			}
			catch (Exception e) {
				e.printStackTrace();
				return;
			}
		}
		//serverTransaction.sendResponse(messageFactory.createResponse(100, requestEvent.getRequest()));
		setupIncomingDialog();
		forwardInvite();			
	} catch (Exception ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:TestCall.java

示例8: 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();
    try {
        logger.info("shootme:  got a bye sending OK.");
        Response response = protocolObjects.messageFactory.createResponse(200, request);
        if (serverTransactionId != null) {
            serverTransactionId.sendResponse(response);
            logger.info("Dialog State is " + serverTransactionId.getDialog().getState());
        } else {
            logger.info("null server tx.");
            // sipProvider.sendResponse(response);
        }

    } catch (Exception ex) {
        String s = "Unexpected exception";
        logger.error(s, ex);
        ReInviteBusyTest.fail(s);

    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:ReInviteBusyTest.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);
    } 

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

示例10: processRequest

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

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

    // We are the UAC so the only request we get is the BYE.
    if (request.getMethod().equals(Request.BYE))
        processBye(request, serverTransactionId);
    else {
        try {
            serverTransactionId.sendResponse(messageFactory
                    .createResponse(202, request));
        } catch (Exception e) {
            fail("Unexpected exception");
            logger.error("Unexpected exception", e);
        }
    }

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

示例11: 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();
        TxTimeoutTest.fail("Shootme: Failed on process INVITE", ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例12: processRequest

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

    System.out.println("GOT REQUEST: " + request.getMethod());

    if (request.getMethod().equals(Request.INVITE) || request.getMethod().equals(Request.MESSAGE)) {
        processInvite(requestEvent, serverTransactionId);
    } else if (request.getMethod().equals(Request.ACK)) {
        processAck(requestEvent, serverTransactionId);
    } else if (request.getMethod().equals(Request.INFO)) {
        processInfo(requestEvent);
    } else if (request.getMethod().equals(Request.BYE)) {
        processBye(requestEvent, serverTransactionId);
    } 

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

示例13: processInfo

import javax.sip.RequestEvent; //导入依赖的package包/类
public void processInfo(RequestEvent requestEvent, ServerTransaction serverTransactionId) {

            SipProvider sipProvider = (SipProvider) requestEvent.getSource();
            Request request = requestEvent.getRequest();
            try {
                logger.info("shootme:  got a INFO sending OK.");
                Response response = protocolObjects.messageFactory.createResponse(200, request);
                if (serverTransactionId != null) {
                    serverTransactionId.sendResponse(response);
                    logger.info("Dialog State is " + serverTransactionId.getDialog().getState());
                } else {
                    logger.info("null server tx.");
                    // sipProvider.sendResponse(response);
                }

            } catch (Exception ex) {
                String s = "Unexpected exception";
                logger.error(s, ex);
                ReInviteInfoAckOverlapTest.fail(s);

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

示例14: processAck

import javax.sip.RequestEvent; //导入依赖的package包/类
public void processAck(RequestEvent requestEvent, ServerTransaction serverTransaction) {
    SipProvider sipProvider = (SipProvider) requestEvent.getSource();
    try {
        logger.info("shootme: got an ACK " + requestEvent.getRequest());

        CSeqHeader cseq = (CSeqHeader) requestEvent.getRequest().getHeader(CSeqHeader.NAME);
        if(cseq.getSeqNumber() == 2) this.ack2Received = true;
       /* int ackCount = ((ApplicationData) dialog.getApplicationData()).ackCount;*/

        dialog = inviteTid.getDialog();
        Thread.sleep(1000);
        logger.info("shootme is sending RE INVITE now");
        System.out.println("Got an ACK " );
        this.reInviteCount++;
        this.sendReInvite(sipProvider);

    } catch (Exception ex) {
        String s = "Unexpected error";
        logger.error(s, ex);
        ReInviteInfoAckOverlapTest.fail(s);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:ReInviteInfoAckOverlapTest.java

示例15: processRequest

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

    System.out.println("GOT REQUEST: " + request.getMethod());

    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.INFO)) {
        processInfo(requestEvent);
    } else if (request.getMethod().equals(Request.BYE)) {
        processBye(requestEvent, serverTransactionId);
    } 

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


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