Cisco Extension Mobility Bulk Login using Python Script
We all know how much important it is for new site deployment to test the “User Acceptance Test” by logging into each IP Phones one by one and see everything is working as expected or not. In such cases, you don’t want an individual to run around desks and login to each IP Phone in order to perform UAT. In such cases, you can reduce some amount of work by doing a remote login to those IP Phones so that the IP Phones are ready to be performed UAT.
There are many tools available free/paid online to login to Cisco IP Phones remotely (Extension Mobility). I also created one tool in past using Excel which would allow you to do a bulk login and logout. The benefit of that tool is that mostly every system has Microsoft office installed and would have excel as well. You just need to enter the data (IP Address of CUCM, Mac-Address of IP Phone, Username and PIN) and run the script and it will perform it’s job. The application will also not be blocked on the network/antivirus as it is plain and simple excel file. In case if you have not used it, feel free to read about it here.
In this article, we will use Python script to login to Cisco IP Phones remotely.
Cisco Extension Mobility Bulk Login using Python Script – Video
To understand how the script works, i would recommend to watch the video and see a demonstration.
https://www.youtube.com/watch?v=k1xnAkBb69U
Cisco Extension Mobility Bulk Login using Python Script – Python Script
import requests import pandas as pd import csv import re df = pd.read_csv('data.csv') ipAddress = df['IP_Address'] deviceName = df['Device_Name'] userID = df['UserID'] pin = df['PIN'] f = open("result.csv", "w+") f.write("IP_Address, Device_Name, UserID, PIN, Status") f.write("\n") f.close() for ipAddress, deviceName, userID, pin, in zip(ipAddress, deviceName, userID, pin): result = [] url = str('http://' + str(ipAddress) + ':8080/emapp/EMAppServlet?device=' + str(deviceName) + '&userid=' + str(userID) + '&seq=' + str(pin)) response = requests.post(url) if re.search(r'<CiscoIPPhoneExecute>.*</CiscoIPPhoneExecute>', response.text, re.DOTALL): response = "Success\n" else: res = re.findall("^<Prompt>.*$", response.text, re.MULTILINE) res = res[0].replace('<Prompt>', '') response = res.replace('</Prompt>', '') result.append([ipAddress, deviceName, userID, pin, response]) for i in result: i = ", ".join('%s' %id for id in i) f = open("result.csv", "a") f.write(i) #f.write("\n") f.close()
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