- fix formatting
This commit is contained in:
parent
520d1a3cfc
commit
f305c555f8
82
bbb-voice/src/main/java/org/zoolu/sip/address/NameAddress.java
Normal file → Executable file
82
bbb-voice/src/main/java/org/zoolu/sip/address/NameAddress.java
Normal file → Executable file
@ -23,101 +23,97 @@
|
|||||||
|
|
||||||
package org.zoolu.sip.address;
|
package org.zoolu.sip.address;
|
||||||
|
|
||||||
|
|
||||||
import org.zoolu.sip.provider.SipParser;
|
import org.zoolu.sip.provider.SipParser;
|
||||||
|
|
||||||
|
|
||||||
/** Class <i>NameAddress</i> is used to rapresent any valid SIP Name Address.
|
/** Class <i>NameAddress</i> is used to rapresent any valid SIP Name Address.
|
||||||
* It contains a SIP URI and optionally a display name.
|
* It contains a SIP URI and optionally a display name.
|
||||||
* <BR> A SIP Name Address is a string of the form of:
|
* <BR> A SIP Name Address is a string of the form of:
|
||||||
* <BR><BLOCKQUOTE><PRE>   [ display-name ] address
|
* <BR><BLOCKQUOTE><PRE>   [ display-name ] address
|
||||||
* <BR>   where address can be a valid SIP URL</PRE></BLOCKQUOTE>
|
* <BR>   where address can be a valid SIP URL</PRE></BLOCKQUOTE>
|
||||||
*/
|
*/
|
||||||
public class NameAddress
|
public class NameAddress {
|
||||||
{
|
|
||||||
String name;
|
String name;
|
||||||
SipURL url;
|
SipURL url;
|
||||||
|
|
||||||
|
public NameAddress(String displayname, SipURL sipurl) {
|
||||||
public NameAddress(String displayname, SipURL sipurl)
|
name = displayname;
|
||||||
{ name=displayname;
|
url = sipurl;
|
||||||
url=sipurl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameAddress(SipURL sipurl)
|
public NameAddress(SipURL sipurl) {
|
||||||
{ name=null;
|
name = null;
|
||||||
url=sipurl;
|
url = sipurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameAddress(NameAddress name_address)
|
public NameAddress(NameAddress name_address) {
|
||||||
{ name=name_address.getDisplayName();
|
name = name_address.getDisplayName();
|
||||||
url=name_address.getAddress();
|
url = name_address.getAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameAddress(String naddr)
|
public NameAddress(String naddr) {
|
||||||
{ SipParser par=new SipParser(naddr);
|
SipParser par = new SipParser(naddr);
|
||||||
NameAddress na=par.getNameAddress();
|
NameAddress na = par.getNameAddress();
|
||||||
//DEBUG
|
//DEBUG
|
||||||
//if (na==null)
|
//if (na==null)
|
||||||
//{ System.out.println("DEBUG: NameAddress: par:\r\n"+par.getWholeString());
|
//{ System.out.println("DEBUG: NameAddress: par:\r\n"+par.getWholeString());
|
||||||
// System.exit(0);
|
// System.exit(0);
|
||||||
//}
|
//}
|
||||||
name=na.name;
|
name = na.name;
|
||||||
url=na.url;
|
url = na.url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates and returns a copy of NameAddress */
|
/** Creates and returns a copy of NameAddress */
|
||||||
public Object clone()
|
public Object clone() {
|
||||||
{ return new NameAddress(this);
|
return new NameAddress(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Indicates whether some other Object is "equal to" this NameAddress */
|
/** Indicates whether some other Object is "equal to" this NameAddress */
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj) {
|
||||||
{ NameAddress naddr=(NameAddress)obj;
|
NameAddress naddr = (NameAddress)obj;
|
||||||
return url.equals(naddr.getAddress());
|
return url.equals(naddr.getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets address of NameAddress */
|
/** Gets address of NameAddress */
|
||||||
public SipURL getAddress()
|
public SipURL getAddress() {
|
||||||
{ return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets display name of NameAddress (Returns null id display name does not exist) */
|
/** Gets display name of NameAddress (Returns null id display name does not exist) */
|
||||||
public String getDisplayName()
|
public String getDisplayName() {
|
||||||
{ return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets boolean value to indicate if NameAddress has display name */
|
/** Gets boolean value to indicate if NameAddress has display name */
|
||||||
public boolean hasDisplayName()
|
public boolean hasDisplayName() {
|
||||||
{ return name!=null;
|
return name!=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes display name from NameAddress (if it exists) */
|
/** Removes display name from NameAddress (if it exists) */
|
||||||
public void removeDisplayName()
|
public void removeDisplayName() {
|
||||||
{ name=null;
|
name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets address of NameAddress */
|
/** Sets address of NameAddress */
|
||||||
public void setAddress(SipURL address)
|
public void setAddress(SipURL address) {
|
||||||
{ url=address;
|
url = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets display name of Header */
|
/** Sets display name of Header */
|
||||||
public void setDisplayName(String displayName)
|
public void setDisplayName(String displayName) {
|
||||||
{ name=displayName;
|
name = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether two NameAddresses are equals */
|
/** Whether two NameAddresses are equals */
|
||||||
public boolean equals(NameAddress naddr)
|
public boolean equals(NameAddress naddr) {
|
||||||
{ return (name==naddr.name && url==naddr.url);
|
return (name == naddr.name && url == naddr.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets string representation of NameAddress */
|
/** Gets string representation of NameAddress */
|
||||||
public String toString()
|
public String toString() {
|
||||||
{ String str;
|
String str;
|
||||||
if (hasDisplayName())
|
if (hasDisplayName())
|
||||||
str="\""+name+"\" <"+url+">";
|
str = "\"" + name + "\" <" + url +">";
|
||||||
else str="<"+url+">";
|
else str = "<" + url + ">";
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
239
bbb-voice/src/main/java/org/zoolu/sip/address/SipURL.java
Normal file → Executable file
239
bbb-voice/src/main/java/org/zoolu/sip/address/SipURL.java
Normal file → Executable file
@ -23,20 +23,17 @@
|
|||||||
|
|
||||||
package org.zoolu.sip.address;
|
package org.zoolu.sip.address;
|
||||||
|
|
||||||
|
|
||||||
import org.zoolu.sip.provider.SipParser;
|
import org.zoolu.sip.provider.SipParser;
|
||||||
import org.zoolu.tools.Parser;
|
import org.zoolu.tools.Parser;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
<P> Class <i>SipURL</i> implements SIP URLs.
|
<P> Class <i>SipURL</i> implements SIP URLs.
|
||||||
<P> A SIP URL is a string of the form of:
|
<P> A SIP URL is a string of the form of:
|
||||||
<BR><BLOCKQUOTE><PRE>   sip:[user@]hostname[:port][;parameters] </PRE></BLOCKQUOTE>
|
<BR><BLOCKQUOTE><PRE>   sip:[user@]hostname[:port][;parameters] </PRE></BLOCKQUOTE>
|
||||||
<P> If <i>port</i> number is ommitted, -1 is returned
|
<P> If <i>port</i> number is ommitted, -1 is returned
|
||||||
*/
|
*/
|
||||||
public class SipURL
|
public class SipURL {
|
||||||
{
|
|
||||||
protected String url;
|
protected String url;
|
||||||
|
|
||||||
protected static final String transport_param="transport";
|
protected static final String transport_param="transport";
|
||||||
@ -45,162 +42,164 @@ public class SipURL
|
|||||||
protected static final String lr_param="lr";
|
protected static final String lr_param="lr";
|
||||||
|
|
||||||
/** Creates a new SipURL based on a hostname or on a sip url as sip:[user@]hostname[:port][;param1=value1].. */
|
/** Creates a new SipURL based on a hostname or on a sip url as sip:[user@]hostname[:port][;param1=value1].. */
|
||||||
public SipURL(String sipurl)
|
public SipURL(String sipurl) {
|
||||||
{ if (sipurl.startsWith("sip:")) url=new String(sipurl);
|
if (sipurl.startsWith("sip:")) url=new String(sipurl);
|
||||||
else url="sip:"+sipurl;
|
else url="sip:"+sipurl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a new SipURL */
|
/** Creates a new SipURL */
|
||||||
public SipURL(String username, String hostname)
|
public SipURL(String username, String hostname) {
|
||||||
{ init(username,hostname,-1);
|
init(username,hostname,-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a new SipURL */
|
/** Creates a new SipURL */
|
||||||
public SipURL(String hostname, int portnumber)
|
public SipURL(String hostname, int portnumber) {
|
||||||
{ init(null,hostname,portnumber);
|
init(null, hostname, portnumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates a new SipURL */
|
/** Creates a new SipURL */
|
||||||
public SipURL(String username, String hostname, int portnumber)
|
public SipURL(String username, String hostname, int portnumber) {
|
||||||
{ init(username,hostname,portnumber);
|
init(username,hostname,portnumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Inits the SipURL */
|
/** Inits the SipURL */
|
||||||
private void init(String username, String hostname, int portnumber)
|
private void init(String username, String hostname, int portnumber) {
|
||||||
{ StringBuffer sb=new StringBuffer("sip:");
|
StringBuffer sb = new StringBuffer("sip:");
|
||||||
if (username!=null) sb.append(username).append('@');
|
if (username != null) sb.append(username).append('@');
|
||||||
sb.append(hostname);
|
sb.append(hostname);
|
||||||
if (portnumber>0) sb.append(":"+portnumber);
|
|
||||||
url=sb.toString();
|
if (portnumber > 0) sb.append(":" + portnumber);
|
||||||
|
url = sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Creates and returns a copy of the URL */
|
/** Creates and returns a copy of the URL */
|
||||||
public Object clone()
|
public Object clone() {
|
||||||
{ return new SipURL(url);
|
return new SipURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Indicates whether some other Object is "equal to" this URL */
|
/** Indicates whether some other Object is "equal to" this URL */
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj) {
|
||||||
{ SipURL newurl=(SipURL)obj;
|
SipURL newurl = (SipURL)obj;
|
||||||
return url.toString().equals(newurl.toString());
|
return url.toString().equals(newurl.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets user name of SipURL (Returns null if user name does not exist) */
|
/** Gets user name of SipURL (Returns null if user name does not exist) */
|
||||||
public String getUserName()
|
public String getUserName() {
|
||||||
{ int begin=4; // skip "sip:"
|
int begin = 4; // skip "sip:"
|
||||||
int end=url.indexOf('@',begin);
|
int end = url.indexOf('@',begin);
|
||||||
if (end<0) return null;
|
if (end < 0) return null;
|
||||||
else return url.substring(begin,end);
|
else return url.substring(begin,end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets host of SipURL */
|
/** Gets host of SipURL */
|
||||||
public String getHost()
|
public String getHost() {
|
||||||
{ char[] host_terminators={':',';','?'};
|
char[] host_terminators={':',';','?'};
|
||||||
Parser par=new Parser(url);
|
Parser par = new Parser(url);
|
||||||
int begin=par.indexOf('@'); // skip "sip:user@"
|
int begin = par.indexOf('@'); // skip "sip:user@"
|
||||||
if (begin<0) begin=4; // skip "sip:"
|
if (begin < 0) begin = 4; // skip "sip:"
|
||||||
else begin++; // skip "@"
|
else begin++; // skip "@"
|
||||||
par.setPos(begin);
|
|
||||||
int end=par.indexOf(host_terminators);
|
par.setPos(begin);
|
||||||
if (end<0) return url.substring(begin);
|
int end = par.indexOf(host_terminators);
|
||||||
else return url.substring(begin,end);
|
if (end < 0) return url.substring(begin);
|
||||||
|
else return url.substring(begin,end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets port of SipURL; returns -1 if port is not specidfied */
|
/** Gets port of SipURL; returns -1 if port is not specidfied */
|
||||||
public int getPort()
|
public int getPort() {
|
||||||
{ char[] port_terminators={';','?'};
|
char[] port_terminators={';','?'};
|
||||||
Parser par=new Parser(url,4); // skip "sip:"
|
Parser par = new Parser(url,4); // skip "sip:"
|
||||||
int begin=par.indexOf(':');
|
int begin = par.indexOf(':');
|
||||||
if (begin<0) return -1;
|
if (begin < 0) return -1;
|
||||||
else
|
else {
|
||||||
{ begin++;
|
begin++;
|
||||||
par.setPos(begin);
|
par.setPos(begin);
|
||||||
int end=par.indexOf(port_terminators);
|
int end = par.indexOf(port_terminators);
|
||||||
if (end<0) return Integer.parseInt(url.substring(begin));
|
if (end < 0) return Integer.parseInt(url.substring(begin));
|
||||||
else return Integer.parseInt(url.substring(begin,end));
|
else return Integer.parseInt(url.substring(begin,end));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets boolean value to indicate if SipURL has user name */
|
/** Gets boolean value to indicate if SipURL has user name */
|
||||||
public boolean hasUserName()
|
public boolean hasUserName() {
|
||||||
{ return getUserName()!=null;
|
return getUserName() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets boolean value to indicate if SipURL has port */
|
/** Gets boolean value to indicate if SipURL has port */
|
||||||
public boolean hasPort()
|
public boolean hasPort() {
|
||||||
{ return getPort()>=0;
|
return getPort() >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether two SipURLs are equals */
|
/** Whether two SipURLs are equals */
|
||||||
public boolean equals(SipURL sip_url)
|
public boolean equals(SipURL sip_url) {
|
||||||
{ return (url==sip_url.url);
|
return (url == sip_url.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Gets string representation of URL */
|
/** Gets string representation of URL */
|
||||||
public String toString()
|
public String toString() {
|
||||||
{ return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the value of specified parameter.
|
/** Gets the value of specified parameter.
|
||||||
* @return null if parameter does not exist. */
|
* @return null if parameter does not exist. */
|
||||||
public String getParameter(String name)
|
public String getParameter(String name) {
|
||||||
{ SipParser par=new SipParser(url);
|
SipParser par = new SipParser(url);
|
||||||
return ((SipParser)par.goTo(';').skipChar()).getParameter(name);
|
return ((SipParser)par.goTo(';').skipChar()).getParameter(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Gets a String Vector of parameter names.
|
/** Gets a String Vector of parameter names.
|
||||||
* @return null if no parameter is present */
|
* @return null if no parameter is present */
|
||||||
public Vector getParameters()
|
public Vector getParameters() {
|
||||||
{ SipParser par=new SipParser(url);
|
SipParser par = new SipParser(url);
|
||||||
return ((SipParser)par.goTo(';').skipChar()).getParameters();
|
return ((SipParser)par.goTo(';').skipChar()).getParameters();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether there is the specified parameter */
|
/** Whether there is the specified parameter */
|
||||||
public boolean hasParameter(String name)
|
public boolean hasParameter(String name) {
|
||||||
{ SipParser par=new SipParser(url);
|
SipParser par = new SipParser(url);
|
||||||
return ((SipParser)par.goTo(';').skipChar()).hasParameter(name);
|
return ((SipParser)par.goTo(';').skipChar()).hasParameter(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether there are any parameters */
|
/** Whether there are any parameters */
|
||||||
public boolean hasParameters()
|
public boolean hasParameters() {
|
||||||
{ if (url!=null && url.indexOf(';')>=0) return true;
|
if (url != null && url.indexOf(';') >= 0) return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a new parameter without a value */
|
/** Adds a new parameter without a value */
|
||||||
public void addParameter(String name)
|
public void addParameter(String name) {
|
||||||
{ url=url+";"+name;
|
url = url + ";" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds a new parameter with value */
|
/** Adds a new parameter with value */
|
||||||
public void addParameter(String name, String value)
|
public void addParameter(String name, String value) {
|
||||||
{ if (value!=null) url=url+";"+name+"="+value;
|
if (value != null) url = url + ";" + name + "=" + value;
|
||||||
else url=url+";"+name;
|
else url = url + ";" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes all parameters (if any) */
|
/** Removes all parameters (if any) */
|
||||||
public void removeParameters()
|
public void removeParameters() {
|
||||||
{ int index=url.indexOf(';');
|
int index = url.indexOf(';');
|
||||||
if (index>=0) url=url.substring(0,index);
|
if (index >= 0) url = url.substring(0,index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes specified parameter (if present) */
|
/** Removes specified parameter (if present) */
|
||||||
public void removeParameter(String name)
|
public void removeParameter(String name) {
|
||||||
{ int index=url.indexOf(';');
|
int index = url.indexOf(';');
|
||||||
if (index<0) return;
|
if (index < 0) return;
|
||||||
Parser par=new Parser(url,index);
|
Parser par = new Parser(url,index);
|
||||||
while (par.hasMore())
|
while (par.hasMore()) {
|
||||||
{ int begin_param=par.getPos();
|
int begin_param = par.getPos();
|
||||||
par.skipChar();
|
par.skipChar();
|
||||||
if (par.getWord(SipParser.param_separators).equals(name))
|
if (par.getWord(SipParser.param_separators).equals(name)) {
|
||||||
{ String top=url.substring(0,begin_param);
|
String top = url.substring(0,begin_param);
|
||||||
par.goToSkippingQuoted(';');
|
par.goToSkippingQuoted(';');
|
||||||
String bottom="";
|
String bottom = "";
|
||||||
if (par.hasMore()) bottom=url.substring(par.getPos());
|
if (par.hasMore()) bottom = url.substring(par.getPos());
|
||||||
url=top.concat(bottom);
|
url = top.concat(bottom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
par.goTo(';');
|
par.goTo(';');
|
||||||
}
|
}
|
||||||
@ -209,56 +208,64 @@ public class SipURL
|
|||||||
|
|
||||||
/** Gets the value of transport parameter.
|
/** Gets the value of transport parameter.
|
||||||
* @return null if no transport parameter is present. */
|
* @return null if no transport parameter is present. */
|
||||||
public String getTransport()
|
public String getTransport() {
|
||||||
{ return getParameter(transport_param);
|
return getParameter(transport_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether transport parameter is present */
|
/** Whether transport parameter is present */
|
||||||
public boolean hasTransport()
|
public boolean hasTransport() {
|
||||||
{ return hasParameter(transport_param);
|
return hasParameter(transport_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds transport parameter */
|
/** Adds transport parameter */
|
||||||
public void addTransport(String proto)
|
public void addTransport(String proto) {
|
||||||
{ addParameter(transport_param,proto.toLowerCase());
|
addParameter(transport_param,proto.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Gets the value of maddr parameter.
|
/** Gets the value of maddr parameter.
|
||||||
* @return null if no maddr parameter is present. */
|
* @return null if no maddr parameter is present. */
|
||||||
public String getMaddr()
|
public String getMaddr() {
|
||||||
{ return getParameter(maddr_param);
|
return getParameter(maddr_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether maddr parameter is present */
|
/** Whether maddr parameter is present */
|
||||||
public boolean hasMaddr()
|
public boolean hasMaddr() {
|
||||||
{ return hasParameter(maddr_param);
|
return hasParameter(maddr_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds maddr parameter */
|
/** Adds maddr parameter */
|
||||||
public void addMaddr(String maddr)
|
public void addMaddr(String maddr) {
|
||||||
{ addParameter(maddr_param,maddr);
|
addParameter(maddr_param,maddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Gets the value of ttl parameter.
|
/** Gets the value of ttl parameter.
|
||||||
* @return 1 if no ttl parameter is present. */
|
* @return 1 if no ttl parameter is present. */
|
||||||
public int getTtl()
|
public int getTtl() {
|
||||||
{ try { return Integer.parseInt(getParameter(ttl_param)); } catch (Exception e) { return 1; }
|
try {
|
||||||
}
|
return Integer.parseInt(getParameter(ttl_param));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Whether ttl parameter is present */
|
/** Whether ttl parameter is present */
|
||||||
public boolean hasTtl()
|
public boolean hasTtl() {
|
||||||
{ return hasParameter(ttl_param);
|
return hasParameter(ttl_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds ttl parameter */
|
/** Adds ttl parameter */
|
||||||
public void addTtl(int ttl)
|
public void addTtl(int ttl) {
|
||||||
{ addParameter(ttl_param,Integer.toString(ttl));
|
addParameter(ttl_param,Integer.toString(ttl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Whether lr (loose-route) parameter is present */
|
/** Whether lr (loose-route) parameter is present */
|
||||||
public boolean hasLr()
|
public boolean hasLr() {
|
||||||
{ return hasParameter(lr_param);
|
return hasParameter(lr_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Adds lr parameter */
|
/** Adds lr parameter */
|
||||||
public void addLr()
|
public void addLr() {
|
||||||
{ addParameter(lr_param);
|
addParameter(lr_param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,19 +287,21 @@ public class SipProvider implements Configurable, TransportListener, TcpServerLi
|
|||||||
{
|
{
|
||||||
if (!SipStack.isInit()) SipStack.init();
|
if (!SipStack.isInit()) SipStack.init();
|
||||||
via_addr = viaddr;
|
via_addr = viaddr;
|
||||||
if (via_addr==null || via_addr.equalsIgnoreCase(AUTO_CONFIGURATION)) via_addr=IpAddress.getLocalHostAddress().toString();
|
if (via_addr == null || via_addr.equalsIgnoreCase(AUTO_CONFIGURATION)) via_addr = IpAddress.getLocalHostAddress().toString();
|
||||||
host_port = port;
|
host_port = port;
|
||||||
if (host_port<=0) host_port=SipStack.default_port;
|
if (host_port <= 0) host_port = SipStack.default_port;
|
||||||
host_ipaddr=null;
|
host_ipaddr = null;
|
||||||
if (ifaddr!=null && !ifaddr.equalsIgnoreCase(ALL_INTERFACES))
|
if (ifaddr != null && !ifaddr.equalsIgnoreCase(ALL_INTERFACES)) {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
host_ipaddr=IpAddress.getByName(ifaddr);
|
host_ipaddr = IpAddress.getByName(ifaddr);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace(); host_ipaddr=null;
|
e.printStackTrace();
|
||||||
|
host_ipaddr = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transport_protocols=protocols;
|
|
||||||
|
transport_protocols = protocols;
|
||||||
|
|
||||||
if (transport_protocols==null) transport_protocols=SipStack.default_transport_protocols;
|
if (transport_protocols==null) transport_protocols=SipStack.default_transport_protocols;
|
||||||
default_transport=transport_protocols[0];
|
default_transport=transport_protocols[0];
|
||||||
for (int i=0; i<transport_protocols.length; i++)
|
for (int i=0; i<transport_protocols.length; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user