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.
provisionPhonesinchannels/phone.tsputs 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.wireChannelsinchannels/wire.tspoints each artifact’s webhook at the function, with the previous webhook remembered inagent.jsonso thatremove phoneanddeletecan restore it. They delete only the artifactsdeploycreated.- Two routes, one per artifact type with
*for the id, go into the list passed tochannelRoutesin.telnyx/index.ts, because the artifacts are created after the function is built.channels/index.tsserves them at/webhooks/call_control_application/<id>and/webhooks/messaging_profile/<id>. - The base class becomes
defineManagedVoiceAgent(spec)frommanaged/voice.ts, because the agent now answers calls. It wraps the managed class in thevoice()mixin from@telnyx/edge-runtime/voice.