本文整理汇总了Java中javax.sip.ServerTransaction类的典型用法代码示例。如果您正苦于以下问题:Java ServerTransaction类的具体用法?Java ServerTransaction怎么用?Java ServerTransaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerTransaction类属于javax.sip包,在下文中一共展示了ServerTransaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: processRequest
import javax.sip.ServerTransaction; //导入依赖的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);
} else if (request.getMethod().equals(Request.BYE)) {
processBye(requestEvent, serverTransactionId);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:Shootme.java
示例2: 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 "
+ requestEvent.getRequest());
int ackCount =
((ApplicationData ) dialog.getApplicationData()).ackCount;
if (ackCount == 1) {
dialog = inviteTid.getDialog();
Request byeRequest = dialog.createRequest(Request.BYE);
ClientTransaction tr =
sipProvider.getNewClientTransaction(byeRequest);
System.out.println("shootme: got an ACK -- sending bye! ");
dialog.sendRequest(tr);
System.out.println("Dialog State = " + dialog.getState());
} else ((ApplicationData) dialog.getApplicationData()).ackCount ++;
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:Shootme.java
示例3: 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());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:22,代码来源:ShootistAuth.java
示例4: processTimeout
import javax.sip.ServerTransaction; //导入依赖的package包/类
public void processTimeout(javax.sip.TimeoutEvent timeoutEvent) {
System.out.println("Transaction Time out");
Request request = null;
Transaction transaction = null;
if (timeoutEvent.isServerTransaction()) {
transaction = timeoutEvent.getServerTransaction();
request = ((ServerTransaction) transaction).getRequest();
} else {
transaction = timeoutEvent.getClientTransaction();
request = ((ClientTransaction) transaction).getRequest();
}
System.out.println("state = " + transaction.getState());
System.out.println("dialog = " + transaction.getDialog());
System.out.println("dialogState = "
+ transaction.getDialog().getState());
System.out.println("Transaction Time out");
System.out.println("Transaction " + transaction);
System.out.println("request " + request);
fail("Unexpected event: TimeoutEvent ");
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:24,代码来源:Shootist.java
示例5: 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
示例6: processRequest
import javax.sip.ServerTransaction; //导入依赖的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);
} else if (request.getMethod().equals(Request.BYE)) {
processBye(requestEvent, serverTransactionId);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:ReInviteBusyTest.java
示例7: processBye
import javax.sip.ServerTransaction; //导入依赖的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("Shootme : Dialog State is "
+ serverTransactionId.getDialog().getState());
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:NoToTagOn1xxDialogLeakTest.java
示例8: processRequest
import javax.sip.ServerTransaction; //导入依赖的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
示例9: 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 "
// + 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
示例10: processInvite
import javax.sip.ServerTransaction; //导入依赖的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
示例11: processRequest
import javax.sip.ServerTransaction; //导入依赖的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
示例12: 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
示例13: 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;
}
Response response = protocolObjects.messageFactory.createResponse(
200, request);
serverTransactionId.sendResponse(response);
} catch (Exception ex) {
logger.error("unexpected exception",ex);
fail("unexpected exception");
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:SelfroutingTest.java
示例14: processAck
import javax.sip.ServerTransaction; //导入依赖的package包/类
public void processAck(Request request,
ServerTransaction serverTransactionId) {
try {
logger.info("shootist: got ACK .");
if (serverTransactionId == null) {
logger.info("shootist: null TID.");
return;
}
Request bye = dialog.createRequest(Request.BYE);
ClientTransaction ctx = provider.getNewClientTransaction(bye);
ctx.sendRequest();
} catch (Exception ex) {
logger.error("unexpected exception",ex);
fail("unexpected exception");
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:SelfroutingTest.java
示例15: 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 "
// + 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
示例16: 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) {
try {
System.out.println("shootme: got an ACK! ");
System.out.println("Shootme : 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,代码来源:NoToTagOn1xxDialogLeakTest.java
示例17: processRequest
import javax.sip.ServerTransaction; //导入依赖的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
示例18: 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();
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
示例19: 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
示例20: 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
注:本文中的javax.sip.ServerTransaction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论