Skip to content

The call.initiated webhook is incorrectly mapped to NumberOrderStatusUpdate or CallAIGatherEndedWebhookEvent, instead of the expected CallInitiatedWebhookEvent. #292

Description

@iwangpeng

A small portion of call.initiated webhooks have this issue. Related call_control_id: v3:EGaHosgKDqqWmnMNj0Z-5Z2iSJNkgWr9_Bk8KKrsn4mKNYtD_hHkpA

When testing with the same webhook data at different times, two different results were observed, both incorrect:

  • Tests before UTC 2026-05-15T04:00:00+0000 mapped to NumberOrderStatusUpdate
  • Tests after that time mapped to CallAIGatherEndedWebhookEvent
    (It is uncertain whether the issue is actually time-dependent.)

Tested versions: v4.133.0 (latest), v4.122.0, v4.116.0

Test code:

import telnyx
from django.conf import settings

telnyx_client = telnyx.Telnyx(api_key=settings.TELNYX_API_KEY, public_key=settings.TELNYX_PUBLIC_KEY)

data = '''{
  "created_at": "2026-05-14T23:21:06.640595Z",
  "event_type": "call.initiated",
  "payload": {
    "call_control_id": "v3:EGaHosgKDqqWmnMNj0Z-5Z2iSJNkgWr9_Bk8KKrsn4mKNYtD_hHkpA",
    "call_leg_id": "94839524-4feb-11f1-ab3d-02420aef951f",
    "call_session_id": "94838a52-4feb-11f1-bf82-02420aef951f",
    "caller_id_name": "+11111111111",
    "calling_party_type": "pstn",
    "client_state": null,
    "connection_codecs": "G722,PCMA,PCMU,VP8,H264",
    "connection_id": "1111111111111111111",
    "custom_headers": [
      {
        "name": "P-Asserted-Service",
        "value": "urn:urn-7:3gpp-service.ims.icsi.mmtel"
      },
      {
        "name": "P-Early-Media",
        "value": "supported"
      }
    ],
    "direction": "incoming",
    "from": "+11111111111",
    "from_sip_uri": "+11111111111@1.1.1.1",
    "occurred_at": "2026-05-14T23:21:05.251813Z",
    "offered_codecs": "AMR-WB~OCTET-ALIGN=0; MODE-SET=0,16000H,AMR-WB~OCTET-ALIGN=1; MODE-SET=0,16000H,PCMU",
    "sip_headers": [
      {
        "name": "Diversion",
        "value": "<sip:+11111111111@msg.pc.t-mobile.com;user=phone;enum=yes?Reason=SIP%3Bcause%3D302>;reason=unconditional;counter=1;privacy=off"
      }
    ],
    "start_time": "2026-05-14T23:21:05.251813Z",
    "state": "parked",
    "to": "+11111111111",
    "to_sip_uri": "+11111111111@1.1.1.1"
  },
  "record_type": "event",
  "webhook_id": "ea47dada-c255-40e6-b91b-2a9a8904c9c5"
}'''

event = telnyx_client.webhooks.unsafe_unwrap(data)
print(type(event))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions