Skip to main content
add phone <number> appends the number to phone. Before anything ships, checkNumbers in channels/phone.ts looks each number up in the account, and a missing or inactive number stops the deploy. At deploy three things follow from it.
  • provisionPhones in channels/phone.ts puts the number on a Call Control application for calls and a messaging profile for texts, created and named <agent> (telnyx-acp) when the number is bare. wireChannels in channels/wire.ts points each artifact’s webhook at the function, with the previous webhook remembered in agent.json so that remove phone and delete can restore it. They delete only the artifacts deploy created.
  • Two routes, one per artifact type with * for the id, go into the list passed to channelRoutes in .telnyx/index.ts, because the artifacts are created after the function is built. channels/index.ts serves them at /webhooks/call_control_application/<id> and /webhooks/messaging_profile/<id>.
  • The base class becomes defineManagedVoiceAgent(spec) from managed/voice.ts, because the agent now answers calls. It wraps the managed class in the voice() mixin from @telnyx/edge-runtime/voice.
The Messaging Webhook and The Call Webhook follow a text and a call from there.