commit
6ef4b0c9d0
|
|
@ -348,6 +348,10 @@ public class TwilioVoiceController : TwilioController
|
|||
await HookEmitter.Emit<ITwilioCallStatusHook>(_services, x => x.OnUserDisconnected(request));
|
||||
}
|
||||
}
|
||||
else if (request.CallStatus == "busy")
|
||||
{
|
||||
await HookEmitter.Emit<ITwilioCallStatusHook>(_services, x => x.OnCallBusyStatus(request));
|
||||
}
|
||||
|
||||
return Ok();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,13 @@ public interface ITwilioCallStatusHook
|
|||
Task OnRecordingCompleted(ConversationalVoiceRequest request);
|
||||
Task OnTranscribeCompleted(ConversationalVoiceRequest request);
|
||||
Task OnVoicemailStarting(ConversationalVoiceRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// 1. The recipient's phone line is already engaged.
|
||||
/// 2. Some users block unknown or spam calls, which may cause a "busy" status.
|
||||
/// 3. Some carriers explicitly return a busy signal instead of routing the call to voicemail.
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
Task OnCallBusyStatus(ConversationalVoiceRequest request);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,6 @@ public class ConversationalVoiceRequest : VoiceRequest
|
|||
[FromForm]
|
||||
public int MachineDetectionDuration { get; set; }
|
||||
|
||||
[FromForm]
|
||||
public int Duration { get; set; }
|
||||
|
||||
[FromForm]
|
||||
public int CallDuration { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -145,14 +145,17 @@ public class OutboundPhoneCallFn : IFunctionCallback
|
|||
Title = args.InitialMessage
|
||||
});
|
||||
|
||||
var messageId = Guid.NewGuid().ToString();
|
||||
convStorage.Append(newConversationId, new List<RoleDialogModel>
|
||||
{
|
||||
new RoleDialogModel(AgentRole.User, "Hi")
|
||||
{
|
||||
MessageId = messageId,
|
||||
CurrentAgentId = entryAgentId
|
||||
},
|
||||
new RoleDialogModel(AgentRole.Assistant, args.InitialMessage)
|
||||
{
|
||||
MessageId = messageId,
|
||||
CurrentAgentId = entryAgentId
|
||||
}
|
||||
});
|
||||
|
|
@ -160,6 +163,7 @@ public class OutboundPhoneCallFn : IFunctionCallback
|
|||
convService.SetConversationId(newConversationId,
|
||||
[
|
||||
new MessageState(StateConst.ORIGIN_CONVERSATION_ID, originConversationId),
|
||||
new MessageState("channel", "phone"),
|
||||
new MessageState("phone_from", call.From),
|
||||
new MessageState("phone_direction", call.Direction),
|
||||
new MessageState("phone_number", call.To),
|
||||
|
|
|
|||
Loading…
Reference in a new issue