Cisco Extension Mobility Bulk Login using Python Script

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.

Extension Mobility Bulk Login without PIN


Remote Bulk Login Logout Tool Cisco Extension Mobility

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.


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")

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 =

    if'<CiscoIPPhoneExecute>.*</CiscoIPPhoneExecute>', response.text, re.DOTALL):
        response = "Success\n"


        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")



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *