public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately)
 {
     IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
     if (moneyModule != null)
     {
         if (chargeImmediately)
         {
             bool success = moneyModule.Charge(agentID, amount, text, type);
             if (!success)
                 return false;
         }
         IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
         if (scheduler != null)
         {
             OSDMap itemInfo = new OSDMap();
             itemInfo.Add("AgentID", agentID);
             itemInfo.Add("Amount", amount);
             itemInfo.Add("Text", text);
             itemInfo.Add("Type", (int)type);
             SchedulerItem item = new SchedulerItem("ScheduledPayment " + identifer,
                                                    OSDParser.SerializeJsonString(itemInfo), false,
                                                    DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID);
             itemInfo.Add("SchedulerID", item.id);
             scheduler.Save(item);
         }
     }
     return true;
 }
        public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge)
        {
            IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
            if (moneyModule != null)
            {
                bool success = moneyModule.Charge(agentID, amount, text);
                if (!success)
                    return false;
                IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
                if (scheduler != null)
                {
                    OSDMap itemInfo = new OSDMap();
                    itemInfo.Add("AgentID", agentID);
                    itemInfo.Add("Amount", amount);
                    itemInfo.Add("Text", text);
                    SchedulerItem item = new SchedulerItem("ScheduledPayment",
                        OSDParser.SerializeJsonString(itemInfo), false,
                        DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now);
                    itemInfo.Add("SchedulerID", item.id);
                    scheduler.Save(item);

                }
            }
            return true;
        }
        /// <summary>
        /// Sends json-rpc request with a serializable type.
        /// </summary>
        /// <returns>
        /// OSD Map.
        /// </returns>
        /// <param name='parameters'>
        /// Serializable type .
        /// </param>
        /// <param name='method'>
        /// Json-rpc method to call.
        /// </param>
        /// <param name='uri'>
        /// URI of json-rpc service.
        /// </param>
        /// <param name='jsonId'>
        /// Id for our call.
        /// </param>
        public bool JsonRpcRequest(ref object parameters, string method, string uri, string jsonId)
        {
            if (jsonId == null)
                throw new ArgumentNullException ("jsonId");
            if (uri == null)
                throw new ArgumentNullException ("uri");
            if (method == null)
                throw new ArgumentNullException ("method");
            if (parameters == null)
                throw new ArgumentNullException ("parameters");
            
            // Prep our payload
            OSDMap json = new OSDMap();
            
            json.Add("jsonrpc", OSD.FromString("2.0"));
            json.Add("id", OSD.FromString(jsonId));
            json.Add("method", OSD.FromString(method));
            
            json.Add("params", OSD.SerializeMembers(parameters));
            
            string jsonRequestData = OSDParser.SerializeJsonString(json);
            byte[] content = Encoding.UTF8.GetBytes(jsonRequestData);
            
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
            
            webRequest.ContentType = "application/json-rpc";
            webRequest.Method = "POST";
            
            //Stream dataStream = webRequest.GetRequestStream();
            //dataStream.Write(content, 0, content.Length);
            //dataStream.Close();

            using (Stream dataStream = webRequest.GetRequestStream())
                dataStream.Write(content, 0, content.Length);
            
            WebResponse webResponse = null;
            try
            {
                webResponse = webRequest.GetResponse();
            }
            catch (WebException e)
            {
                Console.WriteLine("Web Error" + e.Message);
                Console.WriteLine ("Please check input");
                return false;
            }
            
            using (webResponse)
            using (Stream rstream = webResponse.GetResponseStream())
            {
                OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
                        
                if (mret.ContainsKey("error"))
                    return false;
            
                // get params...
                OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]);
                return true;
            }
        }
Example #4
0
 public override OSDMap ToOSD()
 {
     OSDMap map = new OSDMap();
     map.Add("MuteName", MuteName);
     map.Add("MuteID", MuteID);
     map.Add("MuteType", MuteType);
     return map;
 }
//        private static byte[] uintToByteArray(uint uIntValue)
//        {
//            byte[] result = new byte[4];
//            Utils.UIntToBytesBig(uIntValue, result, 0);
//            return result;
//        }

        public static OSD BuildEvent(string eventName, OSD eventBody)
        {
            OSDMap llsdEvent = new OSDMap(2);
            llsdEvent.Add("message", new OSDString(eventName));
            llsdEvent.Add("body", eventBody);

            return llsdEvent;
        }
        /// <summary>
        /// Sends json-rpc request with a serializable type.
        /// </summary>
        /// <returns>
        /// OSD Map.
        /// </returns>
        /// <param name='parameters'>
        /// Serializable type .
        /// </param>
        /// <param name='method'>
        /// Json-rpc method to call.
        /// </param>
        /// <param name='uri'>
        /// URI of json-rpc service.
        /// </param>
        /// <param name='jsonId'>
        /// Id for our call.
        /// </param>
        public bool JsonRpcRequest(ref object parameters, string method, string uri, string jsonId)
        {
            if (jsonId == null)
                throw new ArgumentNullException("jsonId");
            if (uri == null)
                throw new ArgumentNullException("uri");
            if (method == null)
                throw new ArgumentNullException("method");
            if (parameters == null)
                throw new ArgumentNullException("parameters");

            OSDMap request = new OSDMap();
            request.Add("jsonrpc", OSD.FromString("2.0"));
            request.Add("id", OSD.FromString(jsonId));
            request.Add("method", OSD.FromString(method));
            request.Add("params", OSD.SerializeMembers(parameters));

            OSDMap response;
            try
            {
                response = WebUtil.PostToService(uri, request, 10000, true);
            }
            catch (Exception e)
            {
                m_log.Debug(string.Format("JsonRpc request '{0}' failed", method), e);
                return false;
            }

            if (!response.ContainsKey("_Result"))
            {
                m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
                    method, OSDParser.SerializeJsonString(response));
                return false;
            }
            response = (OSDMap)response["_Result"];

            OSD data;

            if (response.ContainsKey("error"))
            {
                data = response["error"];
                m_log.DebugFormat("JsonRpc request '{0}' returned an error: {1}",
                    method, OSDParser.SerializeJsonString(data));
                return false;
            }

            if (!response.ContainsKey("result"))
            {
                m_log.DebugFormat("JsonRpc request '{0}' returned an invalid response: {1}",
                    method, OSDParser.SerializeJsonString(response));
                return false;
            }

            data = response["result"];
            OSD.DeserializeMembers(ref parameters, (OSDMap)data);

            return true;
        }
Example #7
0
        public static OSDMap UpdateEstateInfo(uint EstateID, UUID RegionID)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("EstateID", EstateID);
            llsdBody.Add("RegionID", RegionID);

            return buildEvent("UpdateEstateInfo", llsdBody, UUID.Zero, 0);
        }
Example #8
0
        public static OSDMap ArrivedAtDestination(UUID AgentID, int DrawDistance, AgentCircuitData circuit, ulong requestingRegion)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("AgentID", AgentID);

            llsdBody.Add("DrawDistance", DrawDistance);
            llsdBody.Add("Circuit", circuit.PackAgentCircuitData());

            return buildEvent("ArrivedAtDestination", llsdBody, AgentID, requestingRegion);
        }
Example #9
0
        /// <summary>
        /// Tells the region to tell the given agent that the other agent is online
        /// </summary>
        /// <param name="AgentID">Agent that is either logging in or logging out</param>
        /// <param name="FriendToInformID">Friend that will be told of the incoming/outgoing user</param>
        /// <param name="newStatus">Whether they are logged in or out</param>
        /// <returns></returns>
        public static OSDMap AgentStatusChange(UUID AgentID, UUID FriendToInformID, bool newStatus)
        {
            OSDMap llsdBody = new OSDMap();

            llsdBody.Add("AgentID", AgentID);

            llsdBody.Add("FriendToInformID", FriendToInformID);
            llsdBody.Add("NewStatus", newStatus);

            return buildEvent("AgentStatusChange", llsdBody, AgentID, 0);
        }
Example #10
0
		public void SerializeMapTest() {
			OSDMap capsMap = new OSDMap();
			capsMap.Add("FetchInventoryDescendents2", "d5cb3302-2db8-4881-94de-161ce09df1a6");
			capsMap.Add("FetchInventory2", "e1563faf-a081-4410-b160-ea1639aef192");
			capsMap.Add("GetTexture", "26cecb27-ea2c-4152-b319-d06dd0b516ae");
			capsMap.Add("GetMesh", "24f57f22-59b0-4c4a-a2c2-95a8858de972");

			String result = OSDParser.SerializeJsonString(capsMap);
			String jsonString = "{\"FetchInventoryDescendents2\":\"d5cb3302-2db8-4881-94de-161ce09df1a6\",\"FetchInventory2\":\"e1563faf-a081-4410-b160-ea1639aef192\",\"GetTexture\":\"26cecb27-ea2c-4152-b319-d06dd0b516ae\",\"GetMesh\":\"24f57f22-59b0-4c4a-a2c2-95a8858de972\"}";
			Assert.That(jsonString.Equals(result));

		}
Example #11
0
 public static OSD DeserializeJson(JsonData json)
 {
     switch (json.GetJsonType())
     {
         case JsonType.Boolean:
             return OSD.FromBoolean((bool)json);
         case JsonType.Int:
             return OSD.FromInteger((int)json);
         case JsonType.Long:
             return OSD.FromLong((long)json);
         case JsonType.Double:
             return OSD.FromReal((double)json);
         case JsonType.String:
             string str = (string)json;
             if (String.IsNullOrEmpty(str))
                 return new OSD();
             else
                 return OSD.FromString(str);
         case JsonType.Array:
             OSDArray array = new OSDArray(json.Count);
             for (int i = 0; i < json.Count; i++)
                 array.Add(DeserializeJson(json[i]));
             return array;
         case JsonType.Object:
             OSDMap map = new OSDMap(json.Count);
             foreach (KeyValuePair<string, JsonData> kvp in json)
                 map.Add(kvp.Key, DeserializeJson(kvp.Value));
             return map;
         case JsonType.None:
         default:
             return new OSD();
     }
 }
Example #12
0
 public static OSD DeserializeJson(JsonData json)
 {
     switch (json.GetJsonType())
     {
         case JsonType.Boolean:
             return OSD.FromBoolean((bool)json);
         case JsonType.Int:
             return OSD.FromInteger((int)json);
         case JsonType.Long:
             return OSD.FromLong((long)json);
         case JsonType.Double:
             return OSD.FromReal((double)json);
         case JsonType.String:
             string str = (string)json;
             if (String.IsNullOrEmpty(str))
                 return new OSD();
             else
                 return OSD.FromString(str);
         case JsonType.Array:
             OSDArray array = new OSDArray(json.Count);
             for (int i = 0; i < json.Count; i++)
                 array.Add(DeserializeJson(json[i]));
             return array;
         case JsonType.Object:
             OSDMap map = new OSDMap(json.Count);
             IDictionaryEnumerator e = ((IOrderedDictionary)json).GetEnumerator();
             while (e.MoveNext())
                 map.Add((string)e.Key, DeserializeJson((JsonData)e.Value));
             return map;
         case JsonType.None:
         default:
             return new OSD();
     }
 }
Example #13
0
        public static OSD EnableSimulator(ulong handle, IPEndPoint endPoint)
        {
            OSDMap llsdSimInfo = new OSDMap(3);

            llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
            llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
            llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));

            OSDArray arr = new OSDArray(1);
            arr.Add(llsdSimInfo);

            OSDMap llsdBody = new OSDMap(1);
            llsdBody.Add("SimulatorInfo", arr);

            return BuildEvent("EnableSimulator", llsdBody);
        }
        public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
        {
            if (m_registry == null) return new OSDMap();
            OSDMap resp = new OSDMap();
            if (m_registry.RequestModuleInterface<IGridServerInfoService>() != null)
            {
                m_servers = m_registry.RequestModuleInterface<IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
                OSDMap req = new OSDMap();
                req["AgentID"] = agentID;
                req["Region"] = region.ToOSD();
                req["Method"] = "GetCaps";

                List<ManualResetEvent> events = new List<ManualResetEvent>();
                foreach (string uri in m_servers)
                {
                    ManualResetEvent even = new ManualResetEvent(false);
                    m_syncPoster.Get(uri, req, (r) =>
                    {
                        if (r == null)
                            return;
                        foreach (KeyValuePair<string, OSD> kvp in r)
                            resp.Add(kvp.Key, kvp.Value);
                        even.Set();
                    });
                    events.Add(even);
                }
                ManualResetEvent.WaitAll(events.ToArray());
            }
            foreach (var h in GetHandlers(agentID, region.RegionID))
            {
                if (m_allowedCapsModules.Contains(h.Name))
                    h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref resp);
            }
            return resp;
        }
 public override OSDMap ToOSD()
 {
     OSDMap map = new OSDMap();
     map = base.ToOSD();
     map.Add("Point", m_Point);
     return map;
 }
        public static OSD EnableSimulator(ulong handle, byte[] IPAddress, int Port)
        {
            OSDMap llsdSimInfo = new OSDMap(3);

            llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
            llsdSimInfo.Add("IP", new OSDBinary(IPAddress));
            llsdSimInfo.Add("Port", new OSDInteger(Port));

            OSDArray arr = new OSDArray(1);
            arr.Add(llsdSimInfo);

            OSDMap llsdBody = new OSDMap(1);
            llsdBody.Add("SimulatorInfo", arr);

            return buildEvent("EnableSimulator", llsdBody);
        }
Example #17
0
        public static OSDMap EnableSimulator(ulong regionHandle, IPAddress ip, int port)
        {
            OSDMap llsdSimInfo = new OSDMap(3);

            llsdSimInfo.Add("Handle", OSD.FromULong(regionHandle));
            llsdSimInfo.Add("IP", OSD.FromBinary(ip.GetAddressBytes()));
            llsdSimInfo.Add("Port", OSD.FromInteger(port));

            OSDArray arr = new OSDArray(1);
            arr.Add(llsdSimInfo);

            OSDMap llsdBody = new OSDMap(1);
            llsdBody.Add("SimulatorInfo", arr);

            return llsdBody;
        }
Example #18
0
        public static OSDMap FromDictionaryString(Dictionary<string, string> dict)
        {
            if (dict != null)
            {
                OSDMap map = new OSDMap(dict.Count);
                foreach (KeyValuePair<string, string> entry in dict)
                    map.Add(entry.Key, OSD.FromString(entry.Value));
                return map;
            }

            return new OSDMap(0);
        }
Example #19
0
        public static OSDMap FromDictionaryUri(Dictionary<Uri, Uri> dict)
        {
            if (dict != null)
            {
                OSDMap map = new OSDMap(dict.Count);
                foreach (KeyValuePair<Uri, Uri> entry in dict)
                    map.Add(entry.Key.ToString(), OSD.FromUri(entry.Value));
                return map;
            }

            return new OSDMap(0);
        }
Example #20
0
        private Hashtable ProcessServerReleaseNotes(Hashtable m_dhttpMethod, UUID agentID, UUID capuuid)
        {
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;

            OSDMap osd = new OSDMap();
            osd.Add("ServerReleaseNotes", new OSDString(Aurora.Framework.Utilities.GetServerReleaseNotesURL()));
            string response = OSDParser.SerializeLLSDXmlString(osd);
            responsedata["str_response_string"] = response;
            return responsedata;
        }
Example #21
0
        public OSDMap Serialize()
        {
            OSDMap map = new OSDMap(3);
            map["ID"] = OSD.FromUUID(ID);
            map["Identifier"] = OSD.FromUri(Identity);

            OSDMap dict = new OSDMap(Attributes.Count);
            foreach (KeyValuePair<Uri, OSD> entry in Attributes)
                dict.Add(entry.Key.ToString(), entry.Value);
            map["Attributes"] = dict;

            return map;
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map.Add("PrincipalID", OSD.FromUUID(PrincipalID));
            map.Add("Flags", OSD.FromInteger((int)Flags));
            map.Add("MaxMaturity", OSD.FromInteger(MaxMaturity));
            map.Add("MaturityRating", OSD.FromInteger(MaturityRating));
            map.Add("Language", OSD.FromString(Language));
            map.Add("AcceptTOS", OSD.FromBoolean(AcceptTOS));
            map.Add("LanguageIsPublic", OSD.FromBoolean(LanguageIsPublic));
            map.Add("OtherAgentInformation", OSD.FromString(OSDParser.SerializeLLSDXmlString(OtherAgentInformation)));
            
            return map;
        }
Example #23
0
        public OSDMap Serialize()
        {
            OSDMap map = new OSDMap();
            if (MessageSessions.Count > 0)
            {
                OSDArray messageArray = new OSDArray(MessageSessions.Count);
                foreach (KeyValuePair<string, FilterEntry> kvp in MessageSessions)
                {
                    OSDMap sessionMap = new OSDMap(3);
                    sessionMap["Capability"] = OSD.FromString(kvp.Key);
                    sessionMap["Capture"] = OSD.FromBoolean(kvp.Value.Checked);
                    sessionMap["Type"] = OSD.FromString(kvp.Value.pType);
                    messageArray.Add(sessionMap);
                }
                map.Add("message_sessions", messageArray);
            }

            if (PacketSessions.Count > 0)
            {
                OSDArray packetArray = new OSDArray(PacketSessions.Count);
                foreach (KeyValuePair<string, FilterEntry> kvp in PacketSessions)
                {
                    OSDMap sessionMap = new OSDMap(3);
                    sessionMap["PacketName"] = OSD.FromString(kvp.Key);
                    sessionMap["Capture"] = OSD.FromBoolean(kvp.Value.Checked);
                    sessionMap["Type"] = OSD.FromString(kvp.Value.pType);
                    packetArray.Add(sessionMap);
                }
                map.Add("packet_sessions", packetArray);
            }

            map.Add("AutoScrollSessions", OSD.FromBoolean(AutoScrollEnabled));
            map.Add("CaptureStatistics", OSD.FromBoolean(StatisticsEnabled));
            map.Add("SaveProfileOnExit", OSD.FromBoolean(SaveSessionOnExit));
            map.Add("AutoCheckNewCaps", OSD.FromBoolean(AutoCheckNewCaps));

            return map;
        }
        public override OSDMap ToOSD()
        {
            OSDMap map = new OSDMap();

            map.Add("PrincipalID", OSD.FromUUID(PrincipalID));
            map.Add("Flags", OSD.FromInteger((int)Flags));
            map.Add("MaxMaturity", OSD.FromInteger(MaxMaturity));
            map.Add("MaturityRating", OSD.FromInteger(MaturityRating));
            map.Add("Language", OSD.FromString(Language));
            map.Add("AcceptTOS", OSD.FromBoolean(AcceptTOS));
            map.Add("LanguageIsPublic", OSD.FromBoolean(LanguageIsPublic));
            
            return map;
        }
Example #25
0
        public static OSDMap TeleportFinish(UUID agentID, int locationID, ulong regionHandle, Uri seedCap, SimAccess simAccess,
            IPAddress simIP, int simPort, TeleportFlags teleportFlags)
        {
            OSDMap info = new OSDMap(8);
            info.Add("AgentID", OSD.FromUUID(agentID));
            info.Add("LocationID", OSD.FromInteger(locationID)); // Unused by the client
            info.Add("RegionHandle", OSD.FromULong(regionHandle));
            info.Add("SeedCapability", OSD.FromUri(seedCap));
            info.Add("SimAccess", OSD.FromInteger((byte)simAccess));
            info.Add("SimIP", OSD.FromBinary(simIP.GetAddressBytes()));
            info.Add("SimPort", OSD.FromInteger(simPort));
            info.Add("TeleportFlags", OSD.FromUInteger((uint)teleportFlags));

            OSDArray infoArray = new OSDArray(1);
            infoArray.Add(info);

            OSDMap teleport = new OSDMap(1);
            teleport.Add("Info", infoArray);

            return teleport;
        }
Example #26
0
        /// <summary>
        /// Serialize the object
        /// </summary>
        /// <returns>An <see cref="OSDMap"/> containing the objects data</returns>
        public OSDMap Serialize()
        {
            OSDMap map = new OSDMap(1);

            OSDArray infoArray = new OSDArray(1);

            OSDMap info = new OSDMap(8);
            info.Add("AgentID", OSD.FromUUID(AgentID));
            info.Add("LocationID", OSD.FromInteger(LocationID)); // Unused by the client
            info.Add("RegionHandle", OSD.FromULong(RegionHandle));
            info.Add("SeedCapability", OSD.FromUri(SeedCapability));
            info.Add("SimAccess", OSD.FromInteger((byte)SimAccess));
            info.Add("SimIP", MessageUtils.FromIP(IP));
            info.Add("SimPort", OSD.FromInteger(Port));
            info.Add("TeleportFlags", OSD.FromUInteger((uint)Flags));

            infoArray.Add(info);

            map.Add("Info", infoArray);

            return map;
        }
Example #27
0
 public object DoRemoteForUser(UUID userID, params object[] o)
 {
     if (!m_doRemoteCalls)
         return null;
     StackTrace stackTrace = new StackTrace();
     int upStack = 1;
     if (userID == UUID.Zero)
         upStack = 2;
     MethodInfo method = (MethodInfo)stackTrace.GetFrame(upStack).GetMethod();
     string methodName = method.Name;
     OSDMap map = new OSDMap();
     map["Method"] = methodName;
     int i = 0;
     foreach(ParameterInfo info in method.GetParameters())
     {
         map.Add(info.Name, Util.MakeOSD(o[i], o[i].GetType()));
         i++;
     }
     List<string> m_ServerURIs =
             m_configService.FindValueOf(userID.ToString(), "ServerURI", false);
     OSDMap response = null;
     foreach (string uri in m_ServerURIs)
     {
         if (GetOSDMap(uri, map, out response))
             break;
     }
     if (response == null || !response)
         return null;
     object inst =  Activator.CreateInstance(method.ReturnType);
     if (inst is IDataTransferable)
     {
         IDataTransferable instance = (IDataTransferable)inst;
         instance.FromOSD((OSDMap)response["Value"]);
         return instance;
     }
     else
         return Util.OSDToObject(response["Value"], method.ReturnType);
 }
Example #28
0
 public OSD GetSerializationData(UUID itemID, UUID primID)
 {
     OSDMap data = new OSDMap();
     string key = MakeTimerKey(primID, itemID);
     TimerClass timer;
     if (Timers.TryGetValue(key, out timer))
     {
         data.Add("Interval", timer.interval);
         data.Add("Next", timer.next - Environment.TickCount);
     }
     return data;
 }
        public string GetJsonConfig()
        {
            OSDMap map = new OSDMap(9);

            map.Add("Realm", m_freeSwitchRealm);
            map.Add("SIPProxy", m_freeSwitchSIPProxy);
            map.Add("AttemptUseSTUN", m_freeSwitchAttemptUseSTUN);
            map.Add("EchoServer", m_freeSwitchEchoServer);
            map.Add("EchoPort", m_freeSwitchEchoPort);
            map.Add("DefaultWellKnownIP", m_freeSwitchDefaultWellKnownIP);
            map.Add("DefaultTimeout", m_freeSwitchDefaultTimeout);
            map.Add("Context", m_freeSwitchContext);
            map.Add("APIPrefix", m_freeSwitchAPIPrefix);

            return OSDParser.SerializeJsonString(map);
        }
        public bool Charge (UUID agentID, int amount, string description, TransactionType transType,
            string identifer, bool chargeImmediately, bool runOnce)
        {
            var userService = m_registry.RequestModuleInterface<IUserAccountService> ();
            var user = userService.GetUserAccount (null, agentID);

            if (moneyModule != null) {
                if (chargeImmediately) {
                    bool success = moneyModule.Transfer (
                        (UUID)Constants.BankerUUID,            // pay the Banker
                        agentID,
                        amount,
                        description,
                        transType
                    );
                    if (!success) {
                        MainConsole.Instance.WarnFormat ("[Currency]: Unable to process {0} payment of {1}{2} from {3}",
                             description, currencySymbol, amount, user.Name);
                        return false;
                    }

                    MainConsole.Instance.WarnFormat ("[Currency]: Payment for {0} of {1}{2} from {3} has been paid",
                        description, currencySymbol, amount, user.Name);

                }

                if (!runOnce) {
                    // add a re-occurring scheduled payment
                    if (scheduler != null) {
                        string scid = UUID.Random ().ToString ();

                        OSDMap itemInfo = new OSDMap ();
                        itemInfo.Add ("AgentID", agentID);
                        itemInfo.Add ("Amount", amount);
                        itemInfo.Add ("Text", description);
                        itemInfo.Add ("Type", (int)transType);
                        itemInfo.Add ("SchedulerID", scid);

                        SchedulerItem item = new SchedulerItem (
                                             "ScheduledPayment " + identifer,                         // name
                                             OSDParser.SerializeJsonString (itemInfo),                // scheduled payment details
                                             false,                                                   // run once
                                             GetStipendPaytime (Constants.SCHEDULED_PAYMENTS_DELAY),  // next cycle + delay
                                             agentID);                                                // user to charge

                        // we need to use our own id here
                        item.id = scid;
                        scheduler.Save (item);
                    } else
                        MainConsole.Instance.WarnFormat ("[Currency]: Unable to add a new scheduled {0} payment of {1}{2} for {3}",
                            description, currencySymbol, amount, user.Name);
                }
            }
            return true;
        }