aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorJonathan Freedman2010-11-21 20:01:48 -0800
committerJonathan Freedman2010-11-21 20:01:48 -0800
commitb7f5e8284360f92e0e102b9546076573c57d9397 (patch)
tree132663da8c1882e524241b55a739ef2758ef8958 /OpenSim/Server
parentMerge https://github.com/opensim/opensim into mantis5110 (diff)
parentMerge branch 'master' of /var/git/opensim/ (diff)
downloadopensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.zip
opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.gz
opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.bz2
opensim-SC_OLD-b7f5e8284360f92e0e102b9546076573c57d9397.tar.xz
Merge branch 'master-core' into mantis5110
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs65
-rw-r--r--OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs72
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs7
4 files changed, 72 insertions, 74 deletions
diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs
index 07bafc8..da56b87 100644
--- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs
+++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs
@@ -26,18 +26,27 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Web;
31using System.Reflection;
29using Nini.Config; 32using Nini.Config;
30using OpenSim.Server.Base; 33using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer; 35using OpenSim.Framework.Servers.HttpServer;
33using OpenSim.Server.Handlers.Base; 36using OpenSim.Server.Handlers.Base;
37using log4net;
38using OpenMetaverse;
39using OpenMetaverse.StructuredData;
34 40
35namespace OpenSim.Server.Handlers.Freeswitch 41namespace OpenSim.Server.Handlers.Freeswitch
36{ 42{
37 public class FreeswitchServerConnector : ServiceConnector 43 public class FreeswitchServerConnector : ServiceConnector
38 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
39 private IFreeswitchService m_FreeswitchService; 47 private IFreeswitchService m_FreeswitchService;
40 private string m_ConfigName = "FreeswitchService"; 48 private string m_ConfigName = "FreeswitchService";
49 protected readonly string m_freeSwitchAPIPrefix = "/fsapi";
41 50
42 public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : 51 public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) :
43 base(config, server, configName) 52 base(config, server, configName)
@@ -59,7 +68,61 @@ namespace OpenSim.Server.Handlers.Freeswitch
59 m_FreeswitchService = 68 m_FreeswitchService =
60 ServerUtils.LoadPlugin<IFreeswitchService>(freeswitchService, args); 69 ServerUtils.LoadPlugin<IFreeswitchService>(freeswitchService, args);
61 70
62 server.AddStreamHandler(new FreeswitchServerGetHandler(m_FreeswitchService)); 71 server.AddHTTPHandler(String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix), FreeSwitchConfigHTTPHandler);
72 server.AddHTTPHandler(String.Format("{0}/region-config", m_freeSwitchAPIPrefix), RegionConfigHTTPHandler);
73 }
74
75 public Hashtable FreeSwitchConfigHTTPHandler(Hashtable request)
76 {
77 Hashtable response = new Hashtable();
78 response["str_response_string"] = string.Empty;
79 response["content_type"] = "text/plain";
80 response["keepalive"] = false;
81 response["int_response_code"] = 500;
82
83 Hashtable requestBody = ParseRequestBody((string) request["body"]);
84
85 string section = (string) requestBody["section"];
86
87 if (section == "directory")
88 response = m_FreeswitchService.HandleDirectoryRequest(requestBody);
89 else if (section == "dialplan")
90 response = m_FreeswitchService.HandleDialplanRequest(requestBody);
91 else
92 m_log.WarnFormat("[FreeSwitchVoice]: section was {0}", section);
93
94 return response;
63 } 95 }
96
97 private Hashtable ParseRequestBody(string body)
98 {
99 Hashtable bodyParams = new Hashtable();
100 // split string
101 string [] nvps = body.Split(new Char [] {'&'});
102
103 foreach (string s in nvps)
104 {
105 if (s.Trim() != "")
106 {
107 string [] nvp = s.Split(new Char [] {'='});
108 bodyParams.Add(HttpUtility.UrlDecode(nvp[0]), HttpUtility.UrlDecode(nvp[1]));
109 }
110 }
111
112 return bodyParams;
113 }
114
115 public Hashtable RegionConfigHTTPHandler(Hashtable request)
116 {
117 Hashtable response = new Hashtable();
118 response["content_type"] = "text/json";
119 response["keepalive"] = false;
120 response["int_response_code"] = 200;
121
122 response["str_response_string"] = m_FreeswitchService.GetJsonConfig();
123
124 return response;
125 }
126
64 } 127 }
65} 128}
diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs
deleted file mode 100644
index 8b41742..0000000
--- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerGetHandler.cs
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using Nini.Config;
29using log4net;
30using System;
31using System.IO;
32using System.Reflection;
33using System.Net;
34using System.Text;
35using System.Text.RegularExpressions;
36using System.Xml;
37using System.Xml.Serialization;
38using OpenSim.Server.Base;
39using OpenSim.Services.Interfaces;
40using OpenSim.Framework;
41using OpenSim.Framework.Servers.HttpServer;
42
43namespace OpenSim.Server.Handlers.Freeswitch
44{
45 public class FreeswitchServerGetHandler : BaseStreamHandler
46 {
47 // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 //private IFreeswitchService m_FreeswitchService;
50
51 public FreeswitchServerGetHandler(IFreeswitchService service) :
52 base("GET", "/api")
53 {
54 //m_FreeswitchService = service;
55 }
56
57 public override byte[] Handle(string path, Stream request,
58 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
59 {
60 byte[] result = new byte[0];
61
62 string[] p = SplitParams(path);
63
64 if (p.Length == 0)
65 return result;
66
67 // Process web request
68
69 return result;
70 }
71 }
72}
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index ac6a3ab..23ae5b4 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -601,6 +601,7 @@ namespace OpenSim.Server.Handlers.Asset
601 ret["BasePermissions"] = item.BasePermissions.ToString(); 601 ret["BasePermissions"] = item.BasePermissions.ToString();
602 ret["CreationDate"] = item.CreationDate.ToString(); 602 ret["CreationDate"] = item.CreationDate.ToString();
603 ret["CreatorId"] = item.CreatorId.ToString(); 603 ret["CreatorId"] = item.CreatorId.ToString();
604 ret["CreatorData"] = item.CreatorData.ToString();
604 ret["CurrentPermissions"] = item.CurrentPermissions.ToString(); 605 ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
605 ret["Description"] = item.Description.ToString(); 606 ret["Description"] = item.Description.ToString();
606 ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString(); 607 ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();
@@ -646,6 +647,7 @@ namespace OpenSim.Server.Handlers.Asset
646 item.InvType = int.Parse(data["InvType"].ToString()); 647 item.InvType = int.Parse(data["InvType"].ToString());
647 item.Folder = new UUID(data["Folder"].ToString()); 648 item.Folder = new UUID(data["Folder"].ToString());
648 item.CreatorId = data["CreatorId"].ToString(); 649 item.CreatorId = data["CreatorId"].ToString();
650 item.CreatorData = data["CreatorData"].ToString();
649 item.Description = data["Description"].ToString(); 651 item.Description = data["Description"].ToString();
650 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); 652 item.NextPermissions = uint.Parse(data["NextPermissions"].ToString());
651 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); 653 item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString());
diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
index 33e5aa6..04ff83f 100644
--- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs
@@ -162,6 +162,11 @@ namespace OpenSim.Server.Handlers.Simulation
162 return; 162 return;
163 } 163 }
164 164
165 if (args.ContainsKey("modified"))
166 sog.HasGroupChanged = args["modified"].AsBoolean();
167 else
168 sog.HasGroupChanged = false;
169
165 if ((args["state"] != null) && s.AllowScriptCrossings) 170 if ((args["state"] != null) && s.AllowScriptCrossings)
166 { 171 {
167 stateXmlStr = args["state"].AsString(); 172 stateXmlStr = args["state"].AsString();
@@ -243,4 +248,4 @@ namespace OpenSim.Server.Handlers.Simulation
243 } 248 }
244 249
245 } 250 }
246} \ No newline at end of file 251}