本文整理汇总了Java中javax.sip.header.MaxForwardsHeader类的典型用法代码示例。如果您正苦于以下问题:Java MaxForwardsHeader类的具体用法?Java MaxForwardsHeader怎么用?Java MaxForwardsHeader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MaxForwardsHeader类属于javax.sip.header包,在下文中一共展示了MaxForwardsHeader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sendMultipleContactRegistration
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void sendMultipleContactRegistration() throws Exception {
Address fromAddress = addressFactory.createAddress("[email protected]:5070");
ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
CallIdHeader callId = provider.getNewCallId();
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.REGISTER);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
List via = Arrays.asList(((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader());
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
Request request = messageFactory.createRequest(requestURI, Request.REGISTER, callId, cSeq, from, to, via, maxForwards);
request.setRequestURI(requestURI);
request.addHeader(contactHeader1);
request.addHeader(contactHeader2);
ClientTransaction ctx = this.provider.getNewClientTransaction(request);
ctx.sendRequest();
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:23,代码来源:MultipleContactsTest.java
示例2: sendInviteWithRPort
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void sendInviteWithRPort() throws Exception {
Address fromAddress = addressFactory.createAddress("[email protected]:5070");
ContactHeader contactHeader1 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5070"));
ContactHeader contactHeader2 = headerFactory.createContactHeader(addressFactory.createAddress("sip:[email protected]:5080"));
CallIdHeader callId = provider.getNewCallId();
CSeqHeader cSeq = headerFactory.createCSeqHeader(1l, Request.INVITE);
FromHeader from = headerFactory.createFromHeader(fromAddress, "1234");
ToHeader to = headerFactory.createToHeader(addressFactory.createAddress("[email protected]"+host+":"+SERVER_PORT), null);
ViaHeader via = ((ListeningPointImpl)provider.getListeningPoint(testProtocol)).getViaHeader();
via.setRPort();
List vias = Arrays.asList(via);
MaxForwardsHeader maxForwards = headerFactory.createMaxForwardsHeader(10);
URI requestURI = addressFactory.createURI("sip:[email protected]"+host+":"+SERVER_PORT);
Request request = messageFactory.createRequest(requestURI, Request.INVITE, callId, cSeq, from, to, vias, maxForwards);
System.out.println(request);
assertTrue(request.toString().indexOf("rport=") == -1);
request.setRequestURI(requestURI);
request.addHeader(contactHeader1);
request.addHeader(contactHeader2);
ClientTransaction ctx = this.provider.getNewClientTransaction(request);
ctx.sendRequest();
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:27,代码来源:ViaRPortTest.java
示例3: processAck
import javax.sip.header.MaxForwardsHeader; //导入依赖的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
示例4: processAck
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void processAck(Request request, ServerTransaction tid) {
try {
logger.info("Got an ACK! sending bye : " + tid);
if (tid != null) {
Dialog dialog = tid.getDialog();
SctpTest.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);
SctpTest.fail("unexpected exception");
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:Shootist.java
示例5: getMaxForwardsHeader
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
* Initializes and returns SipManager's maxForwardsHeader field using the
* value specified by MAX_FORWARDS.
*
* @return an instance of a MaxForwardsHeader that can be used when sending
* requests
* @throws CommunicationsException if MAX_FORWARDS has an invalid value.
*/
public MaxForwardsHeader getMaxForwardsHeader()
throws CommunicationsException {
if (maxForwardsHeader != null) {
return maxForwardsHeader;
}
try {
maxForwardsHeader = headerFactory
.createMaxForwardsHeader(MAX_FORWARDS);
return maxForwardsHeader;
}
catch (InvalidArgumentException ex) {
throw new CommunicationsException(
"A problem occurred while creating MaxForwardsHeader",
ex);
}
}
开发者ID:visit,项目名称:spark-svn-mirror,代码行数:26,代码来源:SipManager.java
示例6: sendReInvite
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void sendReInvite(SipProvider sipProvider) throws Exception {
Request inviteRequest = dialog.createRequest(Request.INVITE);
((SipURI) inviteRequest.getRequestURI()).removeParameter("transport");
MaxForwardsHeader mf = protocolObjects.headerFactory.createMaxForwardsHeader(10);
inviteRequest.addHeader(mf);
((ViaHeader) inviteRequest.getHeader(ViaHeader.NAME))
.setTransport(protocolObjects.transport);
Address address = protocolObjects.addressFactory.createAddress("Shootme <sip:"
+ myAddress + ":" + myPort + ">");
ContactHeader contactHeader = protocolObjects.headerFactory
.createContactHeader(address);
inviteRequest.addHeader(contactHeader);
ClientTransaction ct = sipProvider.getNewClientTransaction(inviteRequest);
dialog.sendRequest(ct);
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:16,代码来源:ReInviteBusyTest.java
示例7: testAgainstRI
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
private void testAgainstRI(Request tiRequest, Request riRequest) {
try {
assertEquals(riRequest.getMethod(), tiRequest.getMethod());
assertEquals(riRequest.getRequestURI(), tiRequest.getRequestURI() );
assertEquals(riRequest.getHeader( MaxForwardsHeader.NAME ), tiRequest.getHeader( MaxForwardsHeader.NAME ) );
testAgainstRIMsg(tiRequest, riRequest);
} catch (Throwable ex) {
ex.printStackTrace();
fail(ex.getMessage());
} finally {
logTestCompleted("testAgainstRI(testRequest)");
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:14,代码来源:MessageFactoryTest.java
示例8: MakeRequest
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
*
* @param sipManager - SipManager object
* @param to - To identifies receiver IP
* @param message Message that should be send
* @return Return SIP Message.
* @throws ParseException
* @throws InvalidArgumentException
*/
public Request MakeRequest(SipManager sipManager, String to, String message) throws ParseException, InvalidArgumentException {
AddressFactory addressFactory = sipManager.addressFactory;
sipManager.setCseqNumber((long)sipManager.getCseqNumber()+1l);
Address fromNameAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
FromHeader fromHeader = sipManager.headerFactory.createFromHeader(fromNameAddress, "SyMPHOnY");
URI toAddress = sipManager.addressFactory.createURI(to);
Address toNameAddress = sipManager.addressFactory.createAddress(toAddress);
ToHeader toHeader = sipManager.headerFactory.createToHeader(toNameAddress, null);
URI requestURI = sipManager.addressFactory.createURI(to);
ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
CallIdHeader callIdHeader = sipManager.sipProvider.getNewCallId();
CSeqHeader cSeqHeader = sipManager.headerFactory.createCSeqHeader(sipManager.getCseqNumber(),Request.MESSAGE);
MaxForwardsHeader maxForwards = sipManager.headerFactory
.createMaxForwardsHeader(70);
Request request = sipManager.messageFactory.createRequest(requestURI,
Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
SupportedHeader supportedHeader = sipManager.headerFactory
.createSupportedHeader("replaces, outbound");
request.addHeader(supportedHeader);
SipURI routeUri = sipManager.addressFactory.createSipURI(null,
SipManager.proxyIp);
routeUri.setTransportParam(SipManager.transport);
routeUri.setLrParam();
routeUri.setPort(SipManager.proxyPort);
Address routeAddress = sipManager.addressFactory
.createAddress(routeUri);
RouteHeader route = sipManager.headerFactory
.createRouteHeader(routeAddress);
request.addHeader(route);
ContentTypeHeader contentTypeHeader = sipManager.headerFactory
.createContentTypeHeader("text", "plain");
request.setContent(message, contentTypeHeader);
System.out.println(request);
return request;
}
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:48,代码来源:MessageMessage.java
示例9: processResponse
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void processResponse(ResponseEvent responseReceivedEvent) {
logger.info("Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
Transaction tid = responseReceivedEvent.getClientTransaction();
logger.info("Response received with client transaction id " + tid + ":\n"
+ response.getStatusCode());
if (tid == null) {
logger.info("Stray response -- dropping ");
return;
}
logger.info("transaction state is " + tid.getState());
logger.info("Dialog = " + tid.getDialog());
logger.info("Dialog State is " + tid.getDialog().getState());
SipProvider provider = (SipProvider) responseReceivedEvent.getSource();
try {
if (response.getStatusCode() == Response.OK
&& ((CSeqHeader) response.getHeader(CSeqHeader.NAME)).getMethod().equals(
Request.INVITE)) {
// Request cancel = inviteTid.createCancel();
// ClientTransaction ct =
// sipProvider.getNewClientTransaction(cancel);
Dialog dialog = tid.getDialog();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
logger.info("Ack request to send = " + ackRequest);
logger.info("Sending ACK");
dialog.sendAck(ackRequest);
Thread.sleep(100);
Request inviteRequest = dialog.createRequest(Request.INVITE);
((SipURI) inviteRequest.getRequestURI()).removeParameter("transport");
((ViaHeader) inviteRequest.getHeader(ViaHeader.NAME)).setTransport("udp");
inviteRequest.addHeader(contactHeader);
MaxForwardsHeader mf = protocolObjects.headerFactory
.createMaxForwardsHeader(10);
inviteRequest.addHeader(mf);
ClientTransaction ct = provider.getNewClientTransaction(inviteRequest);
dialog.sendRequest(ct);
reInviteCount++;
logger.info("RE-INVITE sent");
} else if (response.getStatusCode() == Response.BUSY_HERE) {
this.busyHereReceived = true;
TestCase.assertEquals("Dialog State must be CONFIRMED", dialog.getState(), DialogState.CONFIRMED);
}
} catch (Exception ex) {
ex.printStackTrace();
logger.error(ex);
ReInviteBusyTest.fail("unexpceted exception");
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:59,代码来源:ReInviteBusyTest.java
示例10: processResponse
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
logger.info("Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
ClientTransaction tid = responseReceivedEvent.getClientTransaction();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
logger.info("Response received : Status Code = " + response.getStatusCode() + " " + cseq);
logger.info("Response = " + response + " class=" + response.getClass());
Dialog dialog = responseReceivedEvent.getDialog();
TestHarness.assertNotNull(dialog);
if (tid != null)
logger.info("transaction state is " + tid.getState());
else
logger.info("transaction = " + tid);
logger.info("Dialog = " + dialog);
logger.info("Dialog state is " + dialog.getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
TestHarness.assertEquals(DialogState.CONFIRMED, dialog.getState());
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
TestHarness.assertNotNull(ackRequest.getHeader(MaxForwardsHeader.NAME));
if (dialog == this.ackedDialog) {
dialog.sendAck(ackRequest);
return;
}
this.forkedDialogs.add(dialog);
new AckSender(ackRequest, dialog).sendAck();
} else {
logger.info("Response method = " + cseq.getMethod());
}
} else if (response.getStatusCode() == Response.RINGING) {
// TestHarness.assertEquals( DialogState.EARLY, dialog.getState() );
}
} catch (Throwable ex) {
ex.printStackTrace();
// System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:50,代码来源:Shootist.java
示例11: sendInvite
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public void sendInvite( ReferToHeader to ) {
try {
String fromName = "Referee";
String fromSipAddress = "here.com";
String fromDisplayName = "The Master Blaster";
// create >From Header
SipURI fromAddress = addressFactory.createSipURI(fromName,
fromSipAddress);
Address fromNameAddress = addressFactory.createAddress(fromAddress);
fromNameAddress.setDisplayName(fromDisplayName);
FromHeader fromHeader = headerFactory.createFromHeader(
fromNameAddress, "12345");
// create To Header
ToHeader toHeader = headerFactory.createToHeader( to.getAddress(),
null);
// get Request URI
SipURI requestURI = (SipURI) to.getAddress().getURI();
ListeningPoint lp = mySipProvider.getListeningPoint(transport);
// Create ViaHeaders
ArrayList viaHeaders = new ArrayList();
ViaHeader viaHeader = headerFactory.createViaHeader("127.0.0.1",
lp.getPort(), transport, null);
// add via headers
viaHeaders.add(viaHeader);
// Create a new CallId header
CallIdHeader callIdHeader = mySipProvider.getNewCallId();
// JvB: Make sure that the implementation matches the messagefactory
callIdHeader = headerFactory.createCallIdHeader( callIdHeader.getCallId() );
// Create a new Cseq header
CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L,
Request.INVITE);
// Create a new MaxForwardsHeader
MaxForwardsHeader maxForwards = headerFactory
.createMaxForwardsHeader(70);
// Create the request. (TODO should read request type from Refer-To)
Request request = messageFactory.createRequest(requestURI,
Request.INVITE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
// Create contact headers
String host = lp.getIPAddress();
SipURI contactURI = addressFactory.createSipURI(fromName, host);
contactURI.setPort(lp.getPort());
contactURI.setTransportParam( transport );
Address contactAddress = addressFactory.createAddress(contactURI);
// Add the contact address.
contactAddress.setDisplayName(fromName);
ContactHeader contactHeader = headerFactory.createContactHeader(contactAddress);
request.addHeader(contactHeader);
// Create the client transaction.
ClientTransaction inviteTid = mySipProvider.getNewClientTransaction(request);
logger.info("Invite Dialog = " + inviteTid.getDialog());
// send the request out.
inviteTid.sendRequest();
} catch (Throwable ex) {
TestHarness.fail("Failed to send INVITE, because of " + ex);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:81,代码来源:Referee.java
示例12: processResponse
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
logger.info("Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
ClientTransaction tid = responseReceivedEvent.getClientTransaction();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
logger.info("Response received : Status Code = "
+ response.getStatusCode() + " " + cseq);
logger.info("Response = " + response + " class=" + response.getClass() );
Dialog dialog = responseReceivedEvent.getDialog();
TestHarness.assertNotNull( dialog );
if (tid != null)
logger.info("transaction state is " + tid.getState());
else
logger.info("transaction = " + tid);
logger.info("Dialog = " + dialog);
logger.info("SHOOTIST: Dialog state is " + dialog.getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
/*
* Can get a late arriving response.
*/
// TestHarness.assertEquals( DialogState.CONFIRMED, dialog.getState());
Request ackRequest = dialog.createAck(cseq
.getSeqNumber());
TestHarness.assertNotNull( ackRequest.getHeader( MaxForwardsHeader.NAME ) );
// Proxy will fork. I will accept the second dialog
// but not the first.
this.forkedDialogs.add(dialog);
logger.info("Sending ACK");
dialog.sendAck(ackRequest);
if ( dialog.getState() == DialogState.TERMINATED ) {
return;
}
if ( forkedDialogs.size() == 2 ) {
TestHarness.assertTrue(
"Dialog state should be CONFIRMED", dialog
.getState() == DialogState.CONFIRMED);
this.ackedDialog = dialog;
// TestHarness.assertNotNull( "JvB: Need CT to find original dialog", tid );
} else {
// Kill the first dialog by sending a bye.
SipProvider sipProvider = (SipProvider) responseReceivedEvent
.getSource();
Request byeRequest = dialog.createRequest(Request.BYE);
ClientTransaction ct = sipProvider
.getNewClientTransaction(byeRequest);
dialog.sendRequest(ct);
}
} else {
logger.info("Response method = " + cseq.getMethod());
}
} else if ( response.getStatusCode() == Response.RINGING ) {
//TestHarness.assertEquals( DialogState.EARLY, dialog.getState() );
}
} catch (Throwable ex) {
ex.printStackTrace();
// System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:78,代码来源:Shootist.java
示例13: processResponse
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public synchronized void processResponse(ResponseEvent responseReceivedEvent) {
logger.info("Got a response");
Response response = (Response) responseReceivedEvent.getResponse();
ClientTransaction tid = responseReceivedEvent.getClientTransaction();
CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME);
logger.info("Response received : Status Code = "
+ response.getStatusCode() + " " + cseq);
logger.info("Response = " + response + " class=" + response.getClass());
Dialog dialog = responseReceivedEvent.getDialog();
TestHarness.assertNotNull(dialog);
if (tid != null)
logger.info("transaction state is " + tid.getState());
else
logger.info("transaction = " + tid);
logger.info("Dialog = " + dialog);
logger.info("Dialog state is " + dialog.getState());
try {
if (response.getStatusCode() == Response.OK) {
if (cseq.getMethod().equals(Request.INVITE)) {
TestHarness.assertEquals(DialogState.CONFIRMED, dialog
.getState());
Request ackRequest = dialog.createAck(cseq.getSeqNumber());
dialog.sendAck(ackRequest);
TestHarness.assertNotNull(ackRequest
.getHeader(MaxForwardsHeader.NAME));
// Proxy will fork. I will accept the second dialog
// but not the first.
SipProvider sipProvider = (SipProvider) responseReceivedEvent
.getSource();
Request infoRequest = dialog.createRequest(Request.INFO);
ClientTransaction ct = sipProvider
.getNewClientTransaction(infoRequest);
dialog.sendRequest(ct);
} else {
logger.info("Response method = " + cseq.getMethod());
}
} else if (response.getStatusCode() == Response.RINGING) {
// TestHarness.assertEquals( DialogState.EARLY,
// dialog.getState() );
}
} catch (Throwable ex) {
ex.printStackTrace();
// System.exit(0);
}
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:59,代码来源:Shootist.java
示例14: createFactoriesAndHeaders
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void createFactoriesAndHeaders(Map<String, Object> parameters, SipComponent component) throws Exception {
headerFactory = sipFactory.createHeaderFactory();
addressFactory = sipFactory.createAddressFactory();
setMessageFactory(sipFactory.createMessageFactory());
fromHeader = component.resolveAndRemoveReferenceParameter(parameters, "fromHeader", FromHeader.class, null);
if (fromHeader == null) {
createFromHeader();
}
if (!presenceAgent) {
toHeader = component.resolveAndRemoveReferenceParameter(parameters, "toHeader", ToHeader.class, null);
if (toHeader == null) {
createToHeader();
}
}
viaHeaders = component.resolveAndRemoveReferenceParameter(parameters, "viaHeaders", List.class, null);
if (viaHeaders == null) {
createViaHeaders();
}
contentTypeHeader = component.resolveAndRemoveReferenceParameter(parameters, "contentTypeHeader", ContentTypeHeader.class, null);
if (contentTypeHeader == null) {
createContentTypeHeader();
}
callIdHeader = component.resolveAndRemoveReferenceParameter(parameters, "callIdHeader", CallIdHeader.class, null);
maxForwardsHeader = component.resolveAndRemoveReferenceParameter(parameters, "maxForwardsHeader", MaxForwardsHeader.class, null);
if (maxForwardsHeader == null) {
createMaxForwardsHeader();
}
// Optional Headers
eventHeader = component.resolveAndRemoveReferenceParameter(parameters, "eventHeader", EventHeader.class, null);
if (eventHeader == null) {
createEventHeader();
}
contactHeader = component.resolveAndRemoveReferenceParameter(parameters, "contactHeader", ContactHeader.class, null);
if (contactHeader == null) {
createContactHeader();
}
expiresHeader = component.resolveAndRemoveReferenceParameter(parameters, "expiresHeader", ExpiresHeader.class, null);
if (expiresHeader == null) {
createExpiresHeader();
}
extensionHeader = component.resolveAndRemoveReferenceParameter(parameters, "extensionHeader", ExtensionHeader.class, null);
}
开发者ID:HydAu,项目名称:Camel,代码行数:48,代码来源:SipConfiguration.java
示例15: getMaxForwardsHeader
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
public MaxForwardsHeader getMaxForwardsHeader() {
return maxForwardsHeader;
}
开发者ID:HydAu,项目名称:Camel,代码行数:4,代码来源:SipConfiguration.java
示例16: MakeRequest
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
*
* @param sipManager - SipManager object
* @param to - identifies receiver IP
* @param message is message that should be send
* @return
* @throws ParseException
* @throws InvalidArgumentException
*/
public Request MakeRequest(SipManager sipManager, String to, String message) throws ParseException, InvalidArgumentException {
AddressFactory addressFactory = sipManager.addressFactory;
sipManager.setCseqNumber((long)sipManager.getCseqNumber()+1l);
//SipURI from = sipManager.addressFactory.createSipURI(sipManager.getSipProfile().getSipUserName(), sipManager.getSipProfile().getLocalEndpoint());
//Address fromNameAddress = sipManager.addressFactory.createAddress(from);
Address fromNameAddress = addressFactory.createAddress("sip:"+ SipManager.sipUserName + "@"+ SipManager.registrarIp);
// fromNameAddress.setDisplayName(sipUsername);
FromHeader fromHeader = sipManager.headerFactory.createFromHeader(fromNameAddress, "SyMPHOnY");
URI toAddress = sipManager.addressFactory.createURI(to);
Address toNameAddress = sipManager.addressFactory.createAddress(toAddress);
// toNameAddress.setDisplayName(username);
ToHeader toHeader = sipManager.headerFactory.createToHeader(toNameAddress, null);
URI requestURI = sipManager.addressFactory.createURI(to);
// requestURI.setTransportParam("udp");
ArrayList<ViaHeader> viaHeaders = sipManager.createViaHeader();
CallIdHeader callIdHeader = sipManager.sipProvider.getNewCallId();
CSeqHeader cSeqHeader = sipManager.headerFactory.createCSeqHeader(sipManager.getCseqNumber(),Request.MESSAGE);
MaxForwardsHeader maxForwards = sipManager.headerFactory
.createMaxForwardsHeader(70);
Request request = sipManager.messageFactory.createRequest(requestURI,
Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
SupportedHeader supportedHeader = sipManager.headerFactory
.createSupportedHeader("replaces, outbound");
request.addHeader(supportedHeader);
SipURI routeUri = sipManager.addressFactory.createSipURI(null,
SipManager.proxyIp);
routeUri.setTransportParam(SipManager.transport);
routeUri.setLrParam();
routeUri.setPort(SipManager.proxyPort);
Address routeAddress = sipManager.addressFactory
.createAddress(routeUri);
RouteHeader route = sipManager.headerFactory
.createRouteHeader(routeAddress);
request.addHeader(route);
ContentTypeHeader contentTypeHeader = sipManager.headerFactory
.createContentTypeHeader("text", "plain");
request.setContent(message, contentTypeHeader);
System.out.println(request);
return request;
}
开发者ID:SyMPHOnY-,项目名称:Smart-Home-Gateway,代码行数:60,代码来源:MessageMessage.java
示例17: init
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
boolean init()
{
try {
SipURI from = addressFactory.createSipURI(getFromUsername(), getFromHost()
+ ":" + getFromPort());
Address fromNameAddress = addressFactory.createAddress(from);
fromNameAddress.setDisplayName(getFromUsername());
FromHeader fromHeader = headerFactory.createFromHeader(fromNameAddress,
getSoftwareVersion());
SipURI toAddress = addressFactory.createSipURI(getToUsername(), getToHost()
+ ":" + getToPort());
Address toNameAddress = addressFactory.createAddress(toAddress);
toNameAddress.setDisplayName(getToUsername());
ToHeader toHeader = headerFactory.createToHeader(toNameAddress, null);
SipURI requestURI = addressFactory.createSipURI(getToUsername(), getToHost()
+ ":" + getToPort());
requestURI.setTransportParam("udp");
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
ViaHeader viaHeader = headerFactory.createViaHeader(getFromHost(),
getFromPort(), "udp", null);
viaHeaders.add(viaHeader);
CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1L, message);
MaxForwardsHeader maxForwards = headerFactory
.createMaxForwardsHeader(70);
request = messageFactory.createRequest(requestURI,
message, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
SipURI contactURI = addressFactory.createSipURI(getFromUsername(),
getFromHost());
contactURI.setPort(getFromPort());
Address contactAddress = addressFactory.createAddress(contactURI);
contactAddress.setDisplayName(getFromUsername());
ContactHeader contactHeader = headerFactory
.createContactHeader(contactAddress);
request.addHeader(contactHeader);
}
catch (Exception e)
{
logger.error("Error initializing stack: ", e);
return false;
}
return true;
}
开发者ID:lmangani,项目名称:Reaper,代码行数:50,代码来源:RequestMessage.java
示例18: getMaxForwards
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
* Get the MaxForwards header (null if one does not exist).
*
* @return Max-Forwards header
*/
public MaxForwardsHeader getMaxForwards() {
return maxForwardsHeader;
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:10,代码来源:SIPMessage.java
示例19: setMaxForwards
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
* Set the max forwards header.
*
* @param maxForwards is the MaxForwardsHeader to set.
*/
public void setMaxForwards(MaxForwardsHeader maxForwards) {
this.setHeader(maxForwards);
}
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:9,代码来源:SIPMessage.java
示例20: setMaxForwardsHeader
import javax.sip.header.MaxForwardsHeader; //导入依赖的package包/类
/**
* A custom Header object containing details on maximum proxy forwards.
* This header places a limit on the viaHeaders possible. Must implement the type javax.sip.header.MaxForwardsHeader
*/
public void setMaxForwardsHeader(MaxForwardsHeader maxForwardsHeader) {
this.maxForwardsHeader = maxForwardsHeader;
}
开发者ID:HydAu,项目名称:Camel,代码行数:8,代码来源:SipConfiguration.java
注:本文中的javax.sip.header.MaxForwardsHeader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论