How to bind a purchased phone number to a dispatch rule via API

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

I’m trying to use the new Phone Numbers feature. My FastAPI backend:

  1. Creates a SIP dispatch rule with CreateSIPDispatchRule
  2. Calls PhoneNumberService.UpdatePhoneNumber with that rule ID to bind a purchased number

But I get an error about the dispatch rule being a “catch all” rule.

Questions:

  1. Is there a way to make CreateSIPDispatchRule non-catch-all purely via API so UpdatePhoneNumber accepts it?
  2. Can we supply the PN_xxx identifier during rule creation?

Instead of using UpdatePhoneNumber after creating the dispatch rule, create the dispatch rule directly with the PN_abc123 identifier in the trunk_ids attribute.

The error you see is a protection to prevent production outages when modifying catch-all rules.

Current limitations:

  • Support is only for the US
  • You cannot use TransferSipParticipant on calls to these phone numbers yet. Outbound support will be added later.