Get the selected item from Menu

Version 1
    This document was generated from CDN thread

    Created by: Mayank Sharma on 08-06-2009 08:00:24 PM
    I have created a service that displays a menu on the phone using <CiscoIPPhoneMenu> tags. I have a URL associated with each menu item. I have another Soft Key at the bottom named "Details" which is supposed to take the user to a Details page. I would like to use the item user selected from the menu on the details page. Is there a way I can get the selected item or is there any other way to accomplish this?
     
    Thanks,
    Max 

    Subject: RE: Get the selected item from Menu
    Replied by: Muhammad Sabir on 08-06-2009 09:06:11 PM
    Yes, you can achieve it using CiscoIPPhoneMenu and QuaryStringParam in the URL. Here is an example code. It will append the query string to the URL of the Soft Key (detail page link)
     
    <CiscoIPPhoneMenu>
    <Title>Select a group</Title>

    <MenuItem>
    <Name>All Phones</Name>
    <URL>QueryStringParam:groupID=All</URL>
    </MenuItem>

    <MenuItem>
    <Name>Demo</Name>
    <URL>QueryStringParam:groupID=6408</URL>
    </MenuItem>

    <SoftKeyItem>
    <Name>Page</Name>
    <URL>http://192.168.2.3:8080/phonetop</URL>
    </SoftKeyItem>

    </CiscoIPPhoneMenu>

    Subject: RE: Get the selected item from Menu
    Replied by: Mayank Sharma on 09-06-2009 02:21:35 PM
    Thanks a lot for your response.
     
    My menu item looks like this, can I somehow add QueryStringParam to it?
     
    <MenuItem>
    <Name>Item 1</Name>
    <URL>Dial:7000</URL>
    </MenuItem> 
     
     

    Subject: RE: Get the selected item from Menu
    Replied by: Muhammad Sabir on 11-06-2009 02:15:27 AM
    Can you please post the complete XML --- including MenuItems and SoftKeys, thanks

    Subject: RE: Get the selected item from Menu
    Replied by: Mayank Sharma on 11-06-2009 01:38:53 PM
    Yes, of course. Here is the XML.
     
     <CiscoIPPhoneMenu>
      Select Number Type
      <Title>LastName, FirstName</Title>
    - <MenuItem>
      <Name>LastName1, FirstName1</Name>
      <URL>Dial:xxxx</URL>
      </MenuItem>
    - <MenuItem>
      <Name>LastName2, FirstName2</Name>
      <URL>Dial:xxxx</URL>
      </MenuItem>
    - <SoftKeyItem>
     <"Position">1<"/Position">
      <Name>Dial</Name>
      <URL>SoftKey:Select</URL>
      </SoftKeyItem>
    - <SoftKeyItem>
       <"Position">2 <"/Position"> 
      <Name>Details</Name>
      <URL>http://<URL>/ContactDetails.aspx?studentID=xxxx&lastname=xxxx&firstname=xxxx</URL>
      </SoftKeyItem>
    - <SoftKeyItem>
       <"Position">3 <"/Position"> 
      <Name>Exit</Name>
      <URL>SoftKey:Exit</URL>
      </SoftKeyItem>
      </CiscoIPPhoneMenu>
     
    As you can see in this XML, a user can select the menuitem from the soft key "Dial" and the number will be dialed. There is an additional soft key "Details" which takes the user to another page with details. What I would like to do is pass the selected item's LastName and FirstName to the Details page. I am programming in C# and I have the name values stored in variables, I only need to transfer them to the Details page.
     
    Thanks,
    Max

    Subject: RE: Get the selected item from Menu
    Replied by: Miroslav Jasso on 18-07-2012 07:37:53 AM
    Hi Mayank,
      have you solved this somehow? I have same problem now and do not know how to solve this.

    Thanks,
      Miroslav Jasso

    Subject: RE: Get the selected item from Menu
    Replied by: David Staudt on 18-07-2012 11:27:09 AM
    Since you can't use the Dial: URI and the QueryStringParam: URI at the same time, you would need to do this in two steps:
     
    First display the menu, which will send a parameterized request back to either a ContactDial or ContactDetails URL depending on which softkey is pressed:
     

     <CiscoIPPhoneMenu>
      Select Number Type 
      <Title>LastName, FirstName</Title> 
    - <MenuItem>
      <Name>LastName1, FirstName1</Name> 
      <URL>QueryStringParam:studentID=12345</URL> 
      </MenuItem>
    - <MenuItem>
      <Name>LastName2, FirstName2</Name> 
      <URL>QueryStringParam:studentID=67890</URL> 
      </MenuItem>
    - <SoftKeyItem>
     <"Position">1<"/Position">
      <Name>Dial</Name> 
      <URL>http://myserver/ContactDial.aspx</URL> 
      </SoftKeyItem>
    - <SoftKeyItem>
       <"Position">2 <"/Position"> 
      <Name>Details</Name> 
      <URL>http://myserver/ContactDetails.aspx</URL> 
      </SoftKeyItem>
    - <SoftKeyItem>
       <"Position">3 <"/Position"> 
      <Name>Exit</Name> 
      <URL>SoftKey:Exit</URL> 
      </SoftKeyItem>
      </CiscoIPPhoneMenu>

     
    Then if the URL was 'ContactDial', you can send a CiscoIPPhoneExecute back with a Dial URI:
     
    <CiscoIPPhoneExecute>
    <ExecuteItem URL="Dial:1000"/>
    <ExecuteItem URL="http://myserver/NowDialingYourContact-CiscoIPPhoneText.xml"/>
    </CiscoIPPhoneExecute>

    Subject: RE: Get the selected item from Menu
    Replied by: Miroslav Jasso on 19-07-2012 02:33:41 AM
    OK, this is the solusion what I use now. However, it does not dial the contact when you pickup the handset. This behaviour is very important for my application because it is standart in default Cisco directories, etc.

    Subject: RE: Get the selected item from Menu
    Replied by: David Staudt on 19-07-2012 03:29:13 AM
    Ah, I see.  Query string params are supported in a second formulation that might help:
     

    <?xml version="1.0" encoding="UTF-8"?>
    <CiscoIPPhoneMenu>
      <Title>LastName, FirstName</Title>
      <MenuItem>
        <Name>LastName1, FirstName1</Name>
        <URL>http://myserver/ContactHandler?studentID=12345</URL>
      </MenuItem>
      <MenuItem>
        <Name>LastName2, FirstName2</Name>
        <URL>http://myserver/ContactHandler?studentID=67890</URL>
      </MenuItem>
      <SoftKeyItem>
        <Position>1</Position>
        <Name>Dial</Name>
        <URL>QueryStringParam:action=Dial</URL>
      </SoftKeyItem>
      <SoftKeyItem>
        <Position>2 </Position>
        <Name>Details</Name>
        <URL>QueryStringParam:action=Detail</URL>
      </SoftKeyItem>
      <SoftKeyItem>
        <Position>3 </Position>
        <Name>Exit</Name>
        <URL>SoftKey:Exit</URL>
      </SoftKeyItem>
    </CiscoIPPhoneMenu>


    In this case if the user highlights a menu selection and lifts the phone, the 'raw' URL, e.g. http://myserver/ContactHandler?studentID=67890 will be called.  If they highlight the selection and press the Details softkey, this URL gets requested: http://myserver/ContactHandler?studentID=67890&action=Detail.  Your web service can then return the CiscoIPhoneExecute with the Dial: URI if there is no 'action' param (or action=Dial) or the details CiscoIPPhoneText if action=Detail.

     
     

    Subject: RE: Get the selected item from Menu
    Replied by: Miroslav Jasso on 19-07-2012 05:30:01 AM
    Looks good, but does not work on 7945 and CIPC (with CUCM 8.6). I will try it on another IP phone types, tommorow. What type of phones did you test it on?

    Subject: RE: Get the selected item from Menu
    Replied by: Miroslav Jasso on 19-07-2012 02:34:36 PM
    Unfortunatelly, it does not do anything. Phone show standard dialing dialog, where user can insert the number, but no url is requested by the phone. The behaviour you described is standard SoftKey:Submit behaviour, but it looks as handset does not behave as any softkey.

    Subject: RE: Get the selected item from Menu
    Replied by: David Staudt on 19-07-2012 05:51:53 PM
    After some testing I can confirm you observation.  It looks like if you want the behaviour where lifting the phone automatically dials the selected menu item, then the menu item's <URL> has to be a Dial: URI.  If the <URL> is anything else - like a regular HTTP URL - lifting the handset does not cause the phone to automatically retrieve it.
     
    Unfortunately it looks like you can have either the auto-dial on off-hook behaviour, or the query-string-param behaviour -but not both.

    Subject: RE: Get the selected item from Menu
    Replied by: David Staudt on 19-07-2012 01:16:05 PM
    Didn't test it, just going by the expected behaviour as I understand it.  What is the behaviour that you see on your end with 7945?  Does the phone not do anything when pickup up after selecting a menu item?  If it does make a request, what URL does it send?