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


Java ServerTransaction.getDialog方法代码示例

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


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

示例1: processBye

import javax.sip.ServerTransaction; //导入方法依赖的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) {
        ex.printStackTrace();
        System.exit(0);

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

示例2: processBye

import javax.sip.ServerTransaction; //导入方法依赖的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) {
        ex.printStackTrace();
        System.exit(0);

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

示例3: processBye

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

示例4: processAck

import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processAck(Request request, ServerTransaction tid) {
    try {
        logger.info("Got an ACK! sending bye : " + tid);
        if (tid != null) {
            Dialog dialog = tid.getDialog();
            TlsTest.assertSame("dialog id mismatch", dialog,this.dialog);
            Request bye = dialog.createRequest(Request.BYE);
            MaxForwardsHeader mf = protocolObjects.headerFactory
                    .createMaxForwardsHeader(10);
            bye.addHeader(mf);
            ClientTransaction ct = provider.getNewClientTransaction(bye);
            dialog.sendRequest(ct);
            this.byeSent = true;
        }
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        TlsTest.fail("unexpected exception");

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

示例5: processInvite

import javax.sip.ServerTransaction; //导入方法依赖的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 <sips:" + myAddress + ":" + myPort
                        + ">");
        ContactHeader contactHeader = protocolObjects.headerFactory
                .createContactHeader(address);
        response.addHeader(contactHeader);
        st.sendResponse(response);
    } catch (Exception ex) {
        logger.error("unexpected exception",ex);
        TlsTest.fail("unexpected exception");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:Shootist.java

示例6: processBye

import javax.sip.ServerTransaction; //导入方法依赖的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);
        this.gotBye = true;
        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,代码行数:23,代码来源:Shootist.java

示例7: processBye

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

示例8: processBye

import javax.sip.ServerTransaction; //导入方法依赖的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();
        SctpTest.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());
        SctpTest.assertEquals("Should be terminated", dialog.getState() , DialogState.TERMINATED);

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

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

示例9: processBye

import javax.sip.ServerTransaction; //导入方法依赖的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());

        this.byeSeen = true;

    } catch (Exception ex) {
        ex.printStackTrace();
        TlsTest.fail("unepxected exception");

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

示例10: processBye

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

示例11: processAck

import javax.sip.ServerTransaction; //导入方法依赖的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 " );
        // maybe a late arriving ack.
        if (serverTransaction == null) return;
        Dialog dialog = serverTransaction.getDialog();
            dialog = serverTransaction.getDialog();
        Request byeRequest = dialog.createRequest(Request.BYE);
        ClientTransaction tr =
            sipProvider.getNewClientTransaction(byeRequest);
        dialog.sendRequest(tr);
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("unexpected exception");
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:Shootme.java

示例12: processCancel

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

    Request request = requestEvent.getRequest();
    try {
        logger.info("shootme:  got a cancel.");
        if (serverTransactionId == null) {
            logger.info("shootme:  null tid.");
            return;
        }
        TestCase.assertTrue(inviteTid != serverTransactionId);
        Response response = messageFactory.createResponse(200, request);
        serverTransactionId.sendResponse(response);
        Request inviteRequest = inviteTid.getRequest();
        if (inviteTid.getState() != TransactionState.TERMINATED) {
            response = messageFactory.createResponse(
                    Response.REQUEST_TERMINATED, inviteRequest);
            inviteTid.sendResponse(response);
        }
        cancelOk = true;
        if(serverTransactionId.getDialog() == null) {
        	dialogOnCancelTx = false;
        }
    } catch (Exception ex) {
        // logger.error(ex);
        ex.printStackTrace();
        fail(unexpectedException);

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

示例13: processInvite

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

        if (st == null) {
            st = sipProvider.getNewServerTransaction(request);
        }
        dialog = st.getDialog();

        st.sendResponse(response);

        this.okResponse = messageFactory.createResponse(Response.OK,
                request);
        Address address = addressFactory.createAddress("Shootme <sip:"
                + myAddress + ":" + myPort + ">");
        ContactHeader contactHeader = headerFactory
                .createContactHeader(address);
        response.addHeader(contactHeader);
        ToHeader toHeader = (ToHeader) okResponse.getHeader(ToHeader.NAME);
        toHeader.setTag("4321"); // Application is supposed to set.
        okResponse.addHeader(contactHeader);
        this.inviteTid = st;
        // Defer sending the OK to simulate the phone ringing.
        // Answered in 1 second ( this guy is fast at taking calls)
        this.inviteRequest = request;

        new Timer().schedule(new MyTimerTask(this), 1000);
    } catch (Exception ex) {
        ex.printStackTrace();
        System.exit(0);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:43,代码来源:NoToTagOn1xxDialogLeakTest.java

示例14: processTimeout

import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
    Transaction transaction;
    if (timeoutEvent.isServerTransaction()) {
        transaction = timeoutEvent.getServerTransaction();
    } else {
        transaction = timeoutEvent.getClientTransaction();
    }
    logger.info("state = " + transaction.getState());
    logger.info("dialog = " + transaction.getDialog());
    logger.info("dialogState = " + transaction.getDialog().getState());
    logger.info("Transaction Timed out");
    transactionTimedOut = true;
    if(transaction instanceof ServerTransaction) {
        try {
            Response response = messageFactory.createResponse(Response.SERVER_INTERNAL_ERROR,
                    transaction.getRequest());
            ServerTransaction st = (ServerTransaction) transaction;

            if (st == null) {
                st = sipProvider.getNewServerTransaction(transaction.getRequest());
            }
            dialog = st.getDialog();

            st.sendResponse(response);
            errorResponseSent = true;
        } catch (Exception ex) {
            TestHarness.fail(ex.getMessage());
            System.exit(0);
        }
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:32,代码来源:UdpPrackTimeoutTest.java

示例15: processNotify

import javax.sip.ServerTransaction; //导入方法依赖的package包/类
public void processNotify(Request request,
        ServerTransaction serverTransactionId) {
    try {
        System.out.println("subsciber:  got a notify .");
        if (serverTransactionId == null) {
            System.out.println("subsciber:  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("subsciber:  Sending OK.");
        System.out.println("Dialog State = " + dialog.getState());

        // Unsubscribe to the Subscription. Note that if you do not unsubscribe the dialog will
        // live on and eventually you will run out of memory.

        Request unsub = dialog.createRequest(Request.SUBSCRIBE);
        ExpiresHeader expiresHeader = headerFactory
                .createExpiresHeader(0);
        unsub.addHeader(expiresHeader);

        EventHeader eventHeader = null;
        eventHeader = headerFactory.createEventHeader("reg");
        unsub.addHeader(eventHeader);

        ClientTransaction ct = sipProvider.getNewClientTransaction(unsub);
        ct.sendRequest();

        dialog.delete();

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

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


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