cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
229
Views
10
Helpful
4
Replies
Highlighted
Engager

Get list of subscribed phone services via AXL

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': ''})

 
Please rate all helpful posts.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

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}

 

View solution in original post

4 REPLIES 4
Highlighted

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

 

Highlighted


@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....

Please rate all helpful posts.
Highlighted


@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
    ]
}

Please rate all helpful posts.
Highlighted

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}

 

View solution in original post