- Notifications
You must be signed in to change notification settings - Fork45
Python SDK for Cisco CUCM AXL API
License
levensailor/ciscoaxl
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
pip install ciscoaxl
testing in a lab is highly recommended. if you don't have a lab of your own, you can reserve a DevNet Sandbox free of charge!
TheDevNetSandboxisaccessible throughCiscoDevNetathttp://developer.cisco.com
SelectCollaborationontherighthand category menuandthen lookforthe“Collaboration12.5”tile.Hitreserve.
To connect to the lab, you'll need to use VPN.
VPN Credentials will be sent to your DevNet registered email account, or you can view theOUTPUT from the topology page.
Once connected, you can click on the server, in this case CUCM, and selectATTRIBUTES to find username, password, and hostname / ip address.
Enable the AXL SOAP interface
Browse to the CUCM Serviceability page on https://<IP_CUCM>/ccmservice
Tools > Service Activation:
Enable the "Cisco AXL Web Service"
Step 1 - Create an AXL User Group
CUCM > User Management > User Group > Add.
Step 2 - Assign the AXL role to the group
On the top right drop down list "Related Links".
Select "Assign Role to User Group" and select "Standard AXL API Access"
Step 3 - Create a new Application User
CUCM > User Management > Application User > Add.
Add the User Group "AXL Group" to this user so that after saving the roles of the new Application User appear as in the following screen:
fromciscoaxlimportaxlcucm='10.10.20.1'username='axlaccess'password='axlpassword'version='12.5'ucm=axl(username=username,password=password,cucm=cucm,cucm_version=version)
Note: all get methods that return more than 1 item have a tagfilter property that can allow more fields to return. Fields are filtered by default to increase performance, but if you need additional fields returned from the axl call, simply add the tagfilter={} to the request. Example:
get_phones(tagfilter={"name":"","product":"","description":"","protocol":"","locationName":"","callingSearchSpaceName":"","devicePoolName":"" })
foruserinucm.get_users():print(user.firstName)
user=ucm.get_user(user_id='mscott')print(user.email)
ucm.add_user(user_id='jlevensailor',last_name='Levensailor',first_name='Jeff')
ucm.delete_user(user_id='jlevensailor')
ucm.update_user(user_id='jlevensailor',password='Lagavulin16',pin='5432')
forphoneinucm.get_phones():print(phone.name)
phone=ucm.get_phone(name='SEP001122445566')print(phone.name)
ucm.add_phone(name='SEP0023AF482340',description='Robert - 1102',product='Cisco 8861',device_pool='RTP_DP',location='RTP_LOC',phone_template='Standard 8861 SIP',protocol='SIP',css='AVST-CSS',subscribe_css='AVST-CSS',lines=[ ('1102','ABQ_PT','Robert Smith','Robert Smith','Robert Smith - 1102','+1408202XXXX') ])
ucm.delete_phone(name='SEP004433220043')
fortransinucm.get_translations():detailed=ucm.get_translation(uuid=trans.uuid)print(detailed.description)
trans=ucm.get_translation(pattern='2XXX',routePartitionName='xlates-pt')print(trans.description)
ported= ['12324625544','12324625545','12324625546']fornuminported:ucm.add_translation(pattern=num,routePartitionName='pstn_pt',calledPartyTransformationMask='1102',callingSearchSpaceName='GW_CSS')
ucm.delete_translation(pattern='34567',routePartitionName='xlates-pt')
ucm.update_translation(pattern='1234',routePartitionName='xlates-pt',newPattern='4567')
fordpinucm.get_device_pools():print(dp.name)
dp=ucm.get_device_pool(name='RTP_DP')print(dp.name)
ucm.add_device_pool(device_pool='Hollywood_DP')
ucm.delete_device_pool(device_pool='Hollywood_DP')
ucm.update_device_pool(name='RTP_DP',regionName='G711_RGN')
forcssinucm.get_calling_search_spaces():print(css.name)
css=ucm.get_calling_search_space(calling_search_space='pstn-css')print(css.name)
ucm.add_calling_search_space(calling_search_space='VIP_CSS',description='Very Important Stuff'members=['losfeliz-pt','silverlake-pt','pstn-pt'] )
ucm.update_calling_search_space(calling_search_space='VIP_CSS')
ucm.delete_calling_search_space(calling_search_space='VIP_CSS')
forptinucm.get_partitions():print(pt.name)
pt=ucm.get_partition(routePartitionName='pstn-pt')print(pt.name)
ucm.add_partition(routePartitionName='VIP_PT',description='Very Important Peep')
ucm.delete_partition(name='VIP_PT')
forreginucm.get_regions():print(reg.uuid)
reg=ucm.get_region(region='losfeliz_reg')print(reg.name)
ucm.add_region(region='Hollywood-REG')
ucm.delete_region(region='Hollywood-REG')
forlocinucm.get_locations():print(loc.name)
loc=ucm.get_location(name='Shadow')print(loc.name)
ucm.add_location(location='Hollywood-LOC')
ucm.delete_location(location='Hollywood-LOC')
fordninucm.get_directory_numbers():print(dn.uuid)
dn=ucm.get_directory_number(pattern='2888',routePartitionName='losfeliz-pt')print(dn.uuid)
ucm.add_directory_number(pattern='1102',routePartitionName='ABQ_PT' )
ucm.delete_directory_number(uuid='{0B0CDC93-EC9C-7255-1B09-40A3CE727D5A}')
forudpinucm.get_device_profiles():print(udp.name)
udp=ucm.get_device_profile(name='udp-bsimpson')print(udp.name)
ucm.add_device_profile(name='UDP_MScott',description='Michael Scott - 2901',product='Cisco 8861',phone_template='Standard 8861 SIP',protocol='SIP',lines=[ ('2901','losfeliz-pt','Michael Scott','Michael Scott','Michael Scott - 2901','+1408202XXXX'), ('2902','losfeliz-pt','Pam Beesley','Pam Beesley','Pam Beesley - 2902','+1408202XXXX') ])
ucm.delete_device_profile('UDP_Mscott')
forctiinucm.get_cti_route_points():print(cti.name)
cti=ucm.get_cti_route_point(cti_route_point='AutoAttendant')print(cti.name)
ucm.add_cti_route_point(cti_route_point='aa-pilot',description='pilot to unity',device_pool='LosFeliz_DP',css='allphone-css',lines=[ ('2908','losfeliz-pt'), ('2909','losfeliz-pt') ])
ucm.delete_cti_route_point(name='OneArch')
nums= ['19197016707','19197016712','19197016713','19197016706','191970167016']fornuminnums:forrouteinucm.list_route_plan(num):print(route.dnOrPattern)forrouteinucm.list_route_plan('2901'):print(route.uuid)
forrginucm.get_route_groups():print(rg.name)
rg=ucm.get_route_group(route_group='losfeliz-rg')print(rg.uuid)
ucm.add_route_group(route_group='hollywood-rg',distribution_algorithm='Circular',members=[('america-online-sip'), ('h323')])
ucm.delete_route_group(route_group='hollywood-rg')
forrlinucm.get_route_lists():print(rl.name)
rl=ucm.get_route_list(route_list='stdloc-rl')print(rl.description)
ucm.add_route_list(route_list='hollywood-rl',description='hollywood',run_on_all_nodes='true',cm_group_name='Default',members=[ ('losfeliz-rg'), ('silverlake-rg') ])
ucm.delete_route_list(route_list='hollywood-rl')
forrpinucm.get_route_patterns():print(rp.pattern)
rp=ucm.get_route_pattern(pattern='911')print(rp.description)
ucm.add_route_pattern(pattern='999',routePartitionName='losfeliz-pt',description='Movie Times',route_list='stdloc-rl' )
ucm.delete_route_pattern(pattern='999',routePartitionName='losfeliz-pt')
forsqlin ucm.run_sql_query('select * from device where description like "Bart%"'): print(sql.name)
forldapinucm.get_ldap_dir(): ucm.do_ldap_sync(uuid=ldap.uuid)
ucm.do_device_reset(device='SEP001100220033')
ucm.do_device_login(device='SEP001100220033',userId='bsimpson')
ucm.do_device_logout(device='SEP001100220033',userId='bsimpson')
About
Python SDK for Cisco CUCM AXL API