Skip to content

Conversation

yileicn
Copy link
Collaborator

@yileicn yileicn commented Jul 8, 2025

PR Type

Enhancement


Description

  • Moved OnSessionCreated hook to execute earlier in flow

  • Optimized Twilio session hook timing and placement


Changes diagram

flowchart LR
  A["Session Creating Hook"] --> B["Initialize Conversation"]
  B --> C["Session Created Hook"]
  C --> D["Machine Detection Check"]
  D --> E["Recording Start"]
Loading

Changes walkthrough 📝

Relevant files
Enhancement
TwilioInboundController.cs
Optimize session hook execution timing                                     

src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioInboundController.cs

  • Moved OnSessionCreated hook call to execute immediately after
    conversation initialization
  • Removed duplicate hook call from later in the method
  • Improved hook execution timing for better session management
  • +6/-6     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • yileicn added 5 commits June 27, 2025 14:13
    …o end the conversation. It should call route_to_agent with converation_end as true
    … wants to end the conversation. It should call route_to_agent with converation_end as true"
    
    This reverts commit 8d5b140.
    Copy link

    qodo-merge-pro bot commented Jul 8, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Hook Timing

    The OnSessionCreated hook is now called before machine detection check, which may cause the hook to execute for calls that will be immediately terminated due to machine detection. This could lead to unnecessary processing or side effects.

    await HookEmitter.Emit<ITwilioSessionHook>(_services, async hook =>
    {
        await hook.OnSessionCreated(request);
    }, request.AgentId);
    Code Structure

    The closing brace placement at line 122 appears to be misaligned or potentially creates an unbalanced block structure that should be verified for proper code flow.

    }        

    @yileicn yileicn merged commit 6d35224 into SciSharp:master Jul 8, 2025
    3 of 4 checks passed
    Copy link

    qodo-merge-pro bot commented Jul 8, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant