aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/Voice
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/Voice')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs55
1 files changed, 52 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index 65c5274..6b30959 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -53,7 +53,7 @@ using System.Text.RegularExpressions;
53 53
54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice 54namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
55{ 55{
56 public class FreeSwitchVoiceModule : IRegionModule 56 public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule
57 { 57 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
@@ -101,13 +101,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
101 private FreeSwitchDialplan m_FreeSwitchDialplan; 101 private FreeSwitchDialplan m_FreeSwitchDialplan;
102 102
103 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); 103 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
104 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
105
106 private Scene m_scene;
104 107
105 108
106 private IConfig m_config; 109 private IConfig m_config;
107 110
108 public void Initialise(Scene scene, IConfigSource config) 111 public void Initialise(Scene scene, IConfigSource config)
109 { 112 {
110 113 m_scene = scene;
111 m_config = config.Configs["FreeSwitchVoice"]; 114 m_config = config.Configs["FreeSwitchVoice"];
112 115
113 if (null == m_config) 116 if (null == m_config)
@@ -230,6 +233,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
230 { 233 {
231 OnRegisterCaps(scene, agentID, caps); 234 OnRegisterCaps(scene, agentID, caps);
232 }; 235 };
236
237
233 238
234 try 239 try
235 { 240 {
@@ -255,6 +260,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
255 260
256 public void PostInitialise() 261 public void PostInitialise()
257 { 262 {
263 if(m_pluginEnabled)
264 {
265 m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene");
266
267 // register the voice interface for this module, so the script engine can call us
268 m_scene.RegisterModuleInterface<IVoiceModule>(this);
269 }
258 } 270 }
259 271
260 public void Close() 272 public void Close()
@@ -270,7 +282,27 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
270 { 282 {
271 get { return true; } 283 get { return true; }
272 } 284 }
273 285
286 // <summary>
287 // implementation of IVoiceModule, called by osSetParcelSIPAddress script function
288 // </summary>
289 public void setLandSIPAddress(string SIPAddress,UUID GlobalID)
290 {
291 m_log.DebugFormat("[FreeSwitchVoice]: setLandSIPAddress parcel id {0}: setting sip address {1}",
292 GlobalID, SIPAddress);
293
294 lock (m_ParcelAddress)
295 {
296 if (m_ParcelAddress.ContainsKey(GlobalID.ToString()))
297 {
298 m_ParcelAddress[GlobalID.ToString()] = SIPAddress;
299 }
300 else
301 {
302 m_ParcelAddress.Add(GlobalID.ToString(), SIPAddress);
303 }
304 }
305 }
274 306
275 // <summary> 307 // <summary>
276 // OnRegisterCaps is invoked via the scene.EventManager 308 // OnRegisterCaps is invoked via the scene.EventManager
@@ -776,6 +808,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
776 808
777 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same 809 // Create parcel voice channel. If no parcel exists, then the voice channel ID is the same
778 // as the directory ID. Otherwise, it reflects the parcel's ID. 810 // as the directory ID. Otherwise, it reflects the parcel's ID.
811
812 lock (m_ParcelAddress)
813 {
814 if (m_ParcelAddress.ContainsKey( land.GlobalID.ToString() ))
815 {
816 m_log.DebugFormat("[FreeSwitchVoice]: parcel id {0}: using sip address {1}",
817 land.GlobalID, m_ParcelAddress[land.GlobalID.ToString()]);
818 return m_ParcelAddress[land.GlobalID.ToString()];
819 }
820 }
779 821
780 if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0) 822 if (land.LocalID != 1 && (land.Flags & (uint)ParcelFlags.UseEstateVoiceChan) == 0)
781 { 823 {
@@ -797,6 +839,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
797 // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator. 839 // the personal speech indicators as well unless some siren14-3d codec magic happens. we dont have siren143d so we'll settle for the personal speech indicator.
798 channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm); 840 channelUri = String.Format("sip:conf-{0}@{1}", "x" + Convert.ToBase64String(encoding.GetBytes(landUUID)), m_freeSwitchRealm);
799 841
842 lock (m_ParcelAddress)
843 {
844 if (!m_ParcelAddress.ContainsKey(land.GlobalID.ToString()))
845 {
846 m_ParcelAddress.Add(land.GlobalID.ToString(),channelUri);
847 }
848 }
800 849
801 return channelUri; 850 return channelUri;
802 } 851 }