Commit 51e60be8 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Rayo plugin - Added support for SIP over TCP transport

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13774 b35dd754-fafc-0310-a699-88a17e54d16e
parent c8b2a138
...@@ -166,7 +166,8 @@ public class SipServer implements SipListener { ...@@ -166,7 +166,8 @@ public class SipServer implements SipListener {
return; return;
} }
ListeningPoint lp = null; ListeningPoint udpListenPort = null;
ListeningPoint tcpListenPort = null;
try { try {
/* /*
...@@ -176,28 +177,29 @@ public class SipServer implements SipListener { ...@@ -176,28 +177,29 @@ public class SipServer implements SipListener {
* port to assign to outgoing messages from this provider * port to assign to outgoing messages from this provider
* at this point. * at this point.
*/ */
String s = System.getProperty( String s = System.getProperty("com.sun.voip.server.SIP_PORT", String.valueOf(SIP_PORT));
"gov.nist.jainsip.stack.enableUDP", String.valueOf(SIP_PORT)); int sipPort = Integer.parseInt(s);
int sipPort = Integer.parseInt(s); Logger.println("");
Logger.println("Bridge private address: " + properties.getProperty("javax.sip.IP_ADDRESS"));
lp = sipStack.createListeningPoint(sipPort, "tcp");
sipProvider = sipStack.createSipProvider(lp);
sipProvider.addSipListener(this);
lp = sipStack.createListeningPoint(sipPort, "udp"); String protocol = System.getProperty("com.sun.voip.server.PROTOCOL");
sipAddress = new InetSocketAddress(sipStack.getIPAddress(), sipPort); if ("tcp".equals(protocol))
{
tcpListenPort = sipStack.createListeningPoint(sipPort, "tcp");
sipProvider = sipStack.createSipProvider(tcpListenPort);
}
sipProvider = sipStack.createSipProvider(lp); if ("udp".equals(protocol))
{
udpListenPort = sipStack.createListeningPoint(sipPort, "udp");
sipProvider = sipStack.createSipProvider(udpListenPort);
}
sipProvider.addSipListener(this); sipProvider.addSipListener(this);
Logger.println(""); sipAddress = new InetSocketAddress(sipStack.getIPAddress(), sipPort);
Logger.println("Bridge private address: " + properties.getProperty("javax.sip.IP_ADDRESS"));
Logger.println("Bridge private SIP port: " + lp.getPort());
/* /*
* get IPs of the SIP Proxy server * get IPs of the SIP Proxy server
......
...@@ -556,8 +556,7 @@ if (false) { ...@@ -556,8 +556,7 @@ if (false) {
* 152.70.1.43:5060 == (local address and SIP port) * 152.70.1.43:5060 == (local address and SIP port)
* branch=z9hG4bk5 == (auto generated branch id) * branch=z9hG4bk5 == (auto generated branch id)
*/ */
viaHeader = headerFactory.createViaHeader(ourIpAddress, viaHeader = headerFactory.createViaHeader(ourIpAddress, ourSipPort, sipProvider.getListeningPoint().getTransport(), null);
ourSipPort, "udp", null);
//viaHeader.setBranch(MessageFactoryImpl.generateBranchId()); //viaHeader.setBranch(MessageFactoryImpl.generateBranchId());
viaHeaders = new ArrayList(); viaHeaders = new ArrayList();
viaHeaders.add(viaHeader); viaHeaders.add(viaHeader);
...@@ -769,7 +768,8 @@ if (false) { ...@@ -769,7 +768,8 @@ if (false) {
*/ */
Dialog dialog = clientTransaction.getDialog(); Dialog dialog = clientTransaction.getDialog();
Request ackRequest = dialog.createRequest(Request.ACK); //Request ackRequest = dialog.createRequest(Request.ACK);
Request ackRequest = clientTransaction.createAck();
dialog.sendAck(ackRequest); dialog.sendAck(ackRequest);
return; return;
......
...@@ -44,6 +44,8 @@ public class Application implements CallEventListener { ...@@ -44,6 +44,8 @@ public class Application implements CallEventListener {
System.setProperty("com.sun.voip.server.BRIDGE_LOG", "bridge.log"); System.setProperty("com.sun.voip.server.BRIDGE_LOG", "bridge.log");
System.setProperty("com.sun.voip.server.LOGLEVEL", "99"); System.setProperty("com.sun.voip.server.LOGLEVEL", "99");
System.setProperty("com.sun.voip.server.PUBLIC_IP_ADDRESS", config.getPublicHost()); System.setProperty("com.sun.voip.server.PUBLIC_IP_ADDRESS", config.getPublicHost());
System.setProperty("com.sun.voip.server.PROTOCOL", config.getDefaultProtocol());
System.setProperty("com.sun.voip.server.SIP_PORT", config.getDefaultSIPPort());
System.setProperty("com.sun.voip.server.Bridge.recordDirectory", pluginDirectory.getAbsolutePath() + File.separator + ".." + File.separator + ".." + File.separator + "rayo" + File.separator + "recordings"); System.setProperty("com.sun.voip.server.Bridge.recordDirectory", pluginDirectory.getAbsolutePath() + File.separator + ".." + File.separator + ".." + File.separator + "rayo" + File.separator + "recordings");
System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
......
...@@ -40,6 +40,8 @@ public class Config implements MUCEventListener { ...@@ -40,6 +40,8 @@ public class Config implements MUCEventListener {
private String publicHost = JiveGlobals.getProperty("voicebridge.default.public.host", "127.0.0.1"); private String publicHost = JiveGlobals.getProperty("voicebridge.default.public.host", "127.0.0.1");
private String conferenceExten = JiveGlobals.getProperty("voicebridge.default.conf.exten", "default"); private String conferenceExten = JiveGlobals.getProperty("voicebridge.default.conf.exten", "default");
private String defaultProxy = JiveGlobals.getProperty("voicebridge.default.proxy.name", null); private String defaultProxy = JiveGlobals.getProperty("voicebridge.default.proxy.name", null);
private String defaultProtocol = JiveGlobals.getProperty("voicebridge.default.protocol", "udp");
private String defaultSIPPort = JiveGlobals.getProperty("voicebridge.default.sip.port", "5060");
private boolean prefixPhoneNumber = true; private boolean prefixPhoneNumber = true;
private String internationalPrefix = "00"; // for international calls private String internationalPrefix = "00"; // for international calls
...@@ -584,6 +586,14 @@ public class Config implements MUCEventListener { ...@@ -584,6 +586,14 @@ public class Config implements MUCEventListener {
{ {
return defaultProxy; return defaultProxy;
} }
public String getDefaultProtocol()
{
return defaultProtocol;
}
public String getDefaultSIPPort()
{
return defaultSIPPort;
}
public ArrayList<String> getRegistrars() public ArrayList<String> getRegistrars()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment