Added config construction for audio conf in DDVC MOB bridge

This commit is contained in:
Heath Volmer
2018-09-25 14:36:38 -06:00
parent 101d1b5625
commit 78668e8abb
2 changed files with 59 additions and 14 deletions

View File

@@ -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;
/// <summary>
///
@@ -68,8 +61,9 @@ namespace PepperDash.Essentials.AppServer.Messengers
/// </summary>
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<string, uint> 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<string>(s => EISC.SetString(SCurrentDialString, s)));
}
}
}

View File

@@ -61,14 +61,15 @@ namespace PepperDash.Essentials.Room.Cotija
/// 63
/// </summary>
public const uint ShutdownStart = 63;
/// <summary>
/// 72
/// </summary>
public const uint SourceHasChanged = 72;
/// <summary>
/// 261 - The start of the range of speed dial visibles
/// </summary>
public const uint SpeedDialVisibleStartJoin = 261;
/// <summary>
/// 501
/// </summary>
public const uint ConfigIsReady = 501;
@@ -93,6 +94,16 @@ namespace PepperDash.Essentials.Room.Cotija
/// 71
/// </summary>
public const uint SelectedSourceKey = 71;
/// <summary>
/// 241
/// </summary>
public const uint SpeedDialNameStartJoin = 241;
/// <summary>
/// 251
/// </summary>
public const uint SpeedDialNumberStartJoin = 251;
/// <summary>
/// 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<PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem>();
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;