Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,15 @@ await HookEmitter.Emit<ITwilioCallStatusHook>(_services,
{
instruction.SpeechPaths.Add(request.InitAudioFile);
}
response = twilio.ReturnNoninterruptedInstructions(instruction);

if (request.WelcomeMessageAllowToBeInterrupted.HasValue && request.WelcomeMessageAllowToBeInterrupted.Value)
{
response = twilio.ReturnInstructions(instruction);
}
else
{
response = twilio.ReturnNoninterruptedInstructions(instruction);
}
}

return TwiML(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class ConversationalVoiceRequest : VoiceRequest
[FromForm]
public int MachineDetectionDuration { get; set; }

[FromQuery(Name = "welcome_msg_allow_interrupt")]
public bool? WelcomeMessageAllowToBeInterrupted { get; set; }

[FromForm]
public int CallDuration { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class OutboundPhoneCallFn : IFunctionCallback

public string Name => "util-twilio-outbound_phone_call";
public string Indication => "Dialing the phone number";
public const string WelcomeMessageAllowToBeInterrupted = "welcome_msg_allow_interrupt";

public OutboundPhoneCallFn(
IServiceProvider services,
Expand Down Expand Up @@ -106,6 +107,11 @@ public async Task<bool> Execute(RoleDialogModel message)
processUrl += $"&init-audio-file={initAudioFile}";
}

if (agent.Labels.Contains(WelcomeMessageAllowToBeInterrupted))
{
processUrl += $"${WelcomeMessageAllowToBeInterrupted}=true";
}

// Make outbound call
var call = await CallResource.CreateAsync(
url: new Uri(processUrl),
Expand Down
Loading