User Tools

Site Tools


voip:cisco7940-7960

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
voip:cisco7940-7960 [12/06/2025 12:26] – [Useful Link] andrewvoip:cisco7940-7960 [12/06/2025 15:14] (current) – [Cisco XML Services] andrew
Line 212: Line 212:
 [[https://llg.cubic.org/tools/rss2cisco.pl]] [[https://llg.cubic.org/tools/rss2cisco.pl]]
  
 +
 +Flask based code to generate XML:-
 +
 +<code python>
 +from flask import Flask, request, render_template, Response
 +
 +
 +app = Flask(__name__)
 +
 +
 +# See https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cuipph/all_models/xsi/7_0/english/programming/guide/70xsi.pdf
 +
 +@app.route('/xml')
 +def xml_response():
 +    # Define sample data to be returned as XML
 +    data0 = {
 +        'name': 'Test Service 0',
 +        'url': 'http://192.168.7.11/services0'
 +    }
 +
 +    data1 = {
 +        'name': 'Test Service 1',
 +        'url': 'http://192.168.7.11/services1'
 +    }
 +
 +    # Convert data to XML format
 +    xml_data = f"""
 +    <CiscoIPPhoneMenu>
 +        <Title>Services Menu</Title>
 +        <Prompt>Prompt text goes here</Prompt>
 +        <Text>Message Body text</Text>
 +        <MenuItem>
 +         <Name>{data0['name']}</Name>
 +         <URL>{data0['url']}</URL>
 +        </MenuItem>
 +        <MenuItem>
 +         <Name>{data1['name']}</Name>
 +         <URL>{data1['url']}</URL>
 +        </MenuItem>
 +    </CiscoIPPhoneMenu>
 +    """
 +
 +    # Create a response with the XML content type
 +    response = Response(xml_data, mimetype='application/xml')
 +    return response
 +
 +
 +@app.route('/xml-opt0')
 +def xml_opt0_response():
 +    # Define sample data to be returned as XML
 +    data0 = {
 +        'name': 'Test Service 0',
 +        'url': 'http://192.168.7.11/services0'
 +    }
 +
 +    # Convert data to XML format
 +    xml_opt0_data = f"""
 +    <CiscoIPPhoneInput>
 +    <Title>Option 0</Title>
 +    <Prompt>Option 0 Prompt text goes here</Prompt>
 +    <URL>{data0['url']}</URL>
 +    <InputItem>
 +    <DisplayName>Name of the input field to display</DisplayName>
 +    <QueryStringParam>The parameter to be added to the target URL</QueryStringParam>
 +    <DefaultValue>The default display name</DefaultValue>
 +    <InputFlags>The flag specifying the type of allowable input</InputFlags>
 +    </InputItem>
 +    </CiscoIPPhoneInput>
 +    """
 +
 +    # Create a response with the XML content type
 +    response = Response(xml_opt0_data, mimetype='application/xml')
 +    return response
 +</code>
  
  
voip/cisco7940-7960.1749731174.txt.gz · Last modified: by andrew

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki