Author Topic: A script for converting COS export file to a readable XML file  (Read 1035 times)

Offline petr.necas

  • Sr. Member
  • ****
  • Posts: 393
  • Country: cz
  • Karma: +8/-0
    • View Profile
A script for converting COS export file to a readable XML file
« on: February 23, 2017, 09:12:59 AM »
Hi all,
      I would like to share a little script that helped me a lot trying to find COS options that have been changed (I wish Mitel sameday highlights changed data on some of the forms). The script takes exported CSV file from the Class of Service Options form and converts it to a nice formatted XML file, for example:

<?xml version="1.0"?>
<mitel>
   <cos id="2" comment="Phones">
      <option id="12" name="Call Forwarding (External Destination)" value="Yes" default="No"/>
      <option id="35" name="Display ANI/DNIS/ISDN Calling/Called Number" value="Yes" default="No"/>
      <option id="34" name="Display ANI/ISDN Calling Number Only" value="Yes" default="No"/>
      <option id="36" name="Display Caller ID on multicall/keylines" value="Yes" default="No"/>
      <option id="204" name="Display Caller ID On Single Line Displays For Forwarded Calls" value="Yes" default="No"/>
      <option id="38" name="Display Dialed Digits during Outgoing Calls" value="Yes" default="No"/>
      <option id="37" name="Display DNIS/Called Number Before Digit Modification" value="Yes" default="No"/>
      <option id="97" name="Public Network Access via DPNSS" value="Yes" default="No"/>
   </cos>
   <cos id="7" comment="VM ports">
      <option id="29" name="COV/ONS/E&amp;M Voice Mail Port" value="Yes" default="No"/>
      <option id="122" name="Voice Mail Softkey" value="Yes" default="No"/>
   </cos>
   <cos id="8" comment="RAD ports">
      <option id="63" name="Hot Desk Login Accept" value="No" default="Yes"/>
      <option id="125" name="Answer Plus Delay To Message Timer" value="0" default="20"/>
      <option id="126" name="Answer Plus Expected Off-hook Timer" value="121" default="30"/>
      <option id="127" name="Answer Plus Message Length Timer" value="120" default="10"/>
      <option id="105" name="Recorded Announcement Device" value="Yes" default="No"/>
      <option id="106" name="Recorded Announcement Device - Advanced" value="Yes" default="No"/>
   </cos>
   <cos id="96" comment="TMobile">
      <option id="100" name="Public Trunk" value="Yes" default="No"/>
   </cos>
</mitel>

So how to use it?
1) Make sure you have Python 3.x installed.
2) On Class Of Service Options form export the data to a CSV file
3) Run the attached script cos2xml.py with the parameter of the exported CSV file, e.g. "c:\cos2xml.py COS_PBX_201702210901.csv"
4) Check the output file COS_PBX_201702210901.xml

I hope it will help somebody.
 


 

Sitemap 1 2 3 4 5 6 7 8 9 10