PIN Reset via Service key failing...

Version 1
    This document was generated from CDN thread

    Created by: James Riddle on 17-01-2012 04:54:52 PM
    Hi Guys,
     
    Currently ran into a problem with our Unity PIN reset which we use via the services key resulting in "Voicemail not enabled for user" where in actual fact it is provisioned...
     
    Debug traces indicte that due to the unity users being over 2000, that it wont find any users at all. Have reduced users under 2000 and worked fine.
     
    "
    07:46:24.265 |12660,,,VMREST,3,DEBUG
    [http-8443-8] com.cisco.connection.rest.helper.Utilities  - query returns more
    than the maximum allowable results, use rowsperpage query parameter to limit
    results: max=2000"
     
    So the question is, how can this be altered to query for more then 2000 users???
     
    Any help much appreciated!
     
    Cheers!

    Subject: RE: PIN Reset via Service key failing...
    Replied by: David Staudt on 20-01-2012 06:15:44 PM
    Can you specify what CUPI request your app is making?  Can't tell if your request is generating >2000 records or whether it's possibly something within the API...
     
    If it's your request, then there is no way to force the API to return >2000 records and you will need to narrow your query to return fewer results.

    Subject: RE: PIN Reset via Service key failing...
    Replied by: James Riddle on 30-01-2012 04:03:51 PM
    Request looks something like this....

    <%@ Language=JavaScript %>
    <!--#include virtual="/cmservices/include/axl85.asp"-->
    <%
    Response.ContentType = "text/xml";
    var device =  Request.QueryString("device");
    var action = String(Request.QueryString("action").Item);
    var user = String(Request.QueryString("user").Item);
    var firstname,lastname,mailid;
    var user_uuid;

    function findUser()
    {
      var node;
      var reqString = "https://xxx.xxx.xxx.xxx:8443/vmrest/users"
      var  xhttp = Server.createobject("Msxml2.serverXMLHTTP.4.0")
      var xmlDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");

      xhttp.open("GET", reqString, false);
      xhttp.setRequestHeader("Authorization", "Basic cnBjX3VzZXI6PD5NMG4kb29uPD4=");
      xhttp.setOption(2, 13056); 
      xhttp.send("");

      xmlDoc.loadXML(xhttp.responseText);
      xmlDoc.setProperty("SelectionLanguage", "XPath");

      node = xmlDoc.selectSingleNode("//Users/User[Alias=\""+user+"\"]/ObjectId");

      if(node!=null)
      {
        user_uuid = node.text;
        return 1;
      }
      else
      {
        user_uuid ="";
        return 0;
      }
    }



    function resetvoicemailPassword(pin)
    {
      var reqString = "https://xxx.xxx.xxx.xxx:8443/vmrest/users/" + user_uuid + "/credential/pin"

      var  xhttp4 = Server.createobject("Msxml2.serverXMLHTTP.4.0")
      xhttp4.open ("PUT", reqString, false);
      xhttp4.setRequestHeader("Authorization", "Basic cnBjX3VzZXI6PD5NMG4kb29uPD4=");
      xhttp4.setRequestHeader("Content-Type", "application/xml");

      var payload = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
      payload = payload + "<Credential><Credentials>" + pin + "</Credentials></Credential>"

      xhttp4.setOption(2, 13056); 
      xhttp4.send (payload);

      xhttp4.close;
    }



    var device = String(Request.QueryString("device").Item);

    var i,j,sLabel,sNum;
    var l_node,n_node;

    var xmlDoc = new ActiveXObject("msxml2.DOMDocument");
    xmlDoc.async = false;




      xmlDoc.loadXML(axlquery("executeSQLQuery", "<sql>select firstname,lastname,mailid,userid from enduser where userid='"+user+"'</sql>"));
      firstname = xmlDoc.selectSingleNode("//firstname");
      lastname = xmlDoc.selectSingleNode("//lastname");
      mailid = xmlDoc.selectSingleNode("//mailid");

    if (action=="1")
    {

    %>

    <CiscoIPPhoneText>
      <Title>Voicemail settings</Title>
      <Text>Reset password for <%
    Response.write(firstname.text);
    Response.write(" ");
    Response.write(lastname.text);
    %>?</Text>
       <SoftKeyItem>
        <Name>OK</Name>
        <URL>http://10.32.147.34/cmservices/voicemail/resetvoicemailpassword.asp?action=2&device=<%=device%>&amp;user=<%=user%></URL>
        <Position>1</Position>
       </SoftKeyItem>

       <SoftKeyItem>
        <Name>Cancel</Name>
        <URL>SoftKey:Exit</URL>
        <Position>2</Position>
       </SoftKeyItem>
    </CiscoIPPhoneText>

    <%
    }

    if(action==2)
    {


    var pin = Math.floor(Math.random()*100000);
    while(pin<10000)
    {
    pin = Math.floor(Math.random()*100000);
    }

    var xmlDoc = new ActiveXObject("msxml2.DOMDocument");
    xmlDoc.async = false;

    if(findUser()==1)
    {
    resetvoicemailPassword(pin);
    sendEmail(mailid.text, user,device,3,pin);
    %>

    <CiscoIPPhoneText>
      <Title>Voicemail settings</Title>
      <Text>Email sent to <%=mailid.text%> </Text>
       <SoftKeyItem>
        <Name>Close</Name>
        <URL>Key:Services</URL>
        <Position>1</Position>
       </SoftKeyItem>
    </CiscoIPPhoneText>
     
    <%
      }
      else
      {
    %>

    <CiscoIPPhoneText>
      <Title>Voicemail settings</Title>
      <Text>Voicemail not enabled for user</Text>
       <SoftKeyItem>
        <Name>Close</Name>
        <URL>Key:Services</URL>
        <Position>1</Position>
       </SoftKeyItem>
    </CiscoIPPhoneText>
     
    <%

      }
    }
    %>