<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SSL error when using Python/Zeep to retrieve registered phone from in Management</title>
    <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901819#M4093</link>
    <description>&lt;P&gt;This is likely due to a quirk of the RISService70.wsdl, where the binding location points to 'localhost' instead of the actual CUCM host:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dstaudt_0-1691515751786.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/193776iD0B4BDAD70A628A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dstaudt_0-1691515751786.png" alt="dstaudt_0-1691515751786.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In general, you will want to cache the WSDL server side and set the location dynamically at run-time, e.g.:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Create the Zeep service binding to the Perfmon SOAP service at the specified CUCM
service = client.create_service(
    '{http://schemas.cisco.com/ast/soap}RisBinding',
    f'https://{ os.getenv( "CUCM_ADDRESS" ) }:8443/realtimeservice2/services/RISService70' 
)&lt;/LI-CODE&gt;
&lt;P&gt;From a collection of serviceability API examples here: &lt;A href="https://github.com/CiscoDevNet/serviceability-python-zeep-samples" target="_blank"&gt;https://github.com/CiscoDevNet/serviceability-python-zeep-samples&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2023 17:31:36 GMT</pubDate>
    <dc:creator>dstaudt</dc:creator>
    <dc:date>2023-08-08T17:31:36Z</dc:date>
    <item>
      <title>SSL error when using Python/Zeep to retrieve registered phone from CM</title>
      <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901153#M4089</link>
      <description>&lt;P&gt;I try to get the registered phone information from CUCM(ver10.5 and 11.5), copied code from this thread&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.cisco.com/t5/management/python-script-for-display-registered-phones-from-cucm-ver-11-5/td-p/3877283" target="_blank"&gt;https://community.cisco.com/t5/management/python-script-for-display-registered-phones-from-cucm-ver-11-5/td-p/3877283&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;from zeep import Client&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from zeep.cache import SqliteCache&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from zeep.transports import Transport&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from zeep.plugins import HistoryPlugin&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from requests import Session&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from requests.auth import HTTPBasicAuth&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from lxml import etree&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import urllib3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from urllib3 import disable_warnings&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from urllib3.exceptions import InsecureRequestWarning&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;username = 'xxxx'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;password = 'xxxx'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;wsdl = '&lt;/SPAN&gt;&lt;A href="https://x.x.x.x:8443/realtimeservice2/services/RISService70?wsdl" target="_blank" rel="noopener nofollow noreferrer"&gt;https://x.x.x.x:8443/realtimeservice2/services/RISService70?wsdl&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;session = Session()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;session.verify = False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;session.auth = HTTPBasicAuth(username, password)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;transport = Transport(cache=SqliteCache(), session=session, timeout=20)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;history = HistoryPlugin()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;client = Client(wsdl=wsdl, transport=transport, plugins=[history])&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;factory = client.type_factory('ns0')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;macs = ['*'] #'*' for all&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;item=[]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for mac in macs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;item.append(factory.SelectItem(Item=mac))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Item = factory.ArrayOfSelectItem(item)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;stateInfo = ''&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;criteria = factory.CmSelectionCriteria(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MaxReturnedDevices = 1000,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DeviceClass='Phone',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Model=255, #255 for all&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Status='Registered',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NodeName='',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SelectBy='Name',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SelectItems=Item,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Protocol='Any',&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;DownloadStatus='Any'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;result = client.service.selectCmDevice(stateInfo, criteria)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I got below error message&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;BR /&gt;File "C:\Users\user1\Desktop\deviceStatus.py", line 20, in &amp;lt;module&amp;gt;&lt;BR /&gt;client = Client(wsdl=wsdl, transport=transport, plugins=[history])&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\client.py", line 76, in __init__&lt;BR /&gt;self.wsdl = Document(wsdl, self.transport, settings=self.settings)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\wsdl.py", line 92, in __init__&lt;BR /&gt;self.load(location)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\wsdl.py", line 95, in load&lt;BR /&gt;document = self._get_xml_document(location)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\wsdl\wsdl.py", line 155, in _get_xml_document&lt;BR /&gt;return load_external(&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\loader.py", line 89, in load_external&lt;BR /&gt;content = transport.load(url)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\transports.py", line 123, in load&lt;BR /&gt;content = self._load_remote_data(url)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\zeep\transports.py", line 135, in _load_remote_data&lt;BR /&gt;response = self.session.get(url, timeout=self.load_timeout)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 602, in get&lt;BR /&gt;return self.request("GET", url, **kwargs)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 589, in request&lt;BR /&gt;resp = self.send(prep, **send_kwargs)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 703, in send&lt;BR /&gt;r = adapter.send(request, **kwargs)&lt;BR /&gt;File "C:\Users\user1\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 517, in send&lt;BR /&gt;raise SSLError(e, request=request)&lt;BR /&gt;requests.exceptions.SSLError: HTTPSConnectionPool(host='10.10.10.150', port=8443): Max retries exceeded with url: /realtimeservice2/services/RISService70?wsdl (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_ILLEGAL_PARAMETER] sslv3 alert illegal parameter (_ssl.c:1002)')))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It looks like the CM does not like the parameters provided by the script, but I could not find any useful information about how to correct it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 05:22:56 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901153#M4089</guid>
      <dc:creator>cxu21</dc:creator>
      <dc:date>2023-08-08T05:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: SSL error when using Python/Zeep to retrieve registered phone from</title>
      <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901819#M4093</link>
      <description>&lt;P&gt;This is likely due to a quirk of the RISService70.wsdl, where the binding location points to 'localhost' instead of the actual CUCM host:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dstaudt_0-1691515751786.png" style="width: 400px;"&gt;&lt;img src="https://community.cisco.com/t5/image/serverpage/image-id/193776iD0B4BDAD70A628A5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dstaudt_0-1691515751786.png" alt="dstaudt_0-1691515751786.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In general, you will want to cache the WSDL server side and set the location dynamically at run-time, e.g.:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# Create the Zeep service binding to the Perfmon SOAP service at the specified CUCM
service = client.create_service(
    '{http://schemas.cisco.com/ast/soap}RisBinding',
    f'https://{ os.getenv( "CUCM_ADDRESS" ) }:8443/realtimeservice2/services/RISService70' 
)&lt;/LI-CODE&gt;
&lt;P&gt;From a collection of serviceability API examples here: &lt;A href="https://github.com/CiscoDevNet/serviceability-python-zeep-samples" target="_blank"&gt;https://github.com/CiscoDevNet/serviceability-python-zeep-samples&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2023 17:31:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901819#M4093</guid>
      <dc:creator>dstaudt</dc:creator>
      <dc:date>2023-08-08T17:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: SSL error when using Python/Zeep to retrieve registered phone from</title>
      <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901956#M4099</link>
      <description>&lt;P&gt;Hi Dstaudt,&lt;/P&gt;
&lt;P&gt;Thank you for your reply, I acutrally tested your code as well, but got the same error.&lt;/P&gt;
&lt;P&gt;From my understanding, I can just use your code by change the WSDL file path in python code and add the login credentials and CUCM address as environment variables. I run the code on Windows 10, the WSDL file path is set as this. "WSDL_FILE = "file///c:\users\userid\Desktop\RISService70.wsdl".&lt;/P&gt;
&lt;P&gt;The connection to the CUCM is via a jumpbox, at the beginning, I thought it may be related to firewall configuration, but my colleague did connect to it and get the data using SOAP instead of python, I assume that means firewall settings is the root cause.&lt;/P&gt;
&lt;P&gt;Is there anything you can think that cause the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 01:08:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4901956#M4099</guid>
      <dc:creator>cxu21</dc:creator>
      <dc:date>2023-08-09T01:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: SSL error when using Python/Zeep to retrieve registered phone from</title>
      <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4902502#M4100</link>
      <description>&lt;P&gt;My next thought would be some kind of HTTPS SSL/TLS connection incompatibility between CUCM and your client.&amp;nbsp; &lt;A href="https://www.cisco.com/c/en/us/products/collateral/unified-communications/unified-communications-manager-callmanager/eos-eol-notice-c51-744533.html" target="_self"&gt;11.5&lt;/A&gt; is quite old - out of software support and nearing out of all support - and &lt;A href="https://www.cisco.com/c/en/us/products/collateral/unified-communications/unified-communications-manager-callmanager/eos-eol-notice-c51-741767.html" target="_blank"&gt;10.5&lt;/A&gt; is long obsolete.&amp;nbsp; Assuming you're using a fully modern/updated OS/Python, which is going to default to/require modern TLS versions/ciphers, then the older set implemented by these old CUCM versions may not meet your client's requirements.&amp;nbsp; Such an issue can probably be confirmed by obtaining a low-level packet capture of the HTTPS/SSL handshake between your client and the CUCM, and looking at the offered TLS versions/ciphers/etc. offered on either side - this will require some knowledge of SSL handshake sequences.&lt;/P&gt;
&lt;P&gt;You may be able to force your client to use an older TLS version in order to connect (e.g. 1.1/1/2).&amp;nbsp; Also, if the CUCM's don't have the latest (available) updates, installing those might help, as security updates usually drive the very last few patches in these software trains.&amp;nbsp; Upgrading to a recent CUCM version (still under software support, e.g. 12.5/14) would likely be the primary recommendation.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 17:52:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4902502#M4100</guid>
      <dc:creator>dstaudt</dc:creator>
      <dc:date>2023-08-09T17:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: SSL error when using Python/Zeep to retrieve registered phone from</title>
      <link>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4906779#M4101</link>
      <description>&lt;P&gt;After test against CUCM12.5 and 14 from Sandbox, the same python code worked without any issue. It should be the compatibility issue between old CUCM and modern python.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 02:27:44 GMT</pubDate>
      <guid>https://community.cisco.com/t5/management/ssl-error-when-using-python-zeep-to-retrieve-registered-phone/m-p/4906779#M4101</guid>
      <dc:creator>cxu21</dc:creator>
      <dc:date>2023-08-17T02:27:44Z</dc:date>
    </item>
  </channel>
</rss>

