HomeVICIdial TutorialsVICIdial Non Agent API TutorialsUpdating or Deleting Phone Records Using update_phone API in VICIdial

Updating or Deleting Phone Records Using update_phone API in VICIdial

Managing phone records efficiently is crucial for call centers, VoIP administrators, and IT teams using VICIdial. Whether updating SIP/IAX2 credentials, modifying extensions, or removing outdated phone records, VICIdial provides the update_phone API to handle these changes dynamically.

Instead of manually updating phone records through the VICIdial Admin Panel, this API allows for real-time updates, automation, and seamless integration with external VoIP management systems.

Why Use the update_phone API?

Modify phone extension settings dynamically
Update SIP/IAX2 authentication details without downtime
Enable or disable phone extensions in real-time
Delete outdated or inactive phone records automatically
Integrate with VoIP and PBX systems for centralized management

In this tutorial, we will cover:
🔹 How the update_phone API works
🔹 How to configure and authenticate API access
🔹 How to construct and send API requests
🔹 Examples using a browser, cURL, and Postman
🔹 How to interpret API responses and troubleshoot errors
🔹 Best practices for using the update_phone API efficiently

Let’s get started! 🚀


Understanding the update_phone API Function

The update_phone API allows administrators to modify an existing phone record or delete a phone extension in VICIdial.

What Information Can Be Updated Using update_phone API?

Phone Extension – Modify an existing extension’s settings
Protocol Type – Change between SIP or IAX2
Password – Update the phone’s authentication password
Server IP – Modify the server handling the phone registration
Active Status – Enable (Y) or disable (N) the extension
Registration Status – Specify whether the phone should register (Y or N)
Delete Phone Record – Remove the phone record from VICIdial

Common Use Cases for update_phone API

🔹 Updating SIP passwords for security purposes
🔹 Changing phone extension details dynamically
🔹 Disabling extensions for inactive agents
🔹 Deleting obsolete phone records for better database management
🔹 Automating phone record updates for a growing call center


Step 1: Prerequisites for Using the API

Before using the update_phone API, ensure you have:

VICIdial installed and configured
An API-enabled user account with administrative permissions**
A valid extension that exists in VICIdial for modification
VICIdial server access credentials

How to Enable API Access in VICIdial

1️⃣ Log in to the VICIdial Admin Panel
2️⃣ Navigate to Admin > Users
3️⃣ Select the user who will access the API
4️⃣ Set API Access to 1 (Enabled)
5️⃣ Set User Level to 8 or higher** (Admin-level access) 6️⃣ Add update_phoneto the **Allowed API Functions** (or set toALL`)
7️⃣ Click Save Changes

Now, your user is authorized to update or delete phone records dynamically using the API.


Step 2: Constructing the API Request

The VICIdial API uses HTTP GET requests, meaning you can access it via a browser, cURL, or API tools like Postman.

Base API URL

arduino
http://your-vicidial-server/vicidial/non_agent_api.php

🔹 Replace your-vicidial-server with your actual VICIdial instance.

Required Parameters for update_phone API

Parameter Description Example
function Specifies the API function (update_phone) update_phone
user VICIdial API username admin
pass VICIdial API password 1234
source Identifier for tracking API calls PhoneUpdate
extension The phone extension to update 1001
protocol (Optional) Change between SIP or IAX2 SIP
server_ip (Optional) Modify the server IP handling the phone 192.168.1.10
pass (Optional) Update the phone’s password newpassword123
active (Optional) Enable (Y) or disable (N) the extension Y
registration (Optional) Specify whether the phone should register (Y or N) Y
delete_phone (Optional) Delete the phone record (Y to delete) N

Step 3: Sending the API Request

Method 1: Updating a Phone Record via a Web Browser

Simply enter the following URL in your browser (replace credentials accordingly):

pgsql
http://your-vicidial-server/vicidial/non_agent_api.php?function=update_phone&user=admin&pass=1234&source=PhoneUpdate&extension=1001&protocol=SIP&server_ip=192.168.1.10&pass=newpassword123&active=Y&registration=Y

🔹 Press Enter, and the API should modify the phone extension settings.


Method 2: Updating a Phone Record via cURL (Command Line)

For developers, cURL is a convenient tool for making API requests. Use the following command:

bash
curl -X GET "http://your-vicidial-server/vicidial/non_agent_api.php?function=update_phone&user=admin&pass=1234&source=PhoneUpdate&extension=1001&protocol=SIP&server_ip=192.168.1.10&pass=newpassword123&active=Y&registration=Y"

🔹 This will return a confirmation message indicating the phone settings have been updated.


Method 3: Deleting a Phone Record via Postman

1️⃣ Open Postman
2️⃣ Set the request type to GET
3️⃣ Enter the API URL with delete_phone=Y
4️⃣ Click Send
5️⃣ The response should confirm that the phone record was removed


Step 4: Understanding API Responses

If the request is successful, VICIdial returns a response confirming the phone record update or deletion:

yaml
SUCCESS: 1001 | Phone Extension Updated Successfully

OR

yaml
SUCCESS: 1001 | Phone Extension Deleted Successfully

Breaking Down the Response

Response Value Meaning
SUCCESS The request was processed successfully
1001 The phone extension updated or deleted
Phone Extension Updated Successfully Confirmation message

Step 5: Handling Errors & Troubleshooting

Error Message Cause Solution
ERROR: USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION Insufficient API permissions Ensure user level is 8+ and API Access is enabled
ERROR: INVALID USERNAME OR PASSWORD Wrong credentials Verify API username and password
ERROR: PHONE EXTENSION NOT FOUND The specified extension does not exist Ensure extension is correct
ERROR: NO FUNCTION SPECIFIED Missing function parameter Ensure function=update_phone is included

Step 6: Best Practices for Using the update_phone API

Regularly review phone records for security and efficiency
Ensure strong passwords for SIP/IAX2 authentication
Restrict API access to authorized users to prevent misuse
Automate phone record management for large-scale deployments
Log all phone updates for auditing and compliance tracking


Conclusion

The update_phone API function is an essential tool for managing phone records dynamically in VICIdial. Whether you’re modifying extensions, updating SIP/IAX2 credentials, enabling/disabling phones, or deleting outdated records, this API provides a fast and efficient way to manage your call center infrastructure.

Feel free to contact us or simply start a live chat to get connected to one of our team members. Here is our contact information.

Calling from US: +1 954-990-0053
Email: office@callix.ai

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Special Offerspot_img

Must Read

spot_img
spot_img
spot_img

Related Articles - Must Read

spot_img