aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs90
1 files changed, 47 insertions, 43 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 4095674..a5e553c 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -37,6 +37,7 @@ using System.Collections;
37using System.Collections.Generic; 37using System.Collections.Generic;
38using System.Reflection; 38using System.Reflection;
39using OpenMetaverse; 39using OpenMetaverse;
40using OpenMetaverse.StructuredData;
40using log4net; 41using log4net;
41using Nini.Config; 42using Nini.Config;
42using Nwc.XmlRpc; 43using Nwc.XmlRpc;
@@ -50,6 +51,9 @@ using OpenSim.Region.Framework.Interfaces;
50using OpenSim.Region.Framework.Scenes; 51using OpenSim.Region.Framework.Scenes;
51using Caps = OpenSim.Framework.Capabilities.Caps; 52using Caps = OpenSim.Framework.Capabilities.Caps;
52using System.Text.RegularExpressions; 53using System.Text.RegularExpressions;
54using OpenSim.Server.Base;
55using OpenSim.Services.Interfaces;
56using OSDMap = OpenMetaverse.StructuredData.OSDMap;
53 57
54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 58namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
55{ 59{
@@ -58,8 +62,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
58 { 62 {
59 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 63 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
60 64
61 private bool UseProxy = false;
62
63 // Capability string prefixes 65 // Capability string prefixes
64 private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; 66 private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
65 private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; 67 private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
@@ -70,8 +72,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
70 72
71 // FreeSwitch server is going to contact us and ask us all 73 // FreeSwitch server is going to contact us and ask us all
72 // sorts of things. 74 // sorts of things.
73 private static string m_freeSwitchServerUser;
74 private static string m_freeSwitchServerPass;
75 75
76 // SLVoice client will do a GET on this prefix 76 // SLVoice client will do a GET on this prefix
77 private static string m_freeSwitchAPIPrefix; 77 private static string m_freeSwitchAPIPrefix;
@@ -85,73 +85,69 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
85 private static string m_freeSwitchRealm; 85 private static string m_freeSwitchRealm;
86 private static string m_freeSwitchSIPProxy; 86 private static string m_freeSwitchSIPProxy;
87 private static bool m_freeSwitchAttemptUseSTUN; 87 private static bool m_freeSwitchAttemptUseSTUN;
88 // private static string m_freeSwitchSTUNServer;
89 private static string m_freeSwitchEchoServer; 88 private static string m_freeSwitchEchoServer;
90 private static int m_freeSwitchEchoPort; 89 private static int m_freeSwitchEchoPort;
91 private static string m_freeSwitchDefaultWellKnownIP; 90 private static string m_freeSwitchDefaultWellKnownIP;
92 private static int m_freeSwitchDefaultTimeout; 91 private static int m_freeSwitchDefaultTimeout;
93 // private static int m_freeSwitchSubscribeRetry;
94 private static string m_freeSwitchUrlResetPassword; 92 private static string m_freeSwitchUrlResetPassword;
95 // private static IPEndPoint m_FreeSwitchServiceIP; 93 private uint m_freeSwitchServicePort;
96 private int m_freeSwitchServicePort;
97 private string m_openSimWellKnownHTTPAddress; 94 private string m_openSimWellKnownHTTPAddress;
98 private string m_freeSwitchContext; 95 private string m_freeSwitchContext;
99 96
100 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); 97 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
101 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); 98 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
102 99
103 private Scene m_scene; 100 private Scene m_Scene;
104 101
102 private IConfig m_Config;
105 103
106 private IConfig m_config; 104 private IFreeswitchService m_FreeswitchService;
107 105
108 public void Initialise(IConfigSource config) 106 public void Initialise(IConfigSource config)
109 { 107 {
110 m_config = config.Configs["FreeSwitchVoice"]; 108 m_Config = config.Configs["FreeSwitchVoice"];
111 109
112 if (null == m_config) 110 if (m_Config == null)
113 { 111 {
114 m_log.Info("[FreeSwitchVoice] no config found, plugin disabled"); 112 m_log.Info("[FreeSwitchVoice] no config found, plugin disabled");
115 return; 113 return;
116 } 114 }
117 115
118 if (!m_config.GetBoolean("enabled", false)) 116 if (!m_Config.GetBoolean("Enabled", false))
119 { 117 {
120 m_log.Info("[FreeSwitchVoice] plugin disabled by configuration"); 118 m_log.Info("[FreeSwitchVoice] plugin disabled by configuration");
121 return; 119 return;
122 } 120 }
123 121
124 m_Enabled = true;
125
126 try 122 try
127 { 123 {
128 m_freeSwitchServerUser = m_config.GetString("freeswitch_server_user", String.Empty); 124 string serviceDll = m_Config.GetString("LocalServiceModule",
129 m_freeSwitchServerPass = m_config.GetString("freeswitch_server_pass", String.Empty); 125 String.Empty);
130 m_freeSwitchAPIPrefix = m_config.GetString("freeswitch_api_prefix", String.Empty); 126
131 127 if (serviceDll == String.Empty)
132 // XXX: get IP address of HTTP server. (This can be this OpenSim server or another, or could be a dedicated grid service or may live on the freeswitch server) 128 {
133 129 m_log.Error("[FreeSwitchVoice]: No LocalServiceModule named in section FreeSwitchVoice");
134 string serviceIP = m_config.GetString("freeswitch_service_server", String.Empty); 130 return;
135 int servicePort = m_config.GetInt("freeswitch_service_port", 80); 131 }
136 IPAddress serviceIPAddress = IPAddress.Parse(serviceIP); 132
137 // m_FreeSwitchServiceIP = new IPEndPoint(serviceIPAddress, servicePort); 133 Object[] args = new Object[] { config };
138 m_freeSwitchServicePort = servicePort; 134 m_FreeswitchService = ServerUtils.LoadPlugin<IFreeswitchService>(serviceDll, args);
139 m_freeSwitchRealm = m_config.GetString("freeswitch_realm", String.Empty); 135
140 m_freeSwitchSIPProxy = m_config.GetString("freeswitch_sip_proxy", m_freeSwitchRealm); 136 string jsonConfig = m_FreeswitchService.GetJsonConfig();
141 m_freeSwitchAttemptUseSTUN = m_config.GetBoolean("freeswitch_attempt_stun", true); 137 OSDMap map = (OSDMap)OSDParser.DeserializeJson(jsonConfig);
142 // m_freeSwitchSTUNServer = m_config.GetString("freeswitch_stun_server", m_freeSwitchRealm); 138
143 m_freeSwitchEchoServer = m_config.GetString("freeswitch_echo_server", m_freeSwitchRealm); 139 m_freeSwitchAPIPrefix = map["APIPrefix"].AsString();
144 m_freeSwitchEchoPort = m_config.GetInt("freeswitch_echo_port", 50505); 140 m_freeSwitchRealm = map["Realm"].AsString();
145 m_freeSwitchDefaultWellKnownIP = m_config.GetString("freeswitch_well_known_ip", m_freeSwitchRealm); 141 m_freeSwitchSIPProxy = map["SIPProxy"].AsString();
146 m_openSimWellKnownHTTPAddress = m_config.GetString("opensim_well_known_http_address", serviceIPAddress.ToString()); 142 m_freeSwitchAttemptUseSTUN = map["AttemptUseSTUN"].AsBoolean();
147 m_freeSwitchDefaultTimeout = m_config.GetInt("freeswitch_default_timeout", 5000); 143 m_freeSwitchEchoServer = map["EchoServer"].AsString();
148 // m_freeSwitchSubscribeRetry = m_config.GetInt("freeswitch_subscribe_retry", 120); 144 m_freeSwitchEchoPort = map["EchoPort"].AsInteger();
149 m_freeSwitchUrlResetPassword = m_config.GetString("freeswitch_password_reset_url", String.Empty); 145 m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString();
150 m_freeSwitchContext = m_config.GetString("freeswitch_context", "default"); 146 m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger();
151 147 m_freeSwitchUrlResetPassword = String.Empty;
152 if (String.IsNullOrEmpty(m_freeSwitchServerUser) || 148 m_freeSwitchContext = map["Context"].AsString();
153 String.IsNullOrEmpty(m_freeSwitchServerPass) || 149
154 String.IsNullOrEmpty(m_freeSwitchRealm) || 150 if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
155 String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) 151 String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
156 { 152 {
157 m_log.Error("[FreeSwitchVoice] plugin mis-configured"); 153 m_log.Error("[FreeSwitchVoice] plugin mis-configured");
@@ -211,6 +207,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
211 } 207 }
212 catch (Exception) 208 catch (Exception)
213 { 209 {
210 // COmmented multiline spam log message
214 //m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); 211 //m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions.");
215 } 212 }
216 } 213 }
@@ -218,7 +215,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
218 215
219 public void AddRegion(Scene scene) 216 public void AddRegion(Scene scene)
220 { 217 {
221 m_scene = scene; 218 m_Scene = scene;
219
220 // We generate these like this: The region's external host name
221 // as defined in Regions.ini is a good address to use. It's a
222 // dotted quad (or should be!) and it can reach this host from
223 // a client. The port is grabbed from the region's HTTP server.
224 m_openSimWellKnownHTTPAddress = m_Scene.RegionInfo.ExternalHostName;
225 m_freeSwitchServicePort = MainServer.Instance.Port;
222 226
223 if (m_Enabled) 227 if (m_Enabled)
224 { 228 {