10-21-2020 12:48 AM
I want to get the list of currently subscribed phone services for an IP Phone. When I try and add "services" to the returnedTags parameter, I get an error back saying that services isn't valid. Yet services is clearly shown in the AXL docs for getPhone.
My Python code is just:
resp = service.listPhone(searchCriteria={'name': 'SEP009E1EDF761D'},
returnedTags={'name': '', 'description': '', 'callingSearchSpaceName': '',
'devicePoolName': '', 'ownerUserName': '', 'services': ''})
Solved! Go to Solution.
10-21-2020 11:56 AM
The correct from is "returnedTags={"services": {"service": ""}}", i have checked, it's work as expected:
from zeep.helpers import serialize_object
param = {"name": "SEP501CB00D4314"}
resp = serialize_object(service.getPhone(**param, returnedTags={"services": {"service": ""}})["return"]["phone"], dict) for item in resp["services"]["service"]:
print(item)
{'telecasterServiceName': {'_value_1': 'Prod Custom Extension Mobility', 'uuid': '{3FF6454E-72D6-586E-8E29-F207828E5C22}'}, 'name': 'Prod Custom Extension Mobility', 'url': 'http://youwillnewergues.com/cucm/xml/custom_eem/login/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
{'telecasterServiceName': {'_value_1': 'Test Custom Extension Mobility', 'uuid': '{D1469EAE-29A5-AF23-A5EA-EC8901C987F3}'}, 'name': 'Test Custom Extension Mobility', 'url': 'http://youwillnewergues.com:8000/cucm/xml/custom_eem/login/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
{'telecasterServiceName': {'_value_1': 'Test Collabmin Service', 'uuid': '{9E4159DE-1C86-39DC-A6E2-D6B2409CA525}'}, 'name': 'Test Collabmin Service', 'url': 'http://youwillnewergues.com:8000/cucm/xml/test/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
10-21-2020 08:13 AM - edited 10-21-2020 08:37 AM
Hello on my opinion it is much easier to get the list of currently subscribed phone services for an IP Phone via SQL request, it is more flexible way:
from zeep.helpers import serialize_object from collections import OrderedDict def cucm_script_element_list_to_ordered_dict(elements): return [OrderedDict((element.tag, element.text) for element in row) for row in elements] sql = """SELECT d.name, d.description, dp.name AS DevicePool, tss.servicename FROM device as d INNER JOIN DevicePool as dp on d.fkDevicePool=dp.pkid INNER JOIN TelecasterSubscribedService as tss on tss.fkdevice=d.pkid WHERE d.name like '%{device}%' AND d.tkclass = 1 ORDER BY d.name""".format(device="Your Device Name") resp = service.executeSQLQuery(sql=sql) if resp: try: reply = cucm_script_element_list_to_ordered_dict(serialize_object(resp["return"]["rows"])) except KeyError: # single tuple response reply = cucm_script_element_list_to_ordered_dict(serialize_object(resp["return"]["row"])) except TypeError: # no SQL tuples reply = serialize_object(resp["return"]) print(reply)
by the way, the 'listPhone' does not return the Service Information, only 'getPhone' can do it. The listPhone returnedTags:
name description product model class protocol protocolSide callingSearchSpaceName devicePoolName commonDeviceConfigName commonPhoneConfigName networkLocation locationName mediaResourceListName networkHoldMohAudioSourceId userHoldMohAudioSourceId automatedAlternateRoutingCssName aarNeighborhoodName loadInformation traceFlag mlppIndicationStatus preemption useTrustedRelayPoint retryVideoCallAsAudio securityProfileName sipProfileName cgpnTransformationCssName useDevicePoolCgpnTransformCss geoLocationName geoLocationFilterName sendGeoLocation numberOfButtons phoneTemplateName primaryPhoneName ringSettingIdleBlfAudibleAlert ringSettingBusyBlfAudibleAlert userLocale networkLocale idleTimeout authenticationUrl directoryUrl idleUrl informationUrl messagesUrl proxyServerUrl servicesUrl softkeyTemplateName loginUserId defaultProfileName enableExtensionMobility currentProfileName loginTime loginDuration currentConfig singleButtonBarge joinAcrossLines builtInBridgeStatus callInfoPrivacyStatus hlogStatus ownerUserName ignorePresentationIndicators packetCaptureMode packetCaptureDuration subscribeCallingSearchSpaceName rerouteCallingSearchSpaceName allowCtiControlFlag presenceGroupName unattendedPort requireDtmfReception rfc2833Disabled certificateOperation authenticationMode keySize keyOrder ecKeySize authenticationString certificateStatus upgradeFinishTime deviceMobilityMode roamingDevicePoolName remoteDevice dndOption dndRingSetting dndStatus isActive isDualMode mobilityUserIdName phoneSuite phoneServiceDisplay isProtected mtpRequired mtpPreferedCodec dialRulesName sshUserId digestUser outboundCallRollover hotlineDevice secureInformationUrl secureDirectoryUrl secureMessageUrl secureServicesUrl secureAuthenticationUrl secureIdleUrl alwaysUsePrimeLine alwaysUsePrimeLineForVoiceMessage featureControlPolicy deviceTrustMode earlyOfferSupportForVoiceCall requireThirdPartyRegistration blockIncomingCallsWhenRoaming homeNetworkId AllowPresentationSharingUsingBfcp confidentialAccess requireOffPremiseLocation allowiXApplicableMedia enableCallRoutingToRdWhenNoneIsActive
10-21-2020 09:13 AM
@Evgeny Udaltsov wrote:In my opinion it is much easier to get the list of currently subscribed phone services for an IP Phone via SQL request
I started writing my app many years ago and heavily use the SQL interface. But as you can't update everything through the SQL interface, I thought I'd move to the AXL methods. It's going to be hard work....
10-21-2020 09:16 AM
@Evgeny Udaltsov wrote:by the way, the 'listPhone' does not return the Service Information, only 'getPhone' can do it.
Ah - that's the bit I was missing!
But when I do that call, despite the phone have a subscription, the list of services is blank?
resp = service.getPhone(name='SEP009E1EDF761D', returnedTags={'services': ''}) print(resp["return"]["phone"]["services"]) ... { 'service': [ None ] }
10-21-2020 11:56 AM
The correct from is "returnedTags={"services": {"service": ""}}", i have checked, it's work as expected:
from zeep.helpers import serialize_object
param = {"name": "SEP501CB00D4314"}
resp = serialize_object(service.getPhone(**param, returnedTags={"services": {"service": ""}})["return"]["phone"], dict) for item in resp["services"]["service"]:
print(item)
{'telecasterServiceName': {'_value_1': 'Prod Custom Extension Mobility', 'uuid': '{3FF6454E-72D6-586E-8E29-F207828E5C22}'}, 'name': 'Prod Custom Extension Mobility', 'url': 'http://youwillnewergues.com/cucm/xml/custom_eem/login/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
{'telecasterServiceName': {'_value_1': 'Test Custom Extension Mobility', 'uuid': '{D1469EAE-29A5-AF23-A5EA-EC8901C987F3}'}, 'name': 'Test Custom Extension Mobility', 'url': 'http://youwillnewergues.com:8000/cucm/xml/custom_eem/login/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
{'telecasterServiceName': {'_value_1': 'Test Collabmin Service', 'uuid': '{9E4159DE-1C86-39DC-A6E2-D6B2409CA525}'}, 'name': 'Test Collabmin Service', 'url': 'http://youwillnewergues.com:8000/cucm/xml/test/device=#DEVICENAME#', 'urlButtonIndex': 0, 'urlLabel': None, 'serviceNameAscii': None, 'phoneService': 'Standard IP Phone Service', 'phoneServiceCategory': 'XML Service', 'vendor': None, 'version': None, 'priority': 50, 'uuid': None}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide