Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Recreating DID Ranges

    Posted 06-05-2025 18:33

    jthalacker | 2025-01-21 15:55:02 UTC | #1

    I am attempting to use the SDK to recreate DID ranges so that each range is just the DID. I take the following steps:

    1. Get DID pools
    2. Get DIDs in pools
    3. Unassign DIDs
    4. Delete DID Pools
    5. Create DID pools for each DID

    6 Reassign DIDs

    Unfortunately I am having trouble with DIDs that have the owner_type of 'PHONE'. I can not figure out the correct endpoint to call to unassign the DID.

    Below is an example of the case when it is a phone that I wrote up, but I cant seem to find where the phone number is stored in phone_config.

     elif owner_type == "PHONE":
                        # Unassign from Phone
                        # Get the phone configuration using owner_id (retrieved from the DID response)
                        phone_config = telephony_api.get_telephony_providers_edges_phone(owner_id)
                        with open("output.txt", "w") as f:
                            f.write(f"phone config: {phone_config}")
                        # Remove the DID by setting the phone number to None or removing it from assigned lines
                        for line in phone_config.lines:
                            print(line)
                            if line.line_base_settings.phone_number == did_number:
                                # Remove the DID from the line (or set the phone number to None)
                                line.line_base_settings.phone_number = None
    
                        # Update the phone configuration to reflect the change
                        telephony_api.put_telephony_providers_edges_phone(owner_id, phone_config)

    Any help is greatly appreciated!


    system | 2025-02-21 15:55:08 UTC | #2

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 31325