• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

Webservices Question

Guest
Jul 23, 2009 Jul 23, 2009

Copy link to clipboard

Copied

Hello all,

I am again working with the Angel.com  IVR outbound API (I posted here once before about this). This time I need to get the statuses of call that have been placed. They have a function called getStatus() where you simply pass in an array of call identifies, and they give you have info about them. The problem is that I cannot figure out how to access the information, because they give back an array of functions (some of which contain other functions).

They do have sample code for numerous languages. Here is the java sample, since that is closest to Cold Fusion. Here is their code that does what I want.

        ocss = oc.getStatus(ocl.getToken(), guids.toArray(new String[0]));
     
         /**
         * Print out status information of each call.
         */

     
        for(int i = 0; i < ocss.length; i++) {
            CallIDentifier cid = ocss.getCallIDentifier();

            for(int j = 0; j < ocss.getStatusItems().length; j++) {

                OutboundCallStatusItem ocsi = ocss.getStatusItems();
                System.out.println(cid.getOutboundCallGUID() + "|\t\t\t|" +
                                   cid.getPhoneNumber() + "|\t\t\t|" +
                                   ocsi.getMessage() + "|\t\t\t|" +
                                   ocsi.getStatus());
            }
        }

The line that confuses me there is

OutboundCallStatusItem ocsi = ocss.getStatusItems();


What the hell is that doing after the function call? That syntax simply does not compute for me. Either way I tried to write a similar cold fusion function

     <cffunction name="GetCallStatus" access="public" hint="Find call statuses for an array of call GUID's">
          <cfargument name="outBoundCallGUIDs" type="array" hint="An array of call GUID's" required="yes">
          <cfargument name="token" type="string" hint="Login token for the API" required="yes">
          <cfset var CallInfo = [] />    
         
          <!--- Send the call object to the webservice --->
          <cfinvoke webservice="http://www.angel.com/outbound/wsdl/OutboundCallService.wsdl" method="getStatus" returnvariable="ocss">
               <cfinvokeargument name="token" value="#arguments.Token#"/>
               <cfinvokeargument name="outboundCallGUIDs" value="#arguments.outboundCallGUIDs#"/>
          </cfinvoke>
         
<cfloop from="0" to="#arraylen(ocss.getStatusItems())#" index="j">
<cfset CallInfo["EntireReturnedObject"] = ocss>
<cfset CallInfo["CallGuid"] = cid.getOutboundCallGUID()>
<cfset Callinfo["NumberDialed"] = cid.getPhoneNumber()>
<cfset Callinfo["Object"] = cid>
<cfset Callinfo["ocsi"] = ocss.getStatusItems()>

<!---- Does not work, returns "Invalid CFML construct found on line 248 at column 96."
<cfset CallInfo["GetStatusItems"] = ocss.getStatusItems()>
---->

<!--- Does not work, returns "1 null <br>The error occurred on line 244."
<cfset CallInfo["GetStatusItems"] = ocss.getStatusItems(j)>
---->
               
<!--- Does nto work, returns "The getMesage method was not found."
<cfset Callinfo["Message"] = ocss.getStatusItems().getMesage()>
----->
</cfloop>

         
          <cfreturn CallInfo>
     </cffunction>

But the last <cfset> line in the loop fails. I have no idea how to reference the getStartTime function which is stored in the getStatusItems function.

I am totally stuck, I have tried a million variation on sytax, and I always get errors stating that the getStartTime method cannot be found, even though it does very clearly exist withing the getStatusItems().

You can see my test page here, to see the data that is getting returned.

http://portal.fpitesters.com/ivr/getCallStatus.cfm

You can see their java sample code here

http://www.socialtext.net/ivrwiki/index.cgi?java_sample_code

Here is their whole library on the API, with other sample code languages listed at the bottom of the page, as well as more information on the getStatus function.

http://www.socialtext.net/ivrwiki/index.cgi?java_sample_code

Any help is appreciated. Thank you.

(FYI when i get all this done I do plan on releasing a CFC with all these functions put together so other CF coders can use Angel.com without having to fight through all the crap I am).

TOPICS
Advanced techniques

Views

971

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jul 24, 2009 Jul 24, 2009

For the outer cfloop you have from="0". Try from="1". CF uses 1-based arrays instead of 0-based.

Votes

Translate

Translate
Explorer ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

getStatusItems() means that the getStatusItems is returning an array and then getting the element at index j. This syntax is not supported in ColdFusion (it will be in CF9).

To handle this, you would first have to assign a variable to hold the array, then use that to get the element.

<cfset CallInfo["GetStatusItems"] = ocss.getStatusItems()>

<cfset CallInfo["Message"] = CallInfo["GetStatusItems"].getMessage()>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

Thank you so much for your reply. I cannot tell you how this problem has been bother me. I did try your code, and while it seems to be much closer, it still wasn't quite right. I used the following code

          
          <cfloop from="1" to="#arraylen(ocss)#" index="i">
               <cfset cid = ocss.getCallIDentifier()>
               
               <cfloop from="0" to="#arraylen(ocss.getStatusItems())#" index="j">
                    <cfset CallInfo["CallGuid"] = cid.getOutboundCallGUID()>
                    <cfset Callinfo["NumberDialed"] = cid.getPhoneNumber()>
                    <cfset CallInfo["GetStatusItems"] = ocss.getStatusItems()>
                    <cfset CallInfo["Message"] = CallInfo["GetStatusItems"].getMessage()>

               </cfloop>

          </cfloop>

But I get the error

The element at position 0, of dimension 3, of an array object used as part of an expression, cannot be found. <br>The error occurred on line 246.

246 being the

<cfset CallInfo["Message"] = CallInfo["GetStatusItems"].getMessage()>

Line. I am sure it is something really simple at this point, just waaay to deep in the forest to see the trees anymore. Again, thank you so much for your help, I truly appreciate it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

For the outer cfloop you have from="0". Try from="1". CF uses 1-based arrays instead of 0-based.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

Haha,

I knew it was going to be something super easy. Simple things get forgotten so easily sometimes. Thank you so much. It works now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 24, 2009 Jul 24, 2009

Copy link to clipboard

Copied

LATEST

The fun never ends. Trying to find the start time and end time returns this horrible mess of other crap, apperantly everything required to build a gregorian calender or something. Check this out.

http://portal.fpitesters.com/ivr/getCallStatus.cfm

I guess I get to try and figure out how to make something that looks like a time out of that. Again any ideas are welcome, though I can certainly try to figure it out as well. Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation