mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: add Dial method with password support and implement ICodecCallControlsMessenger for call control messaging
This commit is contained in:
parent
8748157362
commit
b945ecb470
7 changed files with 57 additions and 8 deletions
|
|
@ -18,4 +18,11 @@ public interface ICodecCallControls : IHasDialer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="meeting">The meeting to dial</param>
|
/// <param name="meeting">The meeting to dial</param>
|
||||||
void Dial(Meeting meeting);
|
void Dial(Meeting meeting);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dials the specified number with an optional password
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number">The number to dial</param>
|
||||||
|
/// <param name="password">The optional password for the call</param>
|
||||||
|
void Dial(string number, string password);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Dial(string number, string password)
|
||||||
|
{
|
||||||
|
Debug.LogMessage(LogEventLevel.Debug, this, "Dial: {0} with password: {1}", number, password);
|
||||||
|
var call = new CodecActiveCallItem() { Name = number, Number = number, Id = number, Status = eCodecCallStatus.Dialing, Direction = eCodecCallDirection.Outgoing, Type = eCodecCallType.Video };
|
||||||
|
ActiveCalls.Add(call);
|
||||||
|
OnCallStatusChange(call);
|
||||||
|
//ActiveCallCountFeedback.FireUpdate();
|
||||||
|
// Simulate 2-second ring, then connecting, then connected
|
||||||
|
var dialTimer = new Timer(2000) { AutoReset = false };
|
||||||
|
dialTimer.Elapsed += (s, e) =>
|
||||||
|
{
|
||||||
|
call.Type = eCodecCallType.Video;
|
||||||
|
SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connecting, call);
|
||||||
|
var connectTimer = new Timer(1000) { AutoReset = false };
|
||||||
|
connectTimer.Elapsed += (ss, ee) => SetNewCallStatusAndFireCallStatusChange(eCodecCallStatus.Connected, call);
|
||||||
|
connectTimer.Start();
|
||||||
|
};
|
||||||
|
dialTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void EndCall(CodecActiveCallItem call)
|
public override void EndCall(CodecActiveCallItem call)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,8 @@ public abstract class VideoCodecBase : ReconfigurableDevice, IRoutingSource,
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Dial(string number);
|
public abstract void Dial(string number);
|
||||||
|
|
||||||
|
public abstract void Dial(string number, string password);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ends the specified call
|
/// Ends the specified call
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides a messaging bridge for devices implementing <see cref="ICodecCallControls"/>
|
/// Provides a messaging bridge for devices implementing <see cref="ICodecCallControls"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ICallControlsMessenger : MessengerBase
|
public class ICodecCallControlsMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
private readonly ICodecCallControls _callControls;
|
private readonly ICodecCallControls _callControls;
|
||||||
|
|
||||||
/// Initializes a new instance of the <see cref="ICallControlsMessenger"/> class.
|
/// Initializes a new instance of the <see cref="CodecCallControlsMessenger"/> class.
|
||||||
public ICallControlsMessenger(string key, string messagePath, EssentialsDevice device)
|
public ICodecCallControlsMessenger(string key, string messagePath, EssentialsDevice device)
|
||||||
: base(key, messagePath, device)
|
: base(key, messagePath, device)
|
||||||
{
|
{
|
||||||
_callControls = device as ICodecCallControls ?? throw new ArgumentNullException(nameof(device));
|
_callControls = device as ICodecCallControls ?? throw new ArgumentNullException(nameof(device));
|
||||||
|
|
@ -38,6 +38,12 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
AddAction("/dialMeeting", (id, content) =>
|
AddAction("/dialMeeting", (id, content) =>
|
||||||
_callControls.Dial(content.ToObject<Meeting>()));
|
_callControls.Dial(content.ToObject<Meeting>()));
|
||||||
|
|
||||||
|
AddAction("/dialNumber", (id, content) =>
|
||||||
|
{
|
||||||
|
var message = content.ToObject<ICallControlsDialMeetingMessage>();
|
||||||
|
_callControls.Dial(message.Number, message.Password);
|
||||||
|
});
|
||||||
|
|
||||||
AddAction("/endCallById", (id, content) =>
|
AddAction("/endCallById", (id, content) =>
|
||||||
{
|
{
|
||||||
var s = content.ToObject<MobileControlSimpleContent<string>>();
|
var s = content.ToObject<MobileControlSimpleContent<string>>();
|
||||||
|
|
@ -113,4 +119,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
public List<CodecActiveCallItem> Calls { get; set; }
|
public List<CodecActiveCallItem> Calls { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ICallControlsDialMeetingMessage
|
||||||
|
{
|
||||||
|
[JsonProperty("number", Required = Required.Always)]
|
||||||
|
public string Number { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("password", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public string Password { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +143,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||||
HasDirectory = true,
|
HasDirectory = true,
|
||||||
HasDirectorySearch = true,
|
HasDirectorySearch = true,
|
||||||
DirectorySelectedFolderName = _directory.CurrentDirectoryResult?.CurrentDirectoryResults?.Count > 0 ? _directory.CurrentDirectoryResult.CurrentDirectoryResults[0].Name : null,
|
DirectorySelectedFolderName = _directory.CurrentDirectoryResult?.CurrentDirectoryResults?.Count > 0 ? _directory.CurrentDirectoryResult.CurrentDirectoryResults[0].Name : null,
|
||||||
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectorResultIsNotDirectoryRoot?.BoolValue
|
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectoryResultIsNotDirectoryRoot?.BoolValue
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ public class IHasScheduleAwarenessMessenger : MessengerBase
|
||||||
|
|
||||||
protected override void RegisterActions()
|
protected override void RegisterActions()
|
||||||
{
|
{
|
||||||
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject());
|
AddAction("/schedule/fullStatus", (id, content) => SendFullScheduleObject(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
private void CodecSchedule_MeetingEventChange(object sender, MeetingEventArgs e)
|
||||||
|
|
@ -45,13 +45,13 @@ public class IHasScheduleAwarenessMessenger : MessengerBase
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to send the full schedule data
|
/// Helper method to send the full schedule data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SendFullScheduleObject()
|
private void SendFullScheduleObject(string id = null)
|
||||||
{
|
{
|
||||||
PostStatusMessage(new FullScheduleMessage
|
PostStatusMessage(new FullScheduleMessage
|
||||||
{
|
{
|
||||||
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
Meetings = ScheduleSource.CodecSchedule.Meetings,
|
||||||
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
MeetingWarningMinutes = ScheduleSource.CodecSchedule.MeetingWarningMinutes
|
||||||
});
|
}, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -172,9 +172,14 @@ namespace PepperDash.Essentials
|
||||||
),
|
),
|
||||||
new MessengerFactoryEntry(
|
new MessengerFactoryEntry(
|
||||||
typeof(ICodecCallControls),
|
typeof(ICodecCallControls),
|
||||||
(d, mp, ck) => new ICallControlsMessenger(
|
(d, mp, ck) => new ICodecCallControlsMessenger(
|
||||||
$"{d.Key}-callControls-{ck}", mp, d)
|
$"{d.Key}-callControls-{ck}", mp, d)
|
||||||
),
|
),
|
||||||
|
new MessengerFactoryEntry(
|
||||||
|
typeof(IHasScheduleAwareness),
|
||||||
|
(d, mp, ck) => new IHasScheduleAwarenessMessenger(
|
||||||
|
$"{d.Key}-schedule-{ck}", (IHasScheduleAwareness)d, mp)
|
||||||
|
),
|
||||||
new MessengerFactoryEntry(
|
new MessengerFactoryEntry(
|
||||||
typeof(IHasContentSharing),
|
typeof(IHasContentSharing),
|
||||||
(d, mp, ck) => new IHasContentSharingMessenger(
|
(d, mp, ck) => new IHasContentSharingMessenger(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue