本文整理汇总了Java中javax.sip.SipProvider类的典型用法代码示例。如果您正苦于以下问题:Java SipProvider类的具体用法?Java SipProvider怎么用?Java SipProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SipProvider类属于javax.sip包,在下文中一共展示了SipProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processAck
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例2: AbstractCancelTest
import javax.sip.SipProvider; //导入依赖的package包/类
public AbstractCancelTest() {
try {
ProtocolObjects.logFileDirectory = "logs/";
ProtocolObjects.init("canceltest");
providerTable = new Hashtable();
shootist = new Shootist();
SipProvider shootistProvider = shootist.createSipProvider();
providerTable.put(shootistProvider, shootist);
Shootme shootme = new Shootme();
SipProvider shootmeProvider = shootme.createProvider();
providerTable.put(shootmeProvider, shootme);
shootistProvider.addSipListener(this);
shootmeProvider.addSipListener(this);
ProtocolObjects.start();
} catch (Exception ex) {
fail("unexpected exception ");
}
}
示例3: processBye
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例4: processBye
import javax.sip.SipProvider; //导入依赖的package包/类
/**
* Process the bye request.
*/
public void processBye(RequestEvent requestEvent,
ServerTransaction serverTransactionId) {
final Request request = requestEvent.getRequest();
try {
if (serverTransactionId == null) {
try {
serverTransactionId = ((SipProvider)requestEvent.getSource()).getNewServerTransaction(request);
} catch ( TransactionUnavailableException tae) {
tae.printStackTrace();
return;
} catch ( TransactionAlreadyExistsException taex ) {
// This is a retransmission so just return.
return;
}
}
final Response response = messageFactory.createResponse(200, request);
serverTransactionId.sendResponse(response);
} catch (Exception ex) {
ex.printStackTrace();
//System.exit(0);
}
}
示例5: setUp
import javax.sip.SipProvider; //导入依赖的package包/类
public void setUp() {
try {
super.setUp();
// String stackname, String pathname, String transport,
// boolean autoDialog
this.shootistProtocolObjs = new ProtocolObjects("shootist", "gov.nist", "udp", true,true);
shootist = new Shootist(shootistProtocolObjs);
SipProvider shootistProvider = shootist.createSipProvider();
this.shootmeProtocolObjs = new ProtocolObjects("shootme", "gov.nist", "udp", true,true);
shootme = new Shootme(shootmeProtocolObjs);
SipProvider shootmeProvider = shootme.createSipProvider();
shootistProvider.addSipListener(shootist);
shootmeProvider.addSipListener(shootme);
shootistProtocolObjs.start();
shootmeProtocolObjs.start();
} catch (Exception ex) {
ex.printStackTrace();
fail("unexpected exception ");
}
}
示例6: processAck
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例7: processInvite
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例8: processBye
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例9: createSipProvider
import javax.sip.SipProvider; //导入依赖的package包/类
public SipProvider createSipProvider() {
try {
listeningPoint = protocolObjects.sipStack.createListeningPoint(host, port,
protocolObjects.transport);
logger.info("listening point = " + host + " port = " + port);
logger.info("listening point = " + listeningPoint);
sipProvider = protocolObjects.sipStack.createSipProvider(listeningPoint);
return sipProvider;
} catch (Exception ex) {
logger.error(unexpectedException, ex);
TestHarness.fail(unexpectedException);
return null;
}
}
示例10: createProvider
import javax.sip.SipProvider; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress,
myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("udp provider " + sipProvider);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
fail(unexpectedException);
return null;
}
}
示例11: processAck
import javax.sip.SipProvider; //导入依赖的package包/类
/**
* Process the ACK request. Send the bye and complete the call flow.
*/
public void processAck(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
try {
logger.info("shootme: got an ACK! ");
logger.info("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) {
logger.error("Unexpected exception", ex);
fail("unexpected exception");
}
}
示例12: setUp
import javax.sip.SipProvider; //导入依赖的package包/类
public void setUp() throws Exception {
try {
super.setUp();
logger.info("PrackTest: setup()");
shootist = new Shootist(getTiProtocolObjects());
SipProvider shootistProvider = shootist.createProvider();
providerTable.put(shootistProvider, shootist);
shootme = new Shootme(getRiProtocolObjects());
SipProvider shootmeProvider = shootme.createProvider();
providerTable.put(shootmeProvider, shootme);
shootistProvider.addSipListener(this);
shootmeProvider.addSipListener(this);
if (getTiProtocolObjects() != getRiProtocolObjects())
getTiProtocolObjects().start();
getRiProtocolObjects().start();
} catch (Exception ex) {
logger.error("unexpected excecption ", ex);
fail("unexpected exception");
}
}
示例13: processAck
import javax.sip.SipProvider; //导入依赖的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);
}
}
示例14: createSipProvider
import javax.sip.SipProvider; //导入依赖的package包/类
public SipProvider createSipProvider() {
try {
ListeningPoint listeningPoint = protocolObjects.sipStack
.createListeningPoint(host, port, protocolObjects.transport);
sipProvider = protocolObjects.sipStack
.createSipProvider(listeningPoint);
sipProvider.setAutomaticDialogSupportEnabled(false);
return sipProvider;
} catch (Exception ex) {
logger.error(unexpectedException, ex);
fail(unexpectedException);
return null;
}
}
示例15: createProvider
import javax.sip.SipProvider; //导入依赖的package包/类
public SipProvider createProvider() {
try {
ListeningPoint lp = sipStack.createListeningPoint(myAddress,
myPort, transport);
sipProvider = sipStack.createSipProvider(lp);
logger.info("provider " + sipProvider);
logger.info("sipStack = " + sipStack);
return sipProvider;
} catch (Exception ex) {
logger.error(ex);
TestCase.fail(unexpectedException);
return null;
}
}