This commit is contained in:
Jicheng Lu 2025-07-14 12:51:59 -05:00
parent a453009394
commit 85a87eda7a
3 changed files with 14 additions and 14 deletions

View file

@ -16,12 +16,12 @@ public class MessageState
}
public MessageState(string key, object value, int activeRounds = -1, bool global = false)
public MessageState(string key, object value, int activeRounds = -1, bool isGlobal = false)
{
Key = key;
Value = value;
ActiveRounds = activeRounds;
Global = global;
Global = isGlobal;
}
public override string ToString()

View file

@ -166,16 +166,16 @@ public class TwilioInboundController : TwilioController
var states = new List<MessageState>
{
new("channel", ConversationChannel.Phone, global: true),
new("calling_phone", request.From, global: true),
new("phone_direction", request.Direction, global: true),
new("twilio_call_sid", request.CallSid, global: true),
new("channel", ConversationChannel.Phone, isGlobal: true),
new("calling_phone", request.From, isGlobal: true),
new("phone_direction", request.Direction, isGlobal: true),
new("twilio_call_sid", request.CallSid, isGlobal: true),
};
if (request.Direction == "inbound")
{
states.Add(new MessageState("calling_phone_from", request.From, global: true));
states.Add(new MessageState("calling_phone_to", request.To, global: true));
states.Add(new MessageState("calling_phone_from", request.From, isGlobal: true));
states.Add(new MessageState("calling_phone_to", request.To, isGlobal: true));
}
var requestStates = ParseStates(request.States);

View file

@ -189,12 +189,12 @@ public class OutboundPhoneCallFn : IFunctionCallback
var curConvStates = state.GetStates().Select(x => new MessageState(x.Key, x.Value)).ToList();
var subConvStates = new List<MessageState>
{
new(StateConst.ORIGIN_CONVERSATION_ID, originConversationId, global: true),
new("channel", "phone", global: true),
new("phone_from", call.From, global: true),
new("phone_direction", call.Direction, global: true),
new("phone_number", call.To, global: true),
new("twilio_call_sid", call.Sid, global: true)
new(StateConst.ORIGIN_CONVERSATION_ID, originConversationId, isGlobal: true),
new("channel", "phone", isGlobal: true),
new("phone_from", call.From, isGlobal: true),
new("phone_direction", call.Direction, isGlobal: true),
new("phone_number", call.To, isGlobal: true),
new("twilio_call_sid", call.Sid, isGlobal: true)
};
var subStateKeys = subConvStates.Select(x => x.Key).ToList();
var included = curConvStates.Where(x => !subStateKeys.Contains(x.Key) && !excludeStates.Contains(x.Key));