diff options
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 90 | ||||
-rw-r--r-- | bin/OpenSim.ini.example | 63 | ||||
-rw-r--r-- | bin/Robust.ini.example | 4 |
3 files changed, 75 insertions, 82 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; | |||
37 | using System.Collections.Generic; | 37 | using System.Collections.Generic; |
38 | using System.Reflection; | 38 | using System.Reflection; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using log4net; | 41 | using log4net; |
41 | using Nini.Config; | 42 | using Nini.Config; |
42 | using Nwc.XmlRpc; | 43 | using Nwc.XmlRpc; |
@@ -50,6 +51,9 @@ using OpenSim.Region.Framework.Interfaces; | |||
50 | using OpenSim.Region.Framework.Scenes; | 51 | using OpenSim.Region.Framework.Scenes; |
51 | using Caps = OpenSim.Framework.Capabilities.Caps; | 52 | using Caps = OpenSim.Framework.Capabilities.Caps; |
52 | using System.Text.RegularExpressions; | 53 | using System.Text.RegularExpressions; |
54 | using OpenSim.Server.Base; | ||
55 | using OpenSim.Services.Interfaces; | ||
56 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
53 | 57 | ||
54 | namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice | 58 | namespace 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 | { |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9d34854..988831f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -580,44 +580,33 @@ | |||
580 | [FreeSwitchVoice] | 580 | [FreeSwitchVoice] |
581 | ;; In order for this to work you need a functioning FreeSWITCH PBX set up. | 581 | ;; In order for this to work you need a functioning FreeSWITCH PBX set up. |
582 | ;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module | 582 | ;; Configuration details at http://opensimulator.org/wiki/Freeswitch_Module |
583 | ; enabled = false | 583 | ; Enabled = false |
584 | 584 | ||
585 | ;; FreeSWITCH server is going to contact us and ask us all sorts of things | 585 | ;; You need to load a local service for a standalone, and a remote service |
586 | ; freeswitch_server_user = freeswitch | 586 | ;; for a grid region. Use one of the lines below, as appropriate |
587 | ; freeswitch_server_pass = password | 587 | ; LocalServiceModule = OpenSim.Services.FreeswitchService.dll:FreeswitchService |
588 | ; freeswitch_api_prefix = /api | 588 | ; LocalServiceModule = OpenSim.Services.Connectors.dll:RemoteFreeswitchConnector |
589 | 589 | ||
590 | ;; external IP address of your OpenSim voice enabled region | 590 | ;; If using a remote module, specify the server URL |
591 | ;; note: all regions running on same OpenSim.exe will be enabled | 591 | ; FreeswitchServiceURL = http://my.grid.server:8003/fsapi |
592 | ; freeswitch_service_server = ip.address.of.your.sim | 592 | |
593 | 593 | [FreeswitchService] | |
594 | ;; this should be the same port the region listens on | 594 | ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! |
595 | ; freeswitch_service_port = 9000 | 595 | ;; !!!!!!STANDALONE ONLY!!!!!! |
596 | ; freeswitch_realm = ip.address.of.freeswitch.server | 596 | ;; !!!!!!!!!!!!!!!!!!!!!!!!!!! |
597 | ; freeswitch_sip_proxy = ip.address.of.freeswitch.server:5060 | 597 | ;; IP of your FS server |
598 | 598 | ;ServerAddress = 85.25.142.92 | |
599 | ;; STUN = Simple Traversal of UDP through NATs | 599 | |
600 | ;; See http://wiki.freeswitch.org/wiki/NAT_Traversal | 600 | ;; All other options are - well - optional |
601 | ;; stun.freeswitch.org is not guaranteed to be running so use it in | 601 | ; Realm = "127.0.0.1" |
602 | ;; production at your own risk | 602 | ; SIPProxy = "127.0.0.1:5060" |
603 | ; freeswitch_attempt_stun = false | 603 | ; EchoServer = "127.0.0.1" |
604 | ; freeswitch_stun_server = ip.address.of.stun.server | 604 | ; EchoPort = 50505 |
605 | ; freeswitch_echo_server = ip.address.of.freeswitch.server | 605 | ; AttemptSTUN = "false" |
606 | ; freeswitch_echo_port = 50505 | 606 | ; DefaultTimeout = 5000 |
607 | ; freeswitch_well_known_ip = ip.address.of.freeswitch.server | 607 | ; Context = "default" |
608 | 608 | ; UserName = "freeswitch" | |
609 | ;; Type the address of your http server here, hostname is allowed. | 609 | ; Password = "password" |
610 | ;; This is provided so you can specify a hostname | ||
611 | ;; This is used by client for account verification. By default, it's the | ||
612 | ;; same as the freeswitch service server. | ||
613 | ; opensim_well_known_http_address = Address_Of_Your_SIM_HTTP_Server | ||
614 | |||
615 | ;; Timeouts | ||
616 | ; freeswitch_default_timeout = 5000 | ||
617 | ; freeswitch_subscribe_retry = 120 | ||
618 | |||
619 | ;; Misc | ||
620 | ; freeswitch_password_reset_url = | ||
621 | 610 | ||
622 | [Groups] | 611 | [Groups] |
623 | ;# {Enabled} {} {Enable groups?} {true false} false | 612 | ;# {Enabled} {} {Enable groups?} {true false} false |
diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 5973f70..b12e05b 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example | |||
@@ -73,8 +73,8 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 | |||
73 | ; ServerAddress = 127.0.0.1 | 73 | ; ServerAddress = 127.0.0.1 |
74 | 74 | ||
75 | ;; All other options are - well - optional | 75 | ;; All other options are - well - optional |
76 | ; Realm = 1"27.0.0.1" | 76 | ; Realm = "127.0.0.1" |
77 | ; SIPProxy = 1"27.0.0.1:5060" | 77 | ; SIPProxy = "127.0.0.1:5060" |
78 | ; EchoServer = "127.0.0.1" | 78 | ; EchoServer = "127.0.0.1" |
79 | ; EchoPort = 50505 | 79 | ; EchoPort = 50505 |
80 | ; AttemptSTUN = "false" | 80 | ; AttemptSTUN = "false" |