Remove a number from your SIP trunk with PHP
You can manage your Elastic SIP trunks with the API and remove a phone number from your SIP trunk.
In this guide you will learn:
- How to create your PHP application.
- How to remove a phone number
What you need to know before you start
Before you can get started, you need the following already set up:
- Set all Elastic SIP Trunking API configuration settings.
- PHP 8.1 or later and a familiarity with how to create a new file.
- A created SIP trunk.
Create your PHP file
Create a new file named remove-number.php and paste the provided "remove-number.php" code into the file.
This code makes a DELETE request to the EST API /trunks/{SIP_TRUNK_ID}/phoneNumbers endpoint which removes the phone number you specified in thephone_number
variable.Fill in your parameters
Before you can run the code, you need to update some values so you can connect to your Sinch account. Update the following parameters with your own values:
Parameter | Your value |
---|---|
projectId | The project ID to which your SIP trunk belongs. You can find this on your Sinch dashboard. |
sipTrunkId | The ID of the SIP trunk to which you want to assign the number. |
key | The access key found on your Sinch dashboard. |
secret | The access secret found on your Sinch dashboard. |
phoneNumber | The phone number you want to remove from your SIP trunk. |
Save the file.
Remove your phone number
Now you can execute the code and remove your phone number. Run the following command:
php remove-number.php
In your console, you should see a success response showing that the phone number was added to the SIP trunk.