Audiocodes SBC – Python script to backup INI file on daily basis
In this post we are going to check how to backup Audiocodes SBC INI file using Python Script. In a normal scenario, if you need to backup Audiocodes as an when required, you can use GUI / web portal to backup the INI file. But it becomes cumbersome task if you need to do it on daily basis. In such cases, you can make use of automation and get your backup completed automatically.
Here is the python script to backup Audiocodes SBC INI file.
import requests from requests.auth import HTTPBasicAuth from datetime import datetime import pytz ##IGNORE SSL WARNING### from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) ####################### ###GETTING TIME IN IST FORMAT#### IST = pytz.timezone('Asia/Kolkata') datetime_ist = datetime.now(IST) current_datetime = datetime_ist.strftime('%d%m%Y_%H%M') ####################### ##AUDIOCODES SBC IP ADDRESS## url = "192.168.1.181" ####################### ###MAKING GET REQUEST### response = requests.get('https://' +url+ '/api/v1/files/ini', auth = HTTPBasicAuth('backup', 'backup'), verify=False) if response.status_code == 200: with open(url + "_" + current_datetime + "_backup.ini", "w") as f: f.write(response.text) f.close() print("Successfully backed up the INI file") else: print("Backup has been failed with an error status of",response.status_code) print("Error Description is: ", response.text) #######################
All you need to do now is run the python using using task scheduler / cron task so that it will be triggered on daily/weekly basis and get your job done.
You can also watch the YouTube video for more explanation on the Python script.
I am working in an IT company and having 10+ years of experience into Cisco IP Telephony and Contact Center. I have worked on products like CUCM, CUC, UCCX, CME/CUE, IM&P, Voice Gateways, VG224, Gatekeepers, Attendant Console, Expressway, Mediasense, Asterisk, Microsoft Teams, Zoom etc. I am not an expert but i keep exploring whenever and wherever i can and share whatever i know. You can visit my LinkedIn profile by clicking on the icon below.
“Everyone you will ever meet knows something you don’t.” ― Bill Nye