✅ TelnyxTenantResolverFilter: Resolved tenant 'e7f7179a-5393-4711-adae-083a22cf9e68' (schema: tenant_clinique_la_rive1_bleue1) for number: telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com - Context remains 'saas_db'
2025-10-20T22:23:14.385+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.security.web.FilterChainProxy        : Securing POST /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.386+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.s.security.TenantIdentifierFilter    : 🔒 TenantIdentifierFilter: Tenant already set to 'saas_db', skipping JWT extraction for URI: /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.386+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter  : Set SecurityContextHolder to anonymous SecurityContext
2025-10-20T22:23:14.386+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.security.web.FilterChainProxy        : Secured POST /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.387+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.web.servlet.DispatcherServlet        : POST "/api/voip/telnyx/ai/conversation-event", parameters={masked}
2025-10-20T22:23:14.387+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.saas.voip.controller.TelnyxEventController#handleConversationEvent(HttpServletRequest, Map)
2025-10-20T22:23:14.387+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2025-10-20T22:23:14.387+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.s.core.TenantIdentifierResolverImpl  : 🔍 resolveCurrentTenantIdentifier() CALLED - returning: saas_db
2025-10-20T22:23:14.389+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.v.controller.TelnyxEventController   : === TELNYX AI CONVERSATION EVENT ===
2025-10-20T22:23:14.389+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.v.controller.TelnyxEventController   : 📥 Content-Type: application/x-www-form-urlencoded
2025-10-20T22:23:14.389+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.v.controller.TelnyxEventController   : 📥 All parameters: {AccountSid=24b8c68c-c52a-4dd2-859c-22f1d2e62203, AnsweredTime=2025-10-20T21:23:00.472861Z, CallControlId=v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg, CallDuration=14, CallLegId=f3ff0314-adfa-11f0-b574-02420a1f1069, CallQualityStats={"inbound":{"jitter_max_variance":"0.00","jitter_packet_count":"0","mos":"4.50","packet_count":"645","skip_packet_count":"47"},"outbound":{"packet_count":"589","skip_packet_count":"0"}}, CallSessionId=f3fef78e-adfa-11f0-92f4-02420a1f1069, CallSid=v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg, CallSidLegacy=v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg, CallStatus=completed, CallbackSource=call-progress-events, CallingPartyType=sip, ConnectionId=2806750933822736154, EndTime=2025-10-20T21:23:14.232861Z, From=i8h9mz6m@sip.telnyx.eu, FromSipUri=i8h9mz6m@sip.telnyx.eu, HangupCause=normal_clearing, HangupSource=caller, OccurredAt=2025-10-20T21:23:14.232861Z, OrganizationId=24b8c68c-c52a-4dd2-859c-22f1d2e62203, SequenceNumber=0, SipHangupCause=200, StartTime=2025-10-20T21:23:00.472861Z, Timestamp=2025-10-20 21:23:14.407282Z, To=telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com, ToSipUri=telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com, UserId=24b8c68c-c52a-4dd2-859c-22f1d2e62203}
2025-10-20T22:23:14.397+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/yaml, application/xml;charset=UTF-8, text/xml;charset=UTF-8, application/*+xml;charset=UTF-8]
2025-10-20T22:23:14.397+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing [{status=received, params_count=27}]
2025-10-20T22:23:14.408+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2025-10-20T22:23:14.408+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] o.s.web.servlet.DispatcherServlet        : Completed 200 OK
2025-10-20T22:23:14.409+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.s.security.TenantIdentifierFilter    : 🧹 TenantIdentifierFilter: Cleared TenantContext after request
2025-10-20T22:23:14.409+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-2] c.s.v.filter.TelnyxTenantResolverFilter  : 🧹 TelnyxTenantResolverFilter: Cleared TenantContext
2025-10-20T22:23:14.475+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.filter.TelnyxTenantResolverFilter  : 🎯 TelnyxTenantResolverFilter: Intercepting webhook: /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.476+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] tor$SharedEntityManagerInvocationHandler : Creating new EntityManager for shared EntityManager invocation
2025-10-20T22:23:14.476+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.s.core.TenantIdentifierResolverImpl  : 🔍 resolveCurrentTenantIdentifier() CALLED - returning: saas_db
2025-10-20T22:23:14.476+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.create         : Created new SQL alias : pn1_0
2025-10-20T22:23:14.476+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.create         : Registration of TableGroup [StandardTableGroup(com.saas.admin.entity.PhoneNumber(32))] with identifierForTableGroup [com.saas.admin.entity.PhoneNumber] for NavigablePath [com.saas.admin.entity.PhoneNumber] 
2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.h.q.sqm.sql.BaseSqmToSqlAstConverter   : Determining mapping-model type for SqmParameter : org.hibernate.query.sqm.tree.expression.SqmJpaCriteriaParameterWrapper@32f823c7
2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.h.q.sqm.sql.BaseSqmToSqlAstConverter   : Determining mapping-model type for SqmPath : SqmBasicValuedSimplePath(com.saas.admin.entity.PhoneNumber(32).phoneNumber) 
2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.results.graph.AST      : DomainResult Graph:
 \-EntityResultImpl [com.saas.admin.entity.PhoneNumber(32)]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).createdAt]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).description]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).friendlyName]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).isActive]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).phoneNumber]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).provider]
 |  +-BasicFetch [com.saas.admin.entity.PhoneNumber(32).tenantId]
 |  \-BasicFetch [com.saas.admin.entity.PhoneNumber(32).updatedAt]

2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.tree           : SQL AST Tree:
    SelectStatement {
      FromClause {
        StandardTableGroup (pn1 : com.saas.admin.entity.PhoneNumber(32)) {
          primaryTableReference : phone_numbers as pn1_0
        }
      }
    }

2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.exec               : Skipping reading Query result cache data: cache-enabled = false, cache-mode = NORMAL
2025-10-20T22:23:14.477+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.SQL                        : 
    select
        pn1_0.id,
        pn1_0.created_at,
        pn1_0.description,
        pn1_0.friendly_name,
        pn1_0.is_active,
        pn1_0.phone_number,
        pn1_0.provider,
        pn1_0.tenant_id,
        pn1_0.updated_at 
    from
        phone_numbers pn1_0 
    where
        pn1_0.phone_number=?
Hibernate: 
    select
        pn1_0.id,
        pn1_0.created_at,
        pn1_0.description,
        pn1_0.friendly_name,
        pn1_0.is_active,
        pn1_0.phone_number,
        pn1_0.provider,
        pn1_0.tenant_id,
        pn1_0.updated_at 
    from
        phone_numbers pn1_0 
    where
        pn1_0.phone_number=?
2025-10-20T22:23:14.478+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : 🔥 getConnection() CALLED with tenantIdentifier: saas_db
2025-10-20T22:23:14.478+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : ⚡ Executing: USE saas_db
2025-10-20T22:23:14.478+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : ✅ Successfully switched to database: saas_db
2025-10-20T22:23:14.479+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.results                : Initializer list:
	  com.saas.admin.entity.PhoneNumber(32) -> EntityJoinedFetchInitializer(com.saas.admin.entity.PhoneNumber(32))@1278597406 (SingleTableEntityPersister(com.saas.admin.entity.PhoneNumber))

2025-10-20T22:23:14.481+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] tor$SharedEntityManagerInvocationHandler : Creating new EntityManager for shared EntityManager invocation
2025-10-20T22:23:14.481+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.s.core.TenantIdentifierResolverImpl  : 🔍 resolveCurrentTenantIdentifier() CALLED - returning: saas_db
2025-10-20T22:23:14.481+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.create         : Created new SQL alias : t1_0
2025-10-20T22:23:14.481+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.create         : Registration of TableGroup [StandardTableGroup(com.saas.admin.entity.Tenant(34))] with identifierForTableGroup [com.saas.admin.entity.Tenant] for NavigablePath [com.saas.admin.entity.Tenant] 
2025-10-20T22:23:14.481+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.h.q.sqm.sql.BaseSqmToSqlAstConverter   : Determining mapping-model type for SqmParameter : org.hibernate.query.sqm.tree.expression.SqmJpaCriteriaParameterWrapper@6d4eddeb
2025-10-20T22:23:14.481+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.h.q.sqm.sql.BaseSqmToSqlAstConverter   : Determining mapping-model type for SqmPath : SqmBasicValuedSimplePath(com.saas.admin.entity.Tenant(34).tenantId) 
2025-10-20T22:23:14.482+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.results.graph.AST      : DomainResult Graph:
 \-EntityResultImpl [com.saas.admin.entity.Tenant(34)]
 |  +-BasicFetch [com.saas.admin.entity.Tenant(34).createdAt]
 |  +-BasicFetch [com.saas.admin.entity.Tenant(34).schemaName]
 |  +-BasicFetch [com.saas.admin.entity.Tenant(34).status]
 |  +-BasicFetch [com.saas.admin.entity.Tenant(34).tenantId]
 |  +-BasicFetch [com.saas.admin.entity.Tenant(34).tenantName]
 |  \-BasicFetch [com.saas.admin.entity.Tenant(34).updatedAt]

2025-10-20T22:23:14.482+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.ast.tree           : SQL AST Tree:
    SelectStatement {
      FromClause {
        StandardTableGroup (t1 : com.saas.admin.entity.Tenant(34)) {
          primaryTableReference : tenants as t1_0
        }
      }
    }

2025-10-20T22:23:14.482+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.sql.exec               : Skipping reading Query result cache data: cache-enabled = false, cache-mode = NORMAL
2025-10-20T22:23:14.482+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.SQL                        : 
    select
        t1_0.id,
        t1_0.created_at,
        t1_0.schema_name,
        t1_0.status,
        t1_0.tenant_id,
        t1_0.tenant_name,
        t1_0.updated_at 
    from
        tenants t1_0 
    where
        t1_0.tenant_id=?
Hibernate: 
    select
        t1_0.id,
        t1_0.created_at,
        t1_0.schema_name,
        t1_0.status,
        t1_0.tenant_id,
        t1_0.tenant_name,
        t1_0.updated_at 
    from
        tenants t1_0 
    where
        t1_0.tenant_id=?
2025-10-20T22:23:14.482+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : 🔥 getConnection() CALLED with tenantIdentifier: saas_db
2025-10-20T22:23:14.482+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : ⚡ Executing: USE saas_db
2025-10-20T22:23:14.482+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] .s.c.SchemaMultiTenantConnectionProvider : ✅ Successfully switched to database: saas_db
2025-10-20T22:23:14.483+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] org.hibernate.orm.results                : Initializer list:
	  com.saas.admin.entity.Tenant(34) -> EntityJoinedFetchInitializer(com.saas.admin.entity.Tenant(34))@428708985 (SingleTableEntityPersister(com.saas.admin.entity.Tenant))

2025-10-20T22:23:14.484+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.filter.TelnyxTenantResolverFilter  : ✅ TelnyxTenantResolverFilter: Resolved tenant 'e7f7179a-5393-4711-adae-083a22cf9e68' (schema: tenant_clinique_la_rive1_bleue1) for number: telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com - Context remains 'saas_db'
2025-10-20T22:23:14.485+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.security.web.FilterChainProxy        : Securing POST /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.485+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.s.security.TenantIdentifierFilter    : 🔒 TenantIdentifierFilter: Tenant already set to 'saas_db', skipping JWT extraction for URI: /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.485+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.s.w.a.AnonymousAuthenticationFilter  : Set SecurityContextHolder to anonymous SecurityContext
2025-10-20T22:23:14.485+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.security.web.FilterChainProxy        : Secured POST /api/voip/telnyx/ai/conversation-event
2025-10-20T22:23:14.485+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.web.servlet.DispatcherServlet        : POST "/api/voip/telnyx/ai/conversation-event", parameters={masked}
2025-10-20T22:23:14.486+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.saas.voip.controller.TelnyxEventController#handleConversationEvent(HttpServletRequest, Map)
2025-10-20T22:23:14.486+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Opening JPA EntityManager in OpenEntityManagerInViewInterceptor
2025-10-20T22:23:14.486+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.s.core.TenantIdentifierResolverImpl  : 🔍 resolveCurrentTenantIdentifier() CALLED - returning: saas_db
2025-10-20T22:23:14.486+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.controller.TelnyxEventController   : === TELNYX AI CONVERSATION EVENT ===
2025-10-20T22:23:14.486+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.controller.TelnyxEventController   : 📥 Content-Type: application/x-www-form-urlencoded
2025-10-20T22:23:14.486+01:00  INFO 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.controller.TelnyxEventController   : 📥 All parameters: {AccountSid=24b8c68c-c52a-4dd2-859c-22f1d2e62203, BilledDurationSeconds[v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg]=18, CallCost[v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg]=0.0012, CallSid=v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg, CallSidLegacy=v3:JEJjRbNwvOgM2hQirBm9XFLOwZMh-bcLp55eaZQAlbAy75O5hnaFgg, CallbackSource=call-cost-events, CallerId=Telnyx Web Dialer, CallingPartyType=sip, ConnectionId=2806750933822736154, From=i8h9mz6m@sip.telnyx.eu, FromSipUri=i8h9mz6m@sip.telnyx.eu, To=telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com, ToSipUri=telnyxportal@assistant-265ff822-c3e7-43ca-b9f3-02d3ae189e7d.sip.telnyx.com}
2025-10-20T22:23:14.487+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/yaml, application/xml;charset=UTF-8, text/xml;charset=UTF-8, application/*+xml;charset=UTF-8]
2025-10-20T22:23:14.487+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing [{status=received, params_count=13}]
2025-10-20T22:23:14.487+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.j.s.OpenEntityManagerInViewInterceptor : Closing JPA EntityManager in OpenEntityManagerInViewInterceptor
2025-10-20T22:23:14.487+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] o.s.web.servlet.DispatcherServlet        : Completed 200 OK
2025-10-20T22:23:14.488+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.s.security.TenantIdentifierFilter    : 🧹 TenantIdentifierFilter: Cleared TenantContext after request
2025-10-20T22:23:14.488+01:00 DEBUG 9144 --- [saas-multitenant-api] [nio-7001-exec-3] c.s.v.filter.TelnyxTenantResolverFilter  : 🧹 TelnyxTenantResolverFilter: Cleared TenantContext