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


Java Dialog类代码示例

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


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

示例1: processBye

import javax.sip.Dialog; //导入依赖的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: processBye

import javax.sip.Dialog; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = protocolObjects.messageFactory.createResponse(
                200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

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

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

示例3: processInvite

import javax.sip.Dialog; //导入依赖的package包/类
public void processInvite(Request request, ServerTransaction st) {
    try {
        Dialog dialog = st.getDialog();
        Response response = protocolObjects.messageFactory.createResponse(
                Response.OK, request);
        ((ToHeader) response.getHeader(ToHeader.NAME))
                .setTag(((ToHeader) request.getHeader(ToHeader.NAME))
                        .getTag());

        Address address = protocolObjects.addressFactory
                .createAddress("Shootme <sip:" + myAddress + ":" + myPort
                        + ">");
        ContactHeader contactHeader = protocolObjects.headerFactory
                .createContactHeader(address);
        response.addHeader(contactHeader);
        st.sendResponse(response);
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        SctpTest.fail("unexpected exception");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:Shootist.java

示例4: processBye

import javax.sip.Dialog; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        System.out.println("shootist:  got a bye .");
        if (serverTransactionId == null) {
            System.out.println("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        System.out.println("Dialog State = " + dialog.getState());
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("shootist:  Sending OK.");
        System.out.println("Dialog State = " + dialog.getState());

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

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

示例5: processBye

import javax.sip.Dialog; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        logger.info("Dialog State = " + dialog.getState());
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());

    } catch (Exception ex) {
        TestHarness.fail(ex.getMessage());
        System.exit(0);

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

示例6: processBye

import javax.sip.Dialog; //导入依赖的package包/类
/**
 * Process the bye request.
 */
public void processBye(RequestEvent requestEvent,
        ServerTransaction serverTransactionId) {
    final Request request = requestEvent.getRequest();
    final Dialog dialog = requestEvent.getDialog();
    try {
        final Response response = messageFactory.createResponse(200, request);
        if(serverTransactionId == null) {
        	serverTransactionId = ((SipProvider)requestEvent.getSource()).getNewServerTransaction(request);
        }
        serverTransactionId.sendResponse(response);
    } catch (Exception ex) {
        ex.printStackTrace();
        //System.exit(0);

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

示例7: processAck

import javax.sip.Dialog; //导入依赖的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();
        TxTimeoutTest.fail("Shootme: Failed on process ACK", ex);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootme.java

示例8: processBye

import javax.sip.Dialog; //导入依赖的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,代码来源:Shootme.java

示例9: processResponse

import javax.sip.Dialog; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        TxTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

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

示例10: processDialogTimeout

import javax.sip.Dialog; //导入依赖的package包/类
public void processDialogTimeout(DialogTimeoutEvent timeoutEvent) {
       System.out.println("processDialogTerminated " + timeoutEvent.getDialog());
       
       DialogTimeoutEvent dialogAckTimeoutEvent = (DialogTimeoutEvent)timeoutEvent;
       Dialog timeoutDialog = dialogAckTimeoutEvent.getDialog();
       if(timeoutDialog == null){
           TxTimeoutTest.fail(
                   "Shootist: Exception on timeout, dialog shouldn't be null");
           stateIsOk = false;
           return;
       }        
       if(dialogAckTimeoutEvent.getReason() == Reason.AckNotReceived) {
           stateIsOk = true;
       }
       if(dialogAckTimeoutEvent.getReason() == Reason.EarlyStateTimeout && !sendOK) {
           stateIsOk = true;
       }
       TimerTask timerTask = new CheckAppData(timeoutDialog);
       new Timer().schedule(timerTask, 9000);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:Shootme.java

示例11: processBye

import javax.sip.Dialog; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        logger.info("shootist:  got a bye .");
        if (serverTransactionId == null) {
            logger.info("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        TlsTest.assertSame("dialog mismatch", dialog,this.dialog);
        logger.info("Dialog State = " + dialog.getState());
        Response response = protocolObjects.messageFactory.createResponse(
                200, request);
        serverTransactionId.sendResponse(response);
        logger.info("shootist:  Sending OK.");
        logger.info("Dialog State = " + dialog.getState());
        TlsTest.assertEquals("Should be terminated", dialog.getState() , DialogState.TERMINATED);

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

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

示例12: processBye

import javax.sip.Dialog; //导入依赖的package包/类
public void processBye(Request request,
        ServerTransaction serverTransactionId) {
    try {
        System.out.println("shootist:  got a bye .");
        if (serverTransactionId == null) {
            System.out.println("shootist:  null TID.");
            return;
        }
        Dialog dialog = serverTransactionId.getDialog();
        System.out.println("Shootist : Dialog State = " + dialog.getState());
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        System.out.println("shootist:  Sending OK.");
        System.out.println("Shootist : Dialog State = " + dialog.getState());

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

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

示例13: processAck

import javax.sip.Dialog; //导入依赖的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

示例14: processResponse

import javax.sip.Dialog; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
    // System.out.println("Got a response");
    Response response = (Response) responseReceivedEvent.getResponse();
    Transaction tid = responseReceivedEvent.getClientTransaction();

    // System.out.println("Response received with client transaction id "
    // + tid + ":\n" + response);

    System.out.println("GOT RESPONSE: " + response.getStatusCode());
    try {
        if (response.getStatusCode() == Response.OK && ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(Request.INVITE)) {

            Dialog dialog = tid.getDialog();
            
            Request request = tid.getRequest();
            dialog.sendAck(request);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
        DialogTimeoutTest.fail("Shootme: Failed on process response: " + response.getStatusCode(), ex);
    }

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

示例15: processDialogTimeout

import javax.sip.Dialog; //导入依赖的package包/类
public void processDialogTimeout(DialogTimeoutEvent timeoutEvent) {
       System.out.println("processDialogTerminated " + timeoutEvent.getDialog());
       
       DialogTimeoutEvent dialogAckTimeoutEvent = (DialogTimeoutEvent)timeoutEvent;
       Dialog timeoutDialog = dialogAckTimeoutEvent.getDialog();
       if(timeoutDialog == null){
           DialogTimeoutTest.fail(
                   "Shootist: Exception on timeout, dialog shouldn't be null");
           stateIsOk = false;
           return;
       }        
       if(dialogAckTimeoutEvent.getReason() == Reason.AckNotReceived) {
           stateIsOk = true;
       }
       TimerTask timerTask = new CheckAppData(timeoutDialog);
       new Timer().schedule(timerTask, 9000);
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:Shootme.java


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