cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
240
Views
0
Helpful
3
Replies
Highlighted

python AXL cucm update phone with line Failed....

hi

i have phone name = 

SEP00059A3C7Acc

 

with:

line1 = 111 , line 2 = 555 , line3 = 666

 

 

when i make update phone they remove line2 and line3 and update line1

 

from zeep import Client
from zeep.cache import SqliteCache
from zeep.transports import Transport
from zeep.plugins import HistoryPlugin
from requests import Session
from requests.auth import HTTPBasicAuth

# CUCM HostName/ IP Address
host = '192.168.1.30'
# WSDL Service location download AXLToolKit from Call Manager
wsdl = 'AXLAPI.wsdl'
# UserName and Password
user = 'admin'
pwd = 'password'
location = 'https://{host}:8443/axl/'.format(host=host)
binding = "{http://www.cisco.com/AXLAPIService/}AXLAPIBinding"
session = Session()
session.verify = False
session.auth = HTTPBasicAuth(user, pwd)
transport = Transport(cache=SqliteCache(), session=session, timeout=20)
history = HistoryPlugin()
client = Client(wsdl=wsdl, transport=transport, plugins=[history])
service = client.create_service(binding, location)



def update_Phone():
try:
response = service.updatePhone(name="SEP00059A3C7Acc",
lines={"line" : {"index": 1,
"dirn": {"pattern": "111",
"routePartitionName": "A"}
}
}

)


print(response)

except Exception as e:
print(str(e))



update_Phone()

how to fix this problem..

3 REPLIES 3
Highlighted
Beginner

Re: python AXL cucm update phone with line Failed....

I ran into a similar scenario, check out this thread for a more detailed description of the problem.  It's not that you're doing anything incorrectly, but more understanding how the API functions.

 

https://community.cisco.com/t5/management/axl-update-device-profile-line-appearance/m-p/4062936#M3374 

Highlighted
Rising star

Re: python AXL cucm update phone with line Failed....

List items like lines, speed dial, blf speed dial, etc have to be ALL written back with the call otherwise they fall off.

The API rarely is actually "updating" anything but usually rather replacing.

I call getPhone first, to get the associated line appearances, then you can unpack that as either a hash or array of hashes, modify the values you want, and put the whole thing back with an update call. You're going to want to do this with most of the attributes to avoid losing them. The only one that I haven't figured out how to get past is the load information, since AXL ships out what it should be, default or otherwise, and you have no way to know if it's been set manually. If you write that one back then it will fill in the field even if it was empty before.
Highlighted
Cisco Employee

Re: python AXL cucm update phone with line Failed....

You're only defining one line, so when it updates the phone, is assumes you only want one line. You need to do the python/json equivalent of the following XML, which would define 2 lines.

 

      <lines>
        <line>
          <index>1</index>
          <dirn>
            <pattern>1001</pattern>
            <routePartitionName>Internal-PT</routePartitionName>
          </dirn>
        </line>
        <line> 
<index>2</index>
<dirn>
<pattern>1002</pattern>
<routePartitionName>Internal-PT</routePartitionName>
</dirn>
</line>
</lines>
This widget could not be displayed.