本文整理汇总了Java中javax.sip.ListeningPoint.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java ListeningPoint.getPort方法的具体用法?Java ListeningPoint.getPort怎么用?Java ListeningPoint.getPort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.sip.ListeningPoint
的用法示例。
在下文中一共展示了ListeningPoint.getPort方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendInviteOK
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() != TransactionState.COMPLETED) {
logger.info("shootme: Dialog state before OK: "
+ inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: "
+ inviteTid.getDialog().getState());
TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例2: sendInviteOK
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() != TransactionState.COMPLETED) {
logger.info("shootme: Dialog state before OK: "
+ inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: "
+ inviteTid.getDialog().getState());
TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例3: sendInviteOK
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() == TransactionState.PROCEEDING) {
logger.info("shootme: Dialog state before OK: " + inviteTid.getDialog().getState());
System.err.println("shootme: Dialog state before OK: " + inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK, request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader) okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:" + myAddress + ":" + myPort + ">");
ContactHeader contactHeader = headerFactory.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: " + inviteTid.getDialog().getState());
TestCase.assertEquals(DialogState.CONFIRMED, inviteTid.getDialog().getState());
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
System.err.println("sentInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例4: sendInviteOK
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
private void sendInviteOK(RequestEvent requestEvent, ServerTransaction inviteTid, String toTag) {
try {
logger.info("sendInviteOK: " + inviteTid);
if (inviteTid.getState() != TransactionState.COMPLETED) {
logger.info("shootme: Dialog state before OK: "
+ inviteTid.getDialog().getState());
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
Response okResponse = messageFactory.createResponse(Response.OK,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
((ToHeader)okResponse.getHeader(ToHeader.NAME)).setTag(toTag);
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ";transport=" + transport+ ">");
ContactHeader contactHeader = headerFactory
.createContactHeader(address);
okResponse.addHeader(contactHeader);
inviteTid.sendResponse(okResponse);
logger.info("shootme: Dialog state after OK: "
+ inviteTid.getDialog().getState());
TestCase.assertEquals( DialogState.CONFIRMED , inviteTid.getDialog().getState() );
} else {
logger.info("semdInviteOK: inviteTid = " + inviteTid + " state = " + inviteTid.getState());
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
示例5: processRequest
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
public void processRequest(RequestEvent requestEvent) {
try {
Request request = requestEvent.getRequest();
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
this.inviteServerTxProvider = sipProvider;
if (request.getMethod().equals(Request.INVITE)) {
ListeningPoint lp = sipProvider.getListeningPoint(transport);
String host = lp.getIPAddress();
int port = lp.getPort();
ServerTransaction st = null;
if (requestEvent.getServerTransaction() == null) {
st = sipProvider.getNewServerTransaction(request);
}
for ( int i = 0; i < ntargets; i++ ) {
this.sendTo(st,request,5080 + i);
}
} else {
// Remove the topmost route header
// The route header will make sure it gets to the right place.
logger.info("proxy: Got a request " + request.getMethod());
Request newRequest = (Request) request.clone();
newRequest.removeFirst(RouteHeader.NAME);
sipProvider.sendRequest(newRequest);
}
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例6: doStart
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
@Override
protected void doStart() throws Exception {
super.doStart();
Properties properties = configuration.createInitialProperties();
setSipStack(configuration.getSipFactory().createSipStack(properties));
configuration.parseURI();
if (sipPublishListener == null) {
sipPublishListener = new SipPublishListener(this);
}
configuration.setListeningPoint(
sipStack.createListeningPoint(configuration.getFromHost(), Integer.valueOf(configuration.getFromPort()).intValue(), configuration.getTransport()));
boolean found = false;
if (provider != null) {
for (ListeningPoint listeningPoint : provider.getListeningPoints()) {
if (listeningPoint.getIPAddress().equalsIgnoreCase(configuration.getListeningPoint().getIPAddress())
&& (listeningPoint.getPort() == configuration.getListeningPoint().getPort())) {
found = true;
}
}
}
if (!found) {
provider = getSipStack().createSipProvider(configuration.getListeningPoint());
provider.addSipListener(sipPublishListener);
configuration.setCallIdHeader(provider.getNewCallId());
}
}
示例7: processInvite
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got an Invite sending Trying");
// logger.info("shootme: " + request);
ServerTransaction st = requestEvent.getServerTransaction();
if (st == null) {
logger.info("null server tx -- getting a new one");
st = sipProvider.getNewServerTransaction(request);
}
logger.info("getNewServerTransaction : " + st);
String txId = ((ViaHeader)request.getHeader(ViaHeader.NAME)).getBranch();
this.serverTxTable.put(txId, st);
// Create the 100 Trying response.
Response response = messageFactory.createResponse(Response.TRYING,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
// Add a random sleep to stagger the two OK's for the benifit of implementations
// that may not be too good about handling re-entrancy.
int timeToSleep = (int) ( Math.random() * 1000);
Thread.sleep(timeToSleep);
st.sendResponse(response);
Response ringingResponse = messageFactory.createResponse(Response.RINGING,
request);
ContactHeader contactHeader = headerFactory.createContactHeader(address);
response.addHeader(contactHeader);
ToHeader toHeader = (ToHeader) ringingResponse.getHeader(ToHeader.NAME);
String toTag = new Integer(new Random().nextInt()).toString();
toHeader.setTag(toTag);
if ( sendRinging ) {
ringingResponse.addHeader(contactHeader);
st.sendResponse(ringingResponse);
}
Dialog dialog = st.getDialog();
dialog.setApplicationData(st);
this.inviteSeen = true;
timer.schedule(new MyTimerTask(requestEvent,st,toTag), this.delay);
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例8: processInvite
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent,
ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got an Invite sending Trying");
// logger.info("shootme: " + request);
ServerTransaction st = requestEvent.getServerTransaction();
if (st == null) {
logger.info("null server tx -- getting a new one");
st = sipProvider.getNewServerTransaction(request);
}
logger.info("getNewServerTransaction : " + st);
String txId = ((ViaHeader)request.getHeader(ViaHeader.NAME)).getBranch();
this.serverTxTable.put(txId, st);
// Create the 100 Trying response.
Response response = messageFactory.createResponse(Response.TRYING,
request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
Address address = addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
// Add a random sleep to stagger the two OK's for the benifit of implementations
// that may not be too good about handling re-entrancy.
int timeToSleep = (int) ( Math.random() * 1000);
Thread.sleep(timeToSleep);
st.sendResponse(response);
Response ringingResponse = messageFactory.createResponse(Response.RINGING,
request);
ContactHeader contactHeader = headerFactory.createContactHeader(address);
response.addHeader(contactHeader);
ToHeader toHeader = (ToHeader) ringingResponse.getHeader(ToHeader.NAME);
String toTag;
if ( ((ToHeader) ringingResponse.getHeader(ToHeader.NAME)).getTag() == null ) {
toTag = new Integer(new Random().nextInt()).toString();
toHeader.setTag(toTag);
} else {
toTag = ((ToHeader) ringingResponse.getHeader(ToHeader.NAME)).getTag();
}
if ( sendRinging ) {
ringingResponse.addHeader(contactHeader);
st.sendResponse(ringingResponse);
}
Dialog dialog = st.getDialog();
dialog.setApplicationData(st);
this.inviteSeen = true;
this.sendInviteOK(requestEvent,st,toTag);
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}
示例9: processInvite
import javax.sip.ListeningPoint; //导入方法依赖的package包/类
/**
* Process the invite request.
*/
public void processInvite(RequestEvent requestEvent, ServerTransaction serverTransaction) {
SipProvider sipProvider = (SipProvider) requestEvent.getSource();
Request request = requestEvent.getRequest();
try {
logger.info("shootme: got an Invite sending Trying");
// logger.info("shootme: " + request);
ServerTransaction st = requestEvent.getServerTransaction();
inviteTid = st;
if (st == null) {
logger.info("null server tx -- getting a new one");
st = sipProvider.getNewServerTransaction(request);
}
logger.info("getNewServerTransaction : " + st);
// Create the 100 Trying response.
Response response = messageFactory.createResponse(Response.TRYING, request);
ListeningPoint lp = sipProvider.getListeningPoint(transport);
int myPort = lp.getPort();
Address address = addressFactory.createAddress("Shootme <sip:" + myAddress + ":" + myPort + ">");
// Add a random sleep to stagger the two OK's for the benifit of
// implementations
// that may not be too good about handling re-entrancy.
int timeToSleep = (int) (Math.random() * 1000);
Thread.sleep(timeToSleep);
st.sendResponse(response);
ContactHeader contactHeader = headerFactory.createContactHeader(address);
response.addHeader(contactHeader);
String toTag = new Integer(new Random().nextInt()).toString();
Dialog dialog = st.getDialog();
inviteDialog = dialog;
inviteDialog.terminateOnBye(true);
dialog.setApplicationData(st);
this.inviteSeen = true;
timer.schedule(new MyTimerTask(requestEvent, st, toTag), this.delay);
} catch (Exception ex) {
ex.printStackTrace();
System.exit(0);
}
}