aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice
diff options
context:
space:
mode:
authorJeff Ames2008-05-01 14:31:30 +0000
committerJeff Ames2008-05-01 14:31:30 +0000
commitd51ce47b2d7635b17f3dd429158e8f59b78b83aa (patch)
treed3595bd5194199184059aa398b91a51dc6c799cf /OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice
parent* Looks like I had the bamboo build right in the first place - it was just th... (diff)
downloadopensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.zip
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.gz
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.bz2
opensim-SC_OLD-d51ce47b2d7635b17f3dd429158e8f59b78b83aa.tar.xz
Update svn properties. Minor formatting cleanup.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs578
1 files changed, 289 insertions, 289 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
index 44d67e6..f8f6ec2 100644
--- a/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
+++ b/OpenSim/Region/Environment/Modules/Avatar/Voice/AsterixVoice/AsteriskVoiceModule.cs
@@ -1,290 +1,290 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Reflection; 30using System.Reflection;
31using libsecondlife; 31using libsecondlife;
32using log4net; 32using log4net;
33using Nini.Config; 33using Nini.Config;
34using Nwc.XmlRpc; 34using Nwc.XmlRpc;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Region.Capabilities; 38using OpenSim.Region.Capabilities;
39using OpenSim.Region.Environment.Interfaces; 39using OpenSim.Region.Environment.Interfaces;
40using OpenSim.Region.Environment.Scenes; 40using OpenSim.Region.Environment.Scenes;
41using Caps=OpenSim.Region.Capabilities.Caps; 41using Caps=OpenSim.Region.Capabilities.Caps;
42 42
43namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice 43namespace OpenSim.Region.Environment.Modules.Avatar.Voice.AsterixVoice
44{ 44{
45 public class AsteriskVoiceModule : IRegionModule 45 public class AsteriskVoiceModule : IRegionModule
46 { 46 {
47 private static readonly ILog m_log = 47 private static readonly ILog m_log =
48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
50 private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; 50 private static readonly string m_parcelVoiceInfoRequestPath = "0007/";
51 private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; 51 private static readonly string m_provisionVoiceAccountRequestPath = "0008/";
52 52
53 private string m_asterisk; 53 private string m_asterisk;
54 private string m_asterisk_password; 54 private string m_asterisk_password;
55 private string m_asterisk_salt; 55 private string m_asterisk_salt;
56 private int m_asterisk_timeout; 56 private int m_asterisk_timeout;
57 private string m_confDomain; 57 private string m_confDomain;
58 private IConfig m_config; 58 private IConfig m_config;
59 private Scene m_scene; 59 private Scene m_scene;
60 private string m_sipDomain; 60 private string m_sipDomain;
61 61
62 #region IRegionModule Members 62 #region IRegionModule Members
63 63
64 public void Initialise(Scene scene, IConfigSource config) 64 public void Initialise(Scene scene, IConfigSource config)
65 { 65 {
66 m_scene = scene; 66 m_scene = scene;
67 m_config = config.Configs["AsteriskVoice"]; 67 m_config = config.Configs["AsteriskVoice"];
68 68
69 if (null == m_config) 69 if (null == m_config)
70 { 70 {
71 m_log.Info("[ASTERISKVOICE] no config found, plugin disabled"); 71 m_log.Info("[ASTERISKVOICE] no config found, plugin disabled");
72 return; 72 return;
73 } 73 }
74 74
75 if (!m_config.GetBoolean("enabled", false)) 75 if (!m_config.GetBoolean("enabled", false))
76 { 76 {
77 m_log.Info("[ASTERISKVOICE] plugin disabled by configuration"); 77 m_log.Info("[ASTERISKVOICE] plugin disabled by configuration");
78 return; 78 return;
79 } 79 }
80 m_log.Info("[ASTERISKVOICE] plugin enabled"); 80 m_log.Info("[ASTERISKVOICE] plugin enabled");
81 81
82 try 82 try
83 { 83 {
84 m_sipDomain = m_config.GetString("sip_domain", String.Empty); 84 m_sipDomain = m_config.GetString("sip_domain", String.Empty);
85 m_log.InfoFormat("[ASTERISKVOICE] using SIP domain {0}", m_sipDomain); 85 m_log.InfoFormat("[ASTERISKVOICE] using SIP domain {0}", m_sipDomain);
86 86
87 m_confDomain = m_config.GetString("conf_domain", String.Empty); 87 m_confDomain = m_config.GetString("conf_domain", String.Empty);
88 m_log.InfoFormat("[ASTERISKVOICE] using conf domain {0}", m_confDomain); 88 m_log.InfoFormat("[ASTERISKVOICE] using conf domain {0}", m_confDomain);
89 89
90 m_asterisk = m_config.GetString("asterisk_frontend", String.Empty); 90 m_asterisk = m_config.GetString("asterisk_frontend", String.Empty);
91 m_asterisk_password = m_config.GetString("asterisk_password", String.Empty); 91 m_asterisk_password = m_config.GetString("asterisk_password", String.Empty);
92 m_asterisk_timeout = m_config.GetInt("asterisk_timeout", 3000); 92 m_asterisk_timeout = m_config.GetInt("asterisk_timeout", 3000);
93 m_asterisk_salt = m_config.GetString("asterisk_salt", "Wuffwuff"); 93 m_asterisk_salt = m_config.GetString("asterisk_salt", "Wuffwuff");
94 if (String.IsNullOrEmpty(m_asterisk)) throw new Exception("missing asterisk_frontend config parameter"); 94 if (String.IsNullOrEmpty(m_asterisk)) throw new Exception("missing asterisk_frontend config parameter");
95 if (String.IsNullOrEmpty(m_asterisk_password)) throw new Exception("missing asterisk_password config parameter"); 95 if (String.IsNullOrEmpty(m_asterisk_password)) throw new Exception("missing asterisk_password config parameter");
96 m_log.InfoFormat("[ASTERISKVOICE] using asterisk front end {0}", m_asterisk); 96 m_log.InfoFormat("[ASTERISKVOICE] using asterisk front end {0}", m_asterisk);
97 97
98 scene.EventManager.OnRegisterCaps += OnRegisterCaps; 98 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
99 } 99 }
100 catch (Exception e) 100 catch (Exception e)
101 { 101 {
102 m_log.ErrorFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.Message); 102 m_log.ErrorFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.Message);
103 m_log.DebugFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.ToString()); 103 m_log.DebugFormat("[ASTERISKVOICE] plugin initialization failed: {0}", e.ToString());
104 return; 104 return;
105 } 105 }
106 } 106 }
107 107
108 public void PostInitialise() 108 public void PostInitialise()
109 { 109 {
110 } 110 }
111 111
112 public void Close() 112 public void Close()
113 { 113 {
114 } 114 }
115 115
116 public string Name 116 public string Name
117 { 117 {
118 get { return "AsteriskVoiceModule"; } 118 get { return "AsteriskVoiceModule"; }
119 } 119 }
120 120
121 public bool IsSharedModule 121 public bool IsSharedModule
122 { 122 {
123 get { return false; } 123 get { return false; }
124 } 124 }
125 125
126 #endregion 126 #endregion
127 127
128 public void OnRegisterCaps(LLUUID agentID, Caps caps) 128 public void OnRegisterCaps(LLUUID agentID, Caps caps)
129 { 129 {
130 m_log.DebugFormat("[ASTERISKVOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 130 m_log.DebugFormat("[ASTERISKVOICE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
131 string capsBase = "/CAPS/" + caps.CapsObjectPath; 131 string capsBase = "/CAPS/" + caps.CapsObjectPath;
132 caps.RegisterHandler("ParcelVoiceInfoRequest", 132 caps.RegisterHandler("ParcelVoiceInfoRequest",
133 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath, 133 new RestStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath,
134 delegate(string request, string path, string param) 134 delegate(string request, string path, string param)
135 { 135 {
136 return ParcelVoiceInfoRequest(request, path, param, 136 return ParcelVoiceInfoRequest(request, path, param,
137 agentID, caps); 137 agentID, caps);
138 })); 138 }));
139 caps.RegisterHandler("ProvisionVoiceAccountRequest", 139 caps.RegisterHandler("ProvisionVoiceAccountRequest",
140 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath, 140 new RestStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath,
141 delegate(string request, string path, string param) 141 delegate(string request, string path, string param)
142 { 142 {
143 return ProvisionVoiceAccountRequest(request, path, param, 143 return ProvisionVoiceAccountRequest(request, path, param,
144 agentID, caps); 144 agentID, caps);
145 })); 145 }));
146 } 146 }
147 147
148 /// <summary> 148 /// <summary>
149 /// Callback for a client request for ParcelVoiceInfo 149 /// Callback for a client request for ParcelVoiceInfo
150 /// </summary> 150 /// </summary>
151 /// <param name="request"></param> 151 /// <param name="request"></param>
152 /// <param name="path"></param> 152 /// <param name="path"></param>
153 /// <param name="param"></param> 153 /// <param name="param"></param>
154 /// <param name="agentID"></param> 154 /// <param name="agentID"></param>
155 /// <param name="caps"></param> 155 /// <param name="caps"></param>
156 /// <returns></returns> 156 /// <returns></returns>
157 public string ParcelVoiceInfoRequest(string request, string path, string param, 157 public string ParcelVoiceInfoRequest(string request, string path, string param,
158 LLUUID agentID, Caps caps) 158 LLUUID agentID, Caps caps)
159 { 159 {
160 // we need to do: 160 // we need to do:
161 // - send channel_uri: as "sip:regionID@m_sipDomain" 161 // - send channel_uri: as "sip:regionID@m_sipDomain"
162 try 162 try
163 { 163 {
164 m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}", 164 m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: request: {0}, path: {1}, param: {2}",
165 request, path, param); 165 request, path, param);
166 166
167 167
168 // setup response to client 168 // setup response to client
169 Hashtable creds = new Hashtable(); 169 Hashtable creds = new Hashtable();
170 creds["channel_uri"] = String.Format("sip:{0}@{1}", 170 creds["channel_uri"] = String.Format("sip:{0}@{1}",
171 m_scene.RegionInfo.RegionID, m_sipDomain); 171 m_scene.RegionInfo.RegionID, m_sipDomain);
172 172
173 string regionName = m_scene.RegionInfo.RegionName; 173 string regionName = m_scene.RegionInfo.RegionName;
174 ScenePresence avatar = m_scene.GetScenePresence(agentID); 174 ScenePresence avatar = m_scene.GetScenePresence(agentID);
175 if (null == m_scene.LandChannel) throw new Exception("land data not yet available"); 175 if (null == m_scene.LandChannel) throw new Exception("land data not yet available");
176 LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 176 LandData land = m_scene.GetLandData(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
177 177
178 LLSDParcelVoiceInfoResponse parcelVoiceInfo = 178 LLSDParcelVoiceInfoResponse parcelVoiceInfo =
179 new LLSDParcelVoiceInfoResponse(regionName, land.localID, creds); 179 new LLSDParcelVoiceInfoResponse(regionName, land.localID, creds);
180 180
181 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo); 181 string r = LLSDHelpers.SerialiseLLSDReply(parcelVoiceInfo);
182 182
183 183
184 // update region on asterisk-opensim frontend 184 // update region on asterisk-opensim frontend
185 Hashtable requestData = new Hashtable(); 185 Hashtable requestData = new Hashtable();
186 requestData["admin_password"] = m_asterisk_password; 186 requestData["admin_password"] = m_asterisk_password;
187 requestData["region"] = m_scene.RegionInfo.RegionID.ToString(); 187 requestData["region"] = m_scene.RegionInfo.RegionID.ToString();
188 if (!String.IsNullOrEmpty(m_confDomain)) 188 if (!String.IsNullOrEmpty(m_confDomain))
189 { 189 {
190 requestData["region"] += String.Format("@{0}", m_confDomain); 190 requestData["region"] += String.Format("@{0}", m_confDomain);
191 } 191 }
192 192
193 ArrayList SendParams = new ArrayList(); 193 ArrayList SendParams = new ArrayList();
194 SendParams.Add(requestData); 194 SendParams.Add(requestData);
195 XmlRpcRequest updateAccountRequest = new XmlRpcRequest("region_update", SendParams); 195 XmlRpcRequest updateAccountRequest = new XmlRpcRequest("region_update", SendParams);
196 XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout); 196 XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
197 Hashtable responseData = (Hashtable) updateAccountResponse.Value; 197 Hashtable responseData = (Hashtable) updateAccountResponse.Value;
198 198
199 if (!responseData.ContainsKey("success")) throw new Exception("region_update call failed"); 199 if (!responseData.ContainsKey("success")) throw new Exception("region_update call failed");
200 200
201 bool success = Convert.ToBoolean((string) responseData["success"]); 201 bool success = Convert.ToBoolean((string) responseData["success"]);
202 if (!success) throw new Exception("region_update failed"); 202 if (!success) throw new Exception("region_update failed");
203 203
204 204
205 m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: {0}", r); 205 m_log.DebugFormat("[ASTERISKVOICE][PARCELVOICE]: {0}", r);
206 return r; 206 return r;
207 } 207 }
208 catch (Exception e) 208 catch (Exception e)
209 { 209 {
210 m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0}, retry later", e.Message); 210 m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0}, retry later", e.Message);
211 m_log.DebugFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0} failed", e.ToString()); 211 m_log.DebugFormat("[ASTERISKVOICE][CAPS][PARCELVOICE]: {0} failed", e.ToString());
212 212
213 return "<llsd>undef</llsd>"; 213 return "<llsd>undef</llsd>";
214 } 214 }
215 } 215 }
216 216
217 /// <summary> 217 /// <summary>
218 /// Callback for a client request for Voice Account Details 218 /// Callback for a client request for Voice Account Details
219 /// </summary> 219 /// </summary>
220 /// <param name="request"></param> 220 /// <param name="request"></param>
221 /// <param name="path"></param> 221 /// <param name="path"></param>
222 /// <param name="param"></param> 222 /// <param name="param"></param>
223 /// <param name="agentID"></param> 223 /// <param name="agentID"></param>
224 /// <param name="caps"></param> 224 /// <param name="caps"></param>
225 /// <returns></returns> 225 /// <returns></returns>
226 public string ProvisionVoiceAccountRequest(string request, string path, string param, 226 public string ProvisionVoiceAccountRequest(string request, string path, string param,
227 LLUUID agentID, Caps caps) 227 LLUUID agentID, Caps caps)
228 { 228 {
229 // we need to 229 // we need to
230 // - get user data from UserProfileCacheService 230 // - get user data from UserProfileCacheService
231 // - generate nonce for user voice account password 231 // - generate nonce for user voice account password
232 // - issue XmlRpc request to asterisk opensim front end: 232 // - issue XmlRpc request to asterisk opensim front end:
233 // + user: base 64 encoded user name (otherwise SL 233 // + user: base 64 encoded user name (otherwise SL
234 // client is unhappy) 234 // client is unhappy)
235 // + password: nonce 235 // + password: nonce
236 // - the XmlRpc call to asteris-opensim was successful: 236 // - the XmlRpc call to asteris-opensim was successful:
237 // send account details back to client 237 // send account details back to client
238 try 238 try
239 { 239 {
240 m_log.DebugFormat("[ASTERISKVOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}", 240 m_log.DebugFormat("[ASTERISKVOICE][PROVISIONVOICE]: request: {0}, path: {1}, param: {2}",
241 request, path, param); 241 request, path, param);
242 242
243 // get user data & prepare voice account response 243 // get user data & prepare voice account response
244 string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes()); 244 string voiceUser = "x" + Convert.ToBase64String(agentID.GetBytes());
245 voiceUser = voiceUser.Replace('+', '-').Replace('/', '_'); 245 voiceUser = voiceUser.Replace('+', '-').Replace('/', '_');
246 246
247 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID); 247 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(agentID);
248 if (null == userInfo) throw new Exception("cannot get user details"); 248 if (null == userInfo) throw new Exception("cannot get user details");
249 249
250 // we generate a nonce everytime 250 // we generate a nonce everytime
251 string voicePassword = "$1$" + Util.Md5Hash(DateTime.UtcNow.ToLongTimeString() + m_asterisk_salt); 251 string voicePassword = "$1$" + Util.Md5Hash(DateTime.UtcNow.ToLongTimeString() + m_asterisk_salt);
252 LLSDVoiceAccountResponse voiceAccountResponse = 252 LLSDVoiceAccountResponse voiceAccountResponse =
253 new LLSDVoiceAccountResponse(voiceUser, voicePassword); 253 new LLSDVoiceAccountResponse(voiceUser, voicePassword);
254 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse); 254 string r = LLSDHelpers.SerialiseLLSDReply(voiceAccountResponse);
255 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r); 255 m_log.DebugFormat("[CAPS][PROVISIONVOICE]: {0}", r);
256 256
257 257
258 // update user account on asterisk frontend 258 // update user account on asterisk frontend
259 Hashtable requestData = new Hashtable(); 259 Hashtable requestData = new Hashtable();
260 requestData["admin_password"] = m_asterisk_password; 260 requestData["admin_password"] = m_asterisk_password;
261 requestData["username"] = voiceUser; 261 requestData["username"] = voiceUser;
262 if (!String.IsNullOrEmpty(m_sipDomain)) 262 if (!String.IsNullOrEmpty(m_sipDomain))
263 { 263 {
264 requestData["username"] += String.Format("@{0}", m_sipDomain); 264 requestData["username"] += String.Format("@{0}", m_sipDomain);
265 } 265 }
266 requestData["password"] = voicePassword; 266 requestData["password"] = voicePassword;
267 267
268 ArrayList SendParams = new ArrayList(); 268 ArrayList SendParams = new ArrayList();
269 SendParams.Add(requestData); 269 SendParams.Add(requestData);
270 XmlRpcRequest updateAccountRequest = new XmlRpcRequest("account_update", SendParams); 270 XmlRpcRequest updateAccountRequest = new XmlRpcRequest("account_update", SendParams);
271 XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout); 271 XmlRpcResponse updateAccountResponse = updateAccountRequest.Send(m_asterisk, m_asterisk_timeout);
272 Hashtable responseData = (Hashtable) updateAccountResponse.Value; 272 Hashtable responseData = (Hashtable) updateAccountResponse.Value;
273 273
274 if (!responseData.ContainsKey("success")) throw new Exception("account_update call failed"); 274 if (!responseData.ContainsKey("success")) throw new Exception("account_update call failed");
275 275
276 bool success = Convert.ToBoolean((string) responseData["success"]); 276 bool success = Convert.ToBoolean((string) responseData["success"]);
277 if (!success) throw new Exception("account_update failed"); 277 if (!success) throw new Exception("account_update failed");
278 278
279 return r; 279 return r;
280 } 280 }
281 catch (Exception e) 281 catch (Exception e)
282 { 282 {
283 m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0}, retry later", e.Message); 283 m_log.ErrorFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0}, retry later", e.Message);
284 m_log.DebugFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0} failed", e.ToString()); 284 m_log.DebugFormat("[ASTERISKVOICE][CAPS][PROVISIONVOICE]: {0} failed", e.ToString());
285 285
286 return "<llsd>undef</llsd>"; 286 return "<llsd>undef</llsd>";
287 } 287 }
288 } 288 }
289 } 289 }
290} \ No newline at end of file 290} \ No newline at end of file