diff --git a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs b/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs index c36702aa..139ada9a 100644 --- a/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/AtcDdvc01Messenger.cs @@ -39,17 +39,10 @@ namespace PepperDash.Essentials.AppServer.Messengers const uint BIsOffHook = 224; const uint BDialHangupIsVisible = 251; const uint BCallIsIncoming = 254; - const uint BSpeedDialIsVisible1 = 261; - const uint BSpeedDialIsVisible2 = 262; - const uint BSpeedDialIsVisible3 = 263; - const uint BSpeedDialIsVisible4 = 264; - const uint SCurrentDialString = 201; - const uint SSpeedDialName1 = 241; - const uint SSpeedDialName2 = 242; - const uint SSpeedDialName3 = 243; - const uint SSpeedDialName4 = 244; + const uint SHookState = 221; + /// /// @@ -68,8 +61,9 @@ namespace PepperDash.Essentials.AppServer.Messengers /// void SendFullStatus() { + this.PostStatusMessage(new - { + { atc = new { callIsIncoming = EISC.GetBool(BCallIsIncoming), @@ -93,6 +87,7 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.SetBoolSigAction(BDialHangupIsVisible, b => send(new { dialHangupIsVisible = b })); EISC.SetBoolSigAction(BCallIsIncoming, b => send(new { callIsIncoming = b })); EISC.SetStringSigAction(SCurrentDialString, s => send(new { currentDialString = s })); + EISC.SetStringSigAction(SHookState, s => send(new { callStatus = s })); // Add press and holds using helper Action addPHAction = (s, u) => @@ -122,6 +117,10 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/speedDial4", BSpeedDial4); AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus)); + + // Dial on string +#warning Does this need to set the string and then dial? + AppServerController.AddAction(MessagePath + "/dial", new Action(s => EISC.SetString(SCurrentDialString, s))); } } } \ No newline at end of file diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index c3d47916..773c1158 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -61,14 +61,15 @@ namespace PepperDash.Essentials.Room.Cotija /// 63 /// public const uint ShutdownStart = 63; - - - /// /// 72 /// public const uint SourceHasChanged = 72; /// + /// 261 - The start of the range of speed dial visibles + /// + public const uint SpeedDialVisibleStartJoin = 261; + /// /// 501 /// public const uint ConfigIsReady = 501; @@ -93,6 +94,16 @@ namespace PepperDash.Essentials.Room.Cotija /// 71 /// public const uint SelectedSourceKey = 71; + + /// + /// 241 + /// + public const uint SpeedDialNameStartJoin = 241; + + /// + /// 251 + /// + public const uint SpeedDialNumberStartJoin = 251; /// /// 501 @@ -185,7 +196,7 @@ namespace PepperDash.Essentials.Room.Cotija SetupFunctions(); SetupFeedbacks(); - AtcMessenger = new Ddvc01AtcMessenger(EISC, "/atc"); + AtcMessenger = new Ddvc01AtcMessenger(EISC, "/device/audioCodec"); AtcMessenger.RegisterWithAppServer(Parent); EISC.SigChange += EISC_SigChange; @@ -467,6 +478,41 @@ namespace PepperDash.Essentials.Room.Cotija co.SourceLists.Add("default", newSl); + // build "audioCodec" config if we need + if (string.IsNullOrEmpty(rmProps.AudioCodecKey)) + { + var acFavs = new List(); + for (uint i = 0; i < 4; i++) + { + if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i)) + { + break; + } + acFavs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem() + { + Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i), + Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i), + Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio + }); + } + + var acProps = new + { + favorites = acFavs + }; + + var acStr = "audioCodec"; + var acConf = new DeviceConfig() + { + Group = acStr, + Key = acStr, + Name = acStr, + Type = acStr, + Properties = JToken.FromObject(acProps) + }; + co.Devices.Add(acConf); + } + Debug.Console(0, this, "******* CONFIG FROM DDVC: \r{0}", JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented)); var handler = ConfigurationIsReady;