This repository has been archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
addressing comments/error handling/stylecop issues
- Loading branch information
Vanshika Sinha
committed
Apr 22, 2021
1 parent
0b9b6d2
commit 410c06f
Showing
7 changed files
with
1,128 additions
and
95 deletions.
There are no files selected for viewing
1,021 changes: 1,021 additions & 0 deletions
1,021
packages/.vs/Microsoft.Bot.Components/config/applicationhost.config
Large diffs are not rendered by default.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
packages/Microsoft.Bot.Components.Telephony/Actions/CallTransfer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
namespace Microsoft.Bot.Components.Telephony.Actions | ||
{ | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using AdaptiveExpressions.Properties; | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Builder.Dialogs; | ||
using Newtonsoft.Json; | ||
|
||
/// <summary> | ||
/// Transfers call to given phone number. | ||
/// </summary> | ||
public class CallTransfer : Dialog | ||
{ | ||
/// <summary> | ||
/// Class identifier. | ||
/// </summary> | ||
[JsonProperty("$kind")] | ||
public const string Kind = "Microsoft.Telephony.CallTransfer"; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="CallTransfer"/> class. | ||
/// </summary> | ||
/// <param name="sourceFilePath">Optional, source file full path.</param> | ||
/// <param name="sourceLineNumber">Optional, line number in source file.</param> | ||
[JsonConstructor] | ||
public CallTransfer([CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) | ||
: base() | ||
{ | ||
// enable instances of this command as debug break point | ||
this.RegisterSourceLocation(sourceFilePath, sourceLineNumber); | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the phone number to be included when sending the handoff activity. | ||
/// </summary> | ||
/// <value> | ||
/// <see cref="StringExpression"/>. | ||
/// </value> | ||
[JsonProperty("phoneNumber")] | ||
public StringExpression PhoneNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Called when the dialog is started and pushed onto the dialog stack. | ||
/// </summary> | ||
/// <param name="dc">The <see cref="DialogContext"/> for the current turn of conversation.</param> | ||
/// <param name="options">Optional, initial information to pass to the dialog.</param> | ||
/// <param name="cancellationToken">A cancellation token that can be used by other objects | ||
/// or threads to receive notice of cancellation.</param> | ||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> | ||
public async override Task<DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default(CancellationToken)) | ||
{ | ||
var phoneNumber = this.PhoneNumber?.GetValue(dc.State); | ||
|
||
// Create handoff event, passing the phone number to transfer to as context. | ||
var context = new { TargetPhoneNumber = phoneNumber }; | ||
var handoffEvent = EventFactory.CreateHandoffInitiation(dc.Context, context); | ||
await dc.Context.SendActivityAsync(handoffEvent, cancellationToken).ConfigureAwait(false); | ||
return await dc.EndDialogAsync(result: null, cancellationToken: cancellationToken).ConfigureAwait(false); | ||
} | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
packages/Microsoft.Bot.Components.Telephony/Actions/CallTransferDialog.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 11 additions & 8 deletions
19
packages/Microsoft.Bot.Components.Telephony/TelephonyBotComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Bot.Components.Telephony.Actions; | ||
using Microsoft.Bot.Builder.Dialogs.Declarative; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Bot.Builder; | ||
|
||
namespace Microsoft.Bot.Components.Telephony | ||
{ | ||
public class TeamsBotComponent : BotComponent | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Builder.Dialogs.Declarative; | ||
using Microsoft.Bot.Components.Telephony.Actions; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
/// <summary> | ||
/// Telephony actions registration. | ||
/// </summary> | ||
public class TelephonyBotComponent : BotComponent | ||
{ | ||
/// <inheritdoc/> | ||
public override void ConfigureServices(IServiceCollection services, IConfiguration configuration) | ||
{ | ||
// Conditionals | ||
services.AddSingleton<DeclarativeType>(sp => new DeclarativeType<CallTransferDialog>(CallTransferDialog.Kind)); | ||
services.AddSingleton<DeclarativeType>(sp => new DeclarativeType<CallTransfer>(CallTransfer.Kind)); | ||
} | ||
} | ||
} |