01-10-2024 12:23 AM
Hi dev team,
On CUCM running on version 14.0.1.13900-155, I would like, via API, to modify the "Credentials source for voicemail service" parameter in the Service Profile from "not set" to "Unified CM - IM and Presense".
According to the AXL documentation AxlSoap_addServiceProfile , this is done at the serviceProfileXml parameter level.
When I do a “get” on an existing service profile, there are parameters but they are encoded.
Is there any documentation regarding possible values?
Solved! Go to Solution.
01-11-2024 12:47 AM
Hi @Elliot Dierksen ,
Thank you for your reply.
With your tips to parse XML elements in Service Profile, I successfully make modifications on service profile using the following Python code:
print("*** Update service profiles ***")
SpVendorXml001 = '<items><VoicemailServiceCredentialsSource>2</VoicemailServiceCredentialsSource></items>'
SpVendorXml002 = '<items><UseUDS>true</UseUDS><UseUserCredential>false</UseUserCredential><RecursiveSearch1>true</RecursiveSearch1><SearchTimeout>5</SearchTimeout><AllowJabberUserstoSearchandAddSecurityGroups>false</AllowJabberUserstoSearchandAddSecurityGroups></items>'
spXmlOptions001 = ET.fromstring(SpVendorXml001)
spXmlOptions002 = ET.fromstring(SpVendorXml002)
spVendorXmlArray001 = []
spVendorXmlArray002 = []
for i in spXmlOptions001:
spVendorXmlArray001.append(i)
ucm.update_service_profile(name='SP_Collab1k_All', serviceProfileInfos={ 'serviceProfileInfo': [ { 'profileName': 'Voicemail Profile', 'serviceProfileXml': { '_value_1': spVendorXmlArray001 }}]})
time.sleep(timer01)
for j in spXmlOptions002:
spVendorXmlArray002.append(j)
ucm.update_service_profile(name='SP_Collab1k_All', serviceProfileInfos={ 'serviceProfileInfo': [ { 'profileName': 'Directory Profile', 'serviceProfileXml': { '_value_1': spVendorXmlArray002 }}]})
time.sleep(timer02)
01-10-2024 11:11 PM
That means _value_1 is an array. I might not be using the exact correct python data type description, but that is why it dumps the data that way. Here is a similar thing I did to parse the vendor XML for a phone. I think this depends on the lxml library which I import.
from lxml import etree
loc = 0
for elem in vendorxml:
if elem.tag == 'spanToPCPort':
if Debug:
print('Found spanToPCPort',elem.text,'at loc',loc)
vendorxml[loc].text = '1'
break
loc += 1
01-11-2024 12:47 AM
Hi @Elliot Dierksen ,
Thank you for your reply.
With your tips to parse XML elements in Service Profile, I successfully make modifications on service profile using the following Python code:
print("*** Update service profiles ***")
SpVendorXml001 = '<items><VoicemailServiceCredentialsSource>2</VoicemailServiceCredentialsSource></items>'
SpVendorXml002 = '<items><UseUDS>true</UseUDS><UseUserCredential>false</UseUserCredential><RecursiveSearch1>true</RecursiveSearch1><SearchTimeout>5</SearchTimeout><AllowJabberUserstoSearchandAddSecurityGroups>false</AllowJabberUserstoSearchandAddSecurityGroups></items>'
spXmlOptions001 = ET.fromstring(SpVendorXml001)
spXmlOptions002 = ET.fromstring(SpVendorXml002)
spVendorXmlArray001 = []
spVendorXmlArray002 = []
for i in spXmlOptions001:
spVendorXmlArray001.append(i)
ucm.update_service_profile(name='SP_Collab1k_All', serviceProfileInfos={ 'serviceProfileInfo': [ { 'profileName': 'Voicemail Profile', 'serviceProfileXml': { '_value_1': spVendorXmlArray001 }}]})
time.sleep(timer01)
for j in spXmlOptions002:
spVendorXmlArray002.append(j)
ucm.update_service_profile(name='SP_Collab1k_All', serviceProfileInfos={ 'serviceProfileInfo': [ { 'profileName': 'Directory Profile', 'serviceProfileXml': { '_value_1': spVendorXmlArray002 }}]})
time.sleep(timer02)
01-11-2024 05:21 AM
Glad to hear you got it working. I would encourage you to look more at the etree (ET as you have it imported) libraries. You can use it to build items and then put the XML tree together. It is (IMHO) much easier and less error prone than trying to build the XML from text manually.
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