02-23-2021 02:12 PM
messing around in devnet CUCM ver 11.5 i tried adding a new phone with a DN line configured. i manage to add a regular phone without a line, but trying to add a line keeps failing on me:
import requests url = "https://x.x.x.x:8443/axl/" payload = """ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5"> <soapenv:Header/> <soapenv:Body> <ns:addDeviceProfile sequence="?"> <deviceProfile ctiid="?"> <name>SEPAAAAAAAAAACC</name> <description>test phone</description> <product>Cisco 7911</product> <class>Phone</class> <protocol>SCCP</protocol> <protocolSide>User</protocolSide> <securityProfileName uuid="?">Cisco 7911 - Standard SCCP Non-Secure Profile</securityProfileName> <lines> <line ctiid="1"> <index>1</index> <label>line1</label> <display>menash</display> <dirn uuid="?"> <pattern>1122</pattern> <routePartitionName uuid="?">?</routePartitionName> </dirn> <ringSetting>Ring</ringSetting> <consecutiveRingSetting>Use System Default</consecutiveRingSetting> <ringSettingIdlePickupAlert>Use System Default</ringSettingIdlePickupAlert> <ringSettingActivePickupAlert>Use System Default</ringSettingActivePickupAlert> <displayAscii>menash phone</displayAscii> <mwlPolicy>Use System Policy</mwlPolicy> <maxNumCalls>3</maxNumCalls> <busyTrigger>1</busyTrigger> <callInfoDisplay> <callerName>true</callerName> <callerNumber>true</callerNumber> <redirectedNumber>true</redirectedNumber> <dialedNumber>true</dialedNumber> </callInfoDisplay> <recordingFlag>Call Recording Disabled</recordingFlag> <audibleMwi>Default</audibleMwi> <partitionUsage>General</partitionUsage> <missedCallLogging>true</missedCallLogging> <recordingMediaSource>Gateway Preferred</recordingMediaSource> </line> <lineIdentifier> <directoryNumber>1122</directoryNumber> <routePartitionName>Global learned E164 Numbers</routePartitionName> </lineIdentifier> </lines> <phoneTemplateName uuid="Standard 7911">Standard 7911</phoneTemplateName> <alwaysUsePrimeLine>Default</alwaysUsePrimeLine> <alwaysUsePrimeLineForVoiceMessage>Default</alwaysUsePrimeLineForVoiceMessage> <softkeyTemplateName uuid="Standard User">Standard User</softkeyTemplateName> <callInfoPrivacyStatus>Default</callInfoPrivacyStatus> </deviceProfile> </ns:addDeviceProfile> </soapenv:Body> </soapenv:Envelope> """ headers = {} data = requests.post(url=url, headers=headers, data=payload,auth=("administrator","ciscopsdt"), verify=False) print(data.text)
this is the returned output:
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>Security Profile is required for this device</faultstring><detail><axlError><axlcode>429</axlcode><axlmessage>Security Profile is required for this device</axlmessage><request>addDeviceProfile</request></axlError></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
i cant figure out what im not doing right.
02-23-2021 02:33 PM - edited 02-23-2021 02:35 PM
Try leaving out the uuid="?" here:
<securityProfileName uuid="?">
There are other places you can omit, like the sequence="?" and uuid="?". Also, the ctiid="?" here:
<deviceProfile ctiid="?">
Basically, if there's an element pointing to a "?" then either you need to omit it, or specify what goes there. It should not point to a question mark. There are exceptions where it will ignore a ="?", but better safe than sorry.
02-23-2021 02:44 PM
hey, thanks for the response. i did what you mentioned but it still didnt work, regardless, i noticed i used the wrong action. i used <AddDeviceProfile> instead of <AddPhone>. this is the new code, and a new error comes along with it:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/11.5"> <soapenv:Header/> <soapenv:Body> <ns:addPhone> <phone> <name>SEPAAAAAAAAAACC</name> <description>test phone</description> <product>Cisco 7911</product> <class>Phone</class> <protocol>SCCP</protocol> <protocolSide>User</protocolSide> <devicePoolName>Default</devicePoolName> <securityProfileName>Cisco 7911 - Standard SCCP Non-Secure Profile</securityProfileName> <lines> <line> <index>1</index> <label>Test phone</label> <display>menash phone</display> <dirn> <pattern>1111</pattern> </dirn> <displayAscii>Menash</displayAscii> <e164Mask></e164Mask> <busyTrigger>1</busyTrigger> <callInfoDisplay> <callerName>true</callerName> <callerNumber>true</callerNumber> <redirectedNumber>false</redirectedNumber> <dialedNumber>true</dialedNumber> </callInfoDisplay> <missedCallLogging>true</missedCallLogging> </line> <lineIdentifier> <directoryNumber>1111</directoryNumber> </lineIdentifier> </lines> <phoneTemplateName>Standard 7911</phoneTemplateName> </phone> </ns:addPhone> </soapenv:Body> </soapenv:Envelope>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><faultstring>Item not valid: The specified Directory Number was not found</faultstring><detail><axlError><axlcode>5007</axlcode><axlmessage>Item not valid: The specified Directory Number was not found</axlmessage><request>addPhone</request></axlError></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
it doesnt make any sense to me. isnt the whole point of the <line> section to add a new line?
02-23-2021 02:52 PM
No, actually. addPhone does not add a line. You need to use addLine to add the line first, and then specify the line in your addPhone.
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