aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs47
1 files changed, 25 insertions, 22 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
index 8b7c3d0..8d9ba6f 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Voice/SIPVoice/SIPVoiceModule.cs
@@ -43,22 +43,23 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
43{ 43{
44 public class SIPVoiceModule : IRegionModule 44 public class SIPVoiceModule : IRegionModule
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private Scene m_scene; 49 private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
50 private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
50 private IConfig m_config; 51 private IConfig m_config;
52 private Scene m_scene;
51 private string m_sipDomain; 53 private string m_sipDomain;
52 54
53 private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; 55 #region IRegionModule Members
54 private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
55 56
56 public void Initialise(Scene scene, IConfigSource config) 57 public void Initialise(Scene scene, IConfigSource config)
57 { 58 {
58 m_scene = scene; 59 m_scene = scene;
59 m_config = config.Configs["Voice"]; 60 m_config = config.Configs["Voice"];
60 61
61 if (null == m_config || !m_config.GetBoolean("enabled", false)) 62 if (null == m_config || !m_config.GetBoolean("enabled", false))
62 { 63 {
63 m_log.Info("[VOICE] plugin disabled"); 64 m_log.Info("[VOICE] plugin disabled");
64 return; 65 return;
@@ -95,15 +96,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
95 get { return false; } 96 get { return false; }
96 } 97 }
97 98
98 public void OnRegisterCaps(LLUUID agentID, Caps caps) 99 #endregion
100
101 public void OnRegisterCaps(LLUUID agentID, Caps caps)
99 { 102 {
100 m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 103 m_log.DebugFormat("[VOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
101 string capsBase = "/CAPS/" + caps.CapsObjectPath; 104 string capsBase = "/CAPS/" + caps.CapsObjectPath;
102 caps.RegisterHandler("ParcelVoiceInfoRequest", 105 caps.RegisterHandler("ParcelVoiceInfoRequest",
103 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, 106 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
104 delegate(string request, string path, string param) 107 delegate(string request, string path, string param)
105 { 108 {
106 return ParcelVoiceInfoRequest(request, path, param, 109 return ParcelVoiceInfoRequest(request, path, param,
107 agentID, caps); 110 agentID, caps);
108 })); 111 }));
109 caps.RegisterHandler("ProvisionVoiceAccountRequest", 112 caps.RegisterHandler("ProvisionVoiceAccountRequest",
@@ -114,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
114 agentID, caps); 117 agentID, caps);
115 })); 118 }));
116 } 119 }
117 120
118 /// <summary> 121 /// <summary>
119 /// Callback for a client request for ParcelVoiceInfo 122 /// Callback for a client request for ParcelVoiceInfo
120 /// </summary> 123 /// </summary>
@@ -124,8 +127,8 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
124 /// <param name="agentID"></param> 127 /// <param name="agentID"></param>
125 /// <param name="caps"></param> 128 /// <param name="caps"></param>
126 /// <returns></returns> 129 /// <returns></returns>
127 public string ParcelVoiceInfoRequest(string request, string path, string param, 130 public string ParcelVoiceInfoRequest(string request, string path, string param,
128 LLUUID agentID, Caps caps) 131 LLUUID agentID, Caps caps)
129 { 132 {
130 try 133 try
131 { 134 {
@@ -135,15 +138,15 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
135 Hashtable creds = new Hashtable(); 138 Hashtable creds = new Hashtable();
136 139
137 creds["channel_uri"] = String.Format("sip:{0}@{1}", agentID, m_sipDomain); 140 creds["channel_uri"] = String.Format("sip:{0}@{1}", agentID, m_sipDomain);
138 141
139 string regionName = m_scene.RegionInfo.RegionName; 142 string regionName = m_scene.RegionInfo.RegionName;
140 ScenePresence avatar = m_scene.GetScenePresence(agentID); 143 ScenePresence avatar = m_scene.GetScenePresence(agentID);
141 if (null == m_scene.LandChannel) throw new Exception("land data not yet available"); 144 if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
142 LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 145 LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
143 146
144 LLSDParcelVoiceInfoResponse parcelVoiceInfo = 147 LLSDParcelVoiceInfoResponse parcelVoiceInfo =
145 new LLSDParcelVoiceInfoResponse(regionName, land.localID, creds); 148 new LLSDParcelVoiceInfoResponse(regionName, land.localID, creds);
146 149
147 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo); 150 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
148 m_log.DebugFormat("[VOICE][PARCELVOICE]: {0}", r); 151 m_log.DebugFormat("[VOICE][PARCELVOICE]: {0}", r);
149 152
@@ -153,7 +156,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
153 { 156 {
154 m_log.ErrorFormat("[CAPS]: {0}, try again later", e.ToString()); 157 m_log.ErrorFormat("[CAPS]: {0}, try again later", e.ToString());
155 } 158 }
156 159
157 return null; 160 return null;
158 } 161 }
159 162
@@ -166,12 +169,12 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
166 /// <param name="agentID"></param> 169 /// <param name="agentID"></param>
167 /// <param name="caps"></param> 170 /// <param name="caps"></param>
168 /// <returns></returns> 171 /// <returns></returns>
169 public string ProvisionVoiceAccountRequest(string request, string path, string param, 172 public string ProvisionVoiceAccountRequest(string request, string path, string param,
170 LLUUID agentID, Caps caps) 173 LLUUID agentID, Caps caps)
171 { 174 {
172 try 175 try
173 { 176 {
174 m_log.DebugFormat("[VOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", 177 m_log.DebugFormat("[VOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
175 request, path, param); 178 request, path, param);
176 179
177 string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes()); 180 string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
@@ -180,7 +183,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Voice.SIPVoice
180 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); 183 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
181 if (null == userInfo) throw new Exception("cannot get user details"); 184 if (null == userInfo) throw new Exception("cannot get user details");
182 185
183 LLSDVoiceAccountResponse voiceAccountResponse = 186 LLSDVoiceAccountResponse voiceAccountResponse =
184 new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.PasswordHash); 187 new LLSDVoiceAccountResponse(voiceUser, "$1$" + userInfo.UserProfile.PasswordHash);
185 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse); 188 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
186 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r); 189 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);