Example #1
0
 public void Activate()
 {
     if (Codec.SendCommand("Cameras/SpeakerTrack/Activate").Root.Elements().FirstOrDefault().Attribute("status").Value == "OK")
     {
         this.Active = true;
     }
 }
Example #2
0
        public void DTMFSend(string dtmfString)
        {
            CommandArgs args = new CommandArgs("CallId", this.ID);

            args.Add(new CommandArg("DTMFString", dtmfString));
            Codec.SendCommand("Call/DTMFSend", args);
        }
Example #3
0
        public DialResult Dial(CommandArgs args)
        {
            try
            {
                XDocument xml        = Codec.SendCommand("Dial", args);
                XElement  dialResult = xml.Root.Element("DialResult");
                if (dialResult.Attribute("status").Value == "OK")
                {
                    int callID = int.Parse(dialResult.Element("CallId").Value);
                    if (!_Calls.ContainsKey(callID))
                    {
                        _Calls.Add(callID, new Call(Codec, callID));
                        if (args.ContainsArg("CallType"))
                        {
                            _Calls[callID].Type = (CallType)Enum.Parse(typeof(CallType), args["CallType"].Value, false);
                        }
                        _Calls[callID].RemoteNumber = args["Number"].Value;
                        _Calls[callID].Direction    = CallDirection.Outgoing;
                        _Calls[callID].Status       = CallStatus.Dialling;
                        OnCallStatusChange(_Calls[callID], CallInfoChangeNotificationSource.DialRequest);
                    }
                    try
                    {
                        if (this.Codec.LoggingEnabled)
                        {
                            this.Codec.Logger.Log("Dialed call with API - Result ok - Call ID: {0}", callID);
                        }
                    }
                    catch
                    {
                        ErrorLog.Error("Could not write to Codec.Logger in Codec.Call.Dial()");
                    }
                    return(new DialResult(callID));
                }
                else if (dialResult.Attribute("status").Value == "Error")
                {
                    if (this.Codec.LoggingEnabled)
                    {
                        this.Codec.Logger.Log("Dialed call with API - Result error - {0}", dialResult.Element("Description").Value);
                    }
                    return(new DialResult(int.Parse(dialResult.Element("Cause").Value), dialResult.Element("Description").Value));
                }
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in Codec.Dial(), {0}", e.Message);
            }

            return(new DialResult(0, "Unknown Error"));
        }
Example #4
0
        public void Register(int feedbackSlot, string[] expressions, bool deregisterFirst)
        {
            CommandArgs args = new CommandArgs();

            args.Add("FeedbackSlot", feedbackSlot.ToString());

            if (deregisterFirst || deregisterOnBoot)
            {
                if (deregisterOnBoot)
                {
                    CrestronConsole.PrintLine("Deregistering codec feedback on first boot to combat potential issue with codec lockups");
                }
#if DEBUG
                CrestronConsole.PrintLine("Deresgistering feedback mechanism with CiscoCodec");
#endif
                Codec.SendCommand("HttpFeedback/Deregister", args);

                if (deregisterOnBoot)
                {
                    deregisterOnBoot = false;
                }
            }

            args.Add("ServerUrl", this.ServerURL);

            int count = 1;

            foreach (string expression in expressions)
            {
                args.Add("Expression", count, expression);
                count++;
            }
#if DEBUG
            CrestronConsole.PrintLine("Resgistering feedback mechanism with CiscoCodec");
#endif

            Codec.SendCommand("HttpFeedback/Register", args);
        }
Example #5
0
 /// <summary>
 /// Reboot or shutdown the codec
 /// </summary>
 /// <param name="action">BootAction parameter to restart or shutdown</param>
 public void Boot(BootAction action)
 {
     Codec.SendCommand("SystemUnit/Boot", new CommandArgs("Action", action.ToString()));
 }
Example #6
0
        public PhonebookSearchResults Search(CommandArgs searchCommandArgs)
        {
            XDocument xml = Codec.SendCommand("Phonebook/Search", searchCommandArgs);

            XElement element = xml.Root.Element("PhonebookSearchResult");

#if DEBUG
            CrestronConsole.PrintLine(element.ToString());
#endif
            if (element.Attribute("status").Value == "OK")
            {
                List <IPhonebookItem> items = new List <IPhonebookItem>();

                if (element.Element("ResultSet") != null)
                {
#if DEBUG
                    CrestronConsole.PrintLine("Phonebook results contain element \"ResultSet\"");
#endif
                    element = element.Element("ResultSet");
                }
                int offset    = int.Parse(element.Element("ResultInfo").Element("Offset").Value);
                int limit     = int.Parse(element.Element("ResultInfo").Element("Limit").Value);
                int totalRows = int.Parse(element.Element("ResultInfo").Element("TotalRows").Value);

#if DEBUG
                CrestronConsole.PrintLine("Offset = {0}, Limit = {1}, TotalRows = {2}", offset, limit, totalRows);
#endif
                if (totalRows > 0)
                {
                    IEnumerable <XElement> contactsData = element.Elements("Contact");
                    IEnumerable <XElement> foldersData  = element.Elements("Folder");

                    foreach (XElement c in contactsData)
                    {
                        PhonebookContact contact;

                        if (c.Element("FolderId") != null)
                        {
                            contact = new PhonebookContact(Codec,
                                                           c.Element("ContactId").Value,
                                                           c.Element("Name").Value,
                                                           c.Element("FolderId").Value);
                        }
                        else
                        {
                            contact = new PhonebookContact(Codec,
                                                           c.Element("ContactId").Value,
                                                           c.Element("Name").Value);
                        }

                        items.Add(contact);

                        foreach (XElement e in c.Elements())
                        {
                            switch (e.Name)
                            {
                            case "Title": contact.Title = e.Value; break;
                            }
                        }

                        List <PhonebookContactMethod> methods     = new List <PhonebookContactMethod>();
                        IEnumerable <XElement>        methodsData = c.Elements("ContactMethod");

                        foreach (XElement m in methodsData)
                        {
                            PhonebookContactMethod method = new PhonebookContactMethod(contact,
                                                                                       m.Element("ContactMethodId").Value,
                                                                                       m.Element("Number").Value);
                            methods.Add(method);

                            foreach (XElement e in m.Elements())
                            {
                                switch (e.Name)
                                {
                                case "Device": method.Device = e.Value; break;

                                case "Protocol": method.Protocol = e.Value; break;

                                case "CallType": method.CallType = (CallType)Enum.Parse(typeof(CallType), e.Value, false); break;
                                }
                            }
                        }

                        contact.AddMethods(methods);
                    }

                    foreach (XElement f in foldersData)
                    {
                        PhonebookFolder folder;

                        if (f.Element("ParentFolderId") != null)
                        {
                            folder = new PhonebookFolder(Codec,
                                                         f.Element("FolderId").Value,
                                                         f.Element("Name").Value,
                                                         f.Element("ParentFolderId").Value);
                        }
                        else
                        {
                            folder = new PhonebookFolder(Codec,
                                                         f.Element("FolderId").Value,
                                                         f.Element("Name").Value);
                        }

                        items.Add(folder);
                    }
                }

                return(new PhonebookSearchResults(items, offset, limit));
            }

            return(new PhonebookSearchResults(true));
        }
Example #7
0
 public void SelfViewSet(SelfViewMode mode)
 {
     Codec.SendCommand("Video/Selfview/Set", new CommandArgs("Mode", mode.ToString()));
 }
Example #8
0
 /// <summary>
 /// Activate the do not disturb option on the codec
 /// </summary>
 public void Activate()
 {
     Codec.SendCommand("Conference/DoNotDisturb/Activate");
     Active = true;
 }