本文整理了Java中javax.sip.address.Address
类的一些代码示例,展示了Address
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address
类的具体详情如下:
包路径:javax.sip.address.Address
类名称:Address
暂无
代码示例来源:origin: sip3io/tapir
private static URI getURI(HeaderAddress header) {
if (header == null) {
return null;
}
Address address = header.getAddress();
if (address == null) {
return null;
}
return address.getURI();
}
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
final URI newURI = newRequestContactHeader.getAddress().getURI();
newContactHeader.getAddress().setDisplayName(newRequestContactHeader.getAddress().getDisplayName());
SipURI newContactSipURI = (SipURI) newContactHeader.getAddress().getURI();
((SipURI)newContactHeader.getAddress().getURI()).setUser(newSipURI.getUser());
Iterator<String> uriParameters = newSipURI.getParameterNames();
while (uriParameters.hasNext()) {
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public String toString() {
// Returns the value of this address as a String. The resulting string
// must be a valid value of a SIP From or To header.
// To/From are parametrable.
StringBuffer retval = new StringBuffer();
retval.append(address.toString());
//excluding the parameters already present in the address uri
if ( parameters!= null) {
for(Map.Entry<java.lang.String, String> entry : parameters.entrySet()) {
if((!(address.getURI() instanceof Parameters)) || ((Parameters)address.getURI()).getParameter(entry.getKey()) == null) {
String value = entry.getValue();
if(value != null && value.length() > 0) {
retval.append(PARAM_SEPARATOR).append(entry.getKey()).append(PARAM_NAME_VALUE_SEPARATOR).append(value);
} else {
retval.append(PARAM_SEPARATOR).append(entry.getKey());
}
}
}
}
return retval.toString();
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
CallIdHeader callId = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
String username = getHash(callId.getCallId().getBytes());
SipURI uri = (SipURI)ch.getAddress().getURI();
try {
uri.setUser(username);
ch.getAddress().setDisplayName(null);
} catch (ParseException e) {
throw new IllegalStateException("Can't create contact header user part with MD5", e);
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
if(contactHeader != null && (((Parameters)contactHeader.getAddress().getURI()).getParameter("gruu") != null ||
((Parameters)contactHeader.getAddress().getURI()).getParameter("gr") != null)) {
if(logger.isDebugEnabled()) {
logger.debug("not changing existing contact header " + contactHeader + " as it contains gruu");
final javax.sip.address.URI fromUri = fromHeader.getAddress().getURI();
String fromName = null;
String displayName = fromHeader.getAddress().getDisplayName();
if(fromUri instanceof javax.sip.address.SipURI) {
fromName = ((javax.sip.address.SipURI)fromUri).getUser();
boolean sipURI = contactHeader.getAddress().getURI().isSipURI();
if(sipURI) {
javax.sip.address.SipURI contactSipUri = (javax.sip.address.SipURI) contactHeader.getAddress().getURI();
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public void setDisplayName(String name) {
if(SipServletMessageImpl.isSystemHeader(isModifiable)) {
throw new IllegalStateException("this Address is used in a context where it cannot be modified");
}
try {
getAddress().setDisplayName(name);
} catch (ParseException e) {
throw new IllegalArgumentException("illegal name ", e);
}
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public void writeExternal(ObjectOutput out) throws IOException {
out.writeLong(calleeCSeq);
out.writeLong(callerCSeq);
out.writeUTF(calleeContact.toString());
out.writeUTF(callerContact.toString());
out.writeInt(calleeRouteSet.size());
Iterator<javax.sip.address.Address> i = calleeRouteSet.iterator();
while (i.hasNext()) {
javax.sip.address.Address a = i.next();
out.writeUTF(a.toString());
}
out.writeInt(callerRouteSet.size());
i = callerRouteSet.iterator();
while (i.hasNext()) {
javax.sip.address.Address a = i.next();
out.writeUTF(a.toString());
}
out.writeUTF(toHeader.getAddress().toString());
out.writeUTF(toHeader.getTag());
out.writeUTF(fromHeader.getAddress().toString());
out.writeUTF(fromHeader.getTag());
out.writeUTF(callId);
}
代码示例来源:origin: org.jitsi/jain-sip-ri-ossonly
public boolean equals(Object other)
{
if(other instanceof PServedUser)
{
final PServedUserHeader psu = (PServedUserHeader)other;
return this.getAddress().equals(((PServedUser) other).getAddress());
}
return false;
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
ContactHeader contactHeader = null;
FromHeader from = (FromHeader) methodRequest.getHeader(FromHeader.NAME);
String displayName = from.getAddress().getDisplayName();
String userName = null;
javax.sip.address.URI uri = from.getAddress().getURI();
if(uri.isSipURI()) {
userName = ((javax.sip.address.SipURI)uri).getUser();
SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
sipUri.clearUriParms();
if(logger.isDebugEnabled()) {
final AddressImpl currentLocalParty = (AddressImpl)this.getLocalParty().clone();
final AddressImpl currentRemoteParty = (AddressImpl)this.getRemoteParty().clone();
((Parameters)currentRemoteParty .getAddress().getURI()).removeParameter("tag");
((Parameters)currentLocalParty .getAddress().getURI()).removeParameter("tag");
final String originalCallId = ((CallIdHeader)originalRequest.getHeader(CallIdHeader.NAME)).getCallId();
sipServletRequest =(SipServletRequestImpl) sipFactory.createRequest(
SipUri sipUri = (SipUri) sessionCreatingDialog.getRemoteTarget().getURI().clone();
sipUri.clearUriParms();
if(logger.isDebugEnabled()) {
while (routeHeaders.hasNext()) {
RouteHeader routeHeader = routeHeaders.next();
String routeServerId = ((javax.sip.address.SipURI)routeHeader .getAddress().getURI()).
getParameter(MessageDispatcher.RR_PARAM_SERVER_NAME);
String routeAppNameHashed = ((javax.sip.address.SipURI)routeHeader .getAddress().getURI()).
getParameter(MessageDispatcher.RR_PARAM_APPLICATION_NAME);
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public Address createAddress(URI uri, String displayName) {
try {
if (logger.isDebugEnabled()) {
logger.debug("Creating Address from URI[" + uri.toString()
+ "] with display name[" + displayName + "]");
}
javax.sip.address.Address address = SipFactoryImpl.addressFactory
.createAddress(((URIImpl) uri).getURI());
address.setDisplayName(displayName);
return new AddressImpl(address, null, ModifiableRule.Modifiable);
} catch (ParseException e) {
throw new IllegalArgumentException(e);
}
}
代码示例来源:origin: org.jitsi/jain-sip-ri-ossonly
remoteTargetStringified = remoteTarget.toString();
remoteTarget = null;
remotePartyStringified = remoteParty.toString();
remoteParty = null;
localPartyStringified = localParty.toString();
localParty = null;
代码示例来源:origin: org.jitsi/jain-sip-ri-ossonly
public boolean equals(Object other) {
if (this==other) return true;
if (other instanceof HeaderAddress && other instanceof Parameters) {
final HeaderAddress o = (HeaderAddress) other;
return this.getAddress().equals( o.getAddress() ) && this.equalParameters( (Parameters) o );
}
return false;
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public int getExpires() {
String expires = this.getParameter(EXPIRES_PARAM_NAME);
if(expires != null) { // This is how the TCK expects to parse it. See AddressingServlet in TCK spec tests.
return Integer.parseInt(expires);
} else { // I think this is not needed.
return ((SipURI)address.getURI()).getParameter(EXPIRES_PARAM_NAME) == null ? -1 :
Integer.parseInt(((SipURI)address.getURI()).getParameter(EXPIRES_PARAM_NAME));
}
}
/*
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
String displayName = ((MessageExt)newRequest).getFromHeader().getAddress().getDisplayName();
if(newRequest.getHeader(ContactHeader.NAME) != null &&
((ContactHeader)newRequest.getHeader(ContactHeader.NAME)).getAddress().getURI() instanceof javax.sip.address.SipURI) {
fromName = ((javax.sip.address.SipURI)((MessageExt)newRequest).getFromHeader().getAddress().getURI()).getUser();
javax.sip.address.Address contactAddress = addressFactory.createAddress(sipURI);
if(displayName != null && displayName.length() > 0) {
contactAddress.setDisplayName(displayName);
代码示例来源:origin: org.mobicents.examples/call-controller2-sbbs
String toURI = toHeader.getAddress().getURI().toString();
toAddress = getAddressFactory().createAddress(backupAddress.toString());
代码示例来源:origin: org.apache.camel/camel-sip
private void createContactHeader() throws ParseException {
SipURI contactURI = addressFactory.createSipURI(getFromUser(), getFromHost());
contactURI.setTransportParam(getTransport());
contactURI.setPort(Integer.valueOf(getFromPort()).intValue());
Address contactAddress = addressFactory.createAddress(contactURI);
// Add the contact address.
contactAddress.setDisplayName(getFromUser());
contactHeader = headerFactory.createContactHeader(contactAddress);
}
代码示例来源:origin: org.mobicents.ha.javax.sip/restcomm-jain-sip-ha-core
dialogMetaData.put(REMOTE_TARGET, getRemoteTarget().toString());
} else {
dialogMetaData.put(REMOTE_TARGET, null);
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
public Address getPoppedRoute() {
if((this.poppedRoute == null && poppedRouteHeader != null) ||
(poppedRoute != null && poppedRouteHeader != null && !poppedRoute.getAddress().equals(poppedRouteHeader.getAddress()))) {
this.poppedRoute = new AddressImpl(poppedRouteHeader.getAddress(), null, getTransaction() == null ? ModifiableRule.Modifiable : ModifiableRule.NotModifiable);
}
return poppedRoute;
}
代码示例来源:origin: org.mobicents.examples/mobicents-slee-example-sip-jdbc-registrar-sbb
private String getCanonicalAddress(HeaderAddress header) {
String addr = header.getAddress().getURI().toString();
int index = addr.indexOf(':');
index = addr.indexOf(':', index + 1);
if (index != -1) {
// Get rid of the port
addr = addr.substring(0, index);
}
return addr;
}
代码示例来源:origin: org.mobicents.servlet.sip/sip-servlets-impl
final URI contactURI = contactHeaders.next().getAddress().getURI();
String diaplayName = newFromHeader.getAddress().getDisplayName();
if(newFromHeader.getAddress().getURI() instanceof javax.sip.address.SipURI) {
fromName = ((javax.sip.address.SipURI) newFromHeader.getAddress().getURI()).getUser();
javax.sip.address.Address contactAddress = sipFactoryImpl.getAddressFactory().createAddress(sipURI);
if(diaplayName != null && diaplayName.length() > 0) {
contactAddress.setDisplayName(diaplayName);
内容来源于网络,如有侵权,请联系作者删除!