A Python script to automate assignment of preference to voice dial peers based on the calling rate of a specific destination for each SIP Trunk provider in an enterprise and therefore achieving least cost routing.
Reduce cost of calling charges by routing to use the dial peer that has the fairest charges.
- Python 3.9
- Paramiko
- http.client
To get a local copy up and running follow these simple steps.
Install the following libraries pip
pip install pip --upgrade --user
-
Clone the repo
git clone https://github.com/finsysadmin/Cisco-CUBE.git
-
Edit Database credentials accordingly to connect to your DB on
func
dbconnect
-
Install paramiko
pip install paramiko
- install pydoc
pip install pydoc
6.install http client library
pip install http.client
- Run the program
main
Automating dial peer preferences assignment. Lower rates of calling incured as the dial peer will be configured to use the prefernces with the least cost.
def dbconnect(self, server=None):
server = "10.244.0.5"
database = "DevNet"
tcon = "yes"
uname = "sa"
pword = "K0Junga#"
conn = pyodbc.connect(driver='{SQL Server Native Client 11.0}', host=server, database=database,
user=uname, password=pword)
self.connection = conn
def write_config(self):
preference = 0
for dial_peer in self.preferences:
# Create dial peer
peer = str(1) + str(dial_peer.AREA) + str(dial_peer.SPCODE) + str(dial_peer.GW)
# write dial peer and preference
self.connection.send("dial-peer voice " + peer + " voip\n") # dial-peer voice 1 254 3 voip
self.connection.send("preference " + str(preference) + "\n") # preference 0
preference = preference + 1
time.sleep(1)
router_output = self.connection.recv(65535)
# Test for reading command output
print(str(router_output) + "\n")
For more examples, please refer to the Documentation
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Project Link: https://github.com/finsysadmin/Cisco-CUBE