Merge branch 'writing' into 'master'

Writing

See merge request arnold/voip-generator!1
This commit is contained in:
Arnold Dechamps 2022-12-18 02:27:49 +00:00
commit fbf2bf7157
12 changed files with 119 additions and 1 deletions

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

4
.idea/misc.xml Normal file
View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/voip-generator.iml" filepath="$PROJECT_DIR$/.idea/voip-generator.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

8
.idea/voip-generator.iml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -0,0 +1,29 @@
# 7940 - 7960 Series :
## Intro :
You will need an IPv4 Network with :
* DHCP server (tested on tagged Voice-Vlan)
* TFTP server (option 66 configured in DHCP server)
* physical access to the phone
## Factory reset sequence :
When the phone start's up, (either POE or local adapter), dial the `#` until the screen starts up.
When the screen tell's factory reset sequence, Dial `1 2 3 4 5 6 7 8 9 * 0 #` in that order. Phone will ask you if you want to save his network config.
Dial 2 (network config erase).
## Flashing process :
After factory reset, the phone will look up in the TFTP server for his own config file (`SEP<mac-address>.cnf.xml`)
In the case of flashing to SIP firmware, that file has to contain the fact that it goes to SIP and a firmware version.
All system files must be stored at the root of the TFTP server.
## SIP phone provisioning :
After the SIP firmware has been flashed, the phone will start to TFTP try `SIPDefault.cnf`.
`SIPDefault.cnf` is the file that contain's SIP options that will be used across all phones that can access that file.
(like NTP server's, time format etc.) so that the specific SIP file can be smaller (not that usefull on a modern server with 3 phones in the system. kind of a big deal on a big phone system on a small CME router)
Either `SIPDefault.cnf` gets found and the phone will load the options, either it's not and the phone jumps to the next file. `SIP<mac-address>.cnf`
That file contains the phone specific options. If some options were present in `SIPDefault.cnf`, they will be overwritten on the local phone.
## Startup Sequence :
At every reboot, the phone will look up for the ``SEP<mac-address>.cnf.xml`` to see what firmware is needed. Then `SIPDefault.cnf` and then `SIP<mac-address>.cnf`.

View file

2
Scripts/c79117906.py Normal file
View file

@ -0,0 +1,2 @@
def main():
print("not yet coded")

24
Scripts/c79407960.py Normal file
View file

@ -0,0 +1,24 @@
"""
This module creates config files for the Cisco 7940 and Cisco 7960
"""
def mac():
"""
This takes the mac address and puts it into correct format for use
:return: raw mac
"""
mac = input("Phone mac address : ")
raw_mac = "none"
if len(mac) == 12:
raw_mac = mac.upper()
elif len(mac) == 17:
raw_mac = ""
for i in mac:
if i != ":":
raw_mac = raw_mac + i.upper()
return raw_mac
def main():
mac_address = mac()
print(mac_address)

25
gen.py
View file

@ -2,9 +2,32 @@
Config Generator for VOIP Phones
Arnold Dechamps 2022
"""
from Scripts import c79407960
from Scripts import c79117906
def main():
print("hello world")
"""
This function is the main one. Makes selections to choose what plugin to use
:return: 0
"""
print("Hello, what phone system would you like to provision?")
print(" * 1) Cisco 7940")
print(" * 2) Cisco 7960")
print(" * 3) Cisco 7911")
print(" * 4) Cisco 7906")
phone_choice = input("Choice : ")
if phone_choice == "1" or phone_choice == "2":
c79407960.main()
elif phone_choice == "3" or phone_choice == "4":
c79117906.main()
else:
print("Invalid option.")
return 0
if __name__ == '__main__':
main()