cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
100
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: Brandy Totten on 28-04-2010 07:19:13 PM
Is there an easier way (aside from parsing it all out) to create an Arguments object from a string (created by a call to DumpArgs())?

Subject: RE: Creating Arguments from a string
Replied by: Brandy Totten on 30-04-2010 06:11:54 PM
I was trying to pass it from a server application back to an agent desktop application

Subject: RE: Creating Arguments from a string
Replied by: Christopher Nagel on 29-04-2010 10:56:13 PM
Brandy,
 
Can you say more about why you want to do this?  I
typically use Arguments.toString() (which is just  call to DumpArgs()
internally) when writing a log entry.  If I wanted to pass an args
object, I'd probably use util.Serialize and call
Arguments.pack(Serialize) to pack it up, then unpack(Serialize) to
reinflate later.
 
Then again, I haven't ever needed to do this so if you can suggest a scenario I'll be happy to think on a solution.
 
Chris

Subject: RE: Creating Arguments from a string
Replied by: Adva Rotstein Hayun on 03-05-2010 12:29:08 PM
Hi,
I'm also trying to convert the Arguments object.
Basically I would like to send the ECC object which is Arguments in a Java Generic format for exmaple a Map of key values. I do not see anything like this, or any conversion between Argumets and Map. Any idea?
 
Also, if I would like to go over all Argument key-value how can I do that? it seems to me I would have to know all the keys in advance to do that.
 
Would appreciate any advise.
Adva

Subject: RE: Creating Arguments from a string
Replied by: Brandy Totten on 06-05-2010 02:20:48 PM
Okay, so I have broken down and tried parsing everything out. I am having an issue with the statistics parameter.
 
I assign it with
Arguments a = new Arguments();
a.SetValue(Enum_CtiOs.CTIOS_STATISTICS, stringargs);
 
where stringargs is just the statistics portion of the arguments that looks something like:
(AvailTimeToday:5 NotReadyTimeToday:875617 AgentOutCallsToday:0 AgentOutCallsTalkTimeToday:0 AgentOutCallsHeldTimeToday:0 HandledCallsToday:0 HandledCallsTalkTimeToday:0 HandledCallsTimeToday:0 IncomingCallsHeldTimeToday:0)
 
but when I do
Arguments stats1;
            if (!a.GetValueArray(Enum_CtiOs.CTIOS_STATISTICS, out stats1))
{
 //Error : I always get here
}
 
I have tried setting each individual parameter in stats like this....
 
a.SetValue(Enum_CtiOs.CTIOS_AVAILTIMETODAY, sub[1]);
a.SetValue(Enum_CtiOs.CTIOS_STATISTICS, sub[1]);
 
or just
 
a.SetValue(Enum_CtiOs.CTIOS_AVAILTIMETODAY, sub[1]);
without the second line 
 
where sub[1] is a string containing just the value (like "5" from the example above)
 
but I get the same results
 

Subject: RE: Creating Arguments from a string
Replied by: Christopher Nagel on 10-05-2010 09:36:22 PM
I was trying to pass it from a server application back to an agent desktop application

Actually, I'm thinking of a couple different designs.  One thing I try to do is utilize the API wherever possible.

First off, I'd suggest reconsidering the design.  One reason to use the client/server architecture is to localize all the CIL traffic up at the server and you can just develop a thin communication protocol (such as "<TRANSFER DEST="5551212"/>) for commands.  Thus the requirement to send Arguments all the way down there "just goes away" (TM).

Next on my list of possible directions towards a solution, maybe subclass Arguments and just utilize the Pack()/Unpack() methods, something like this:

    // CAVEAT: This compiles, but I don't know if it really works!
    class XO extends Arguments
    {
        com.cisco.cti.ctios.util.Serialize s = new com.cisco.cti.ctios.util.Serialize(1);
       
        XO() {}
        public String send() {
            this.Pack(s);
            return s.toString();
        }
        public void receive(String s )
        {
            this.Unpack(new Serialize(s.getBytes(), s.length(), 1 ));
        }
    }

I have no idea what the "increment" argument to Serialize is for, probably just something to keep traffic in its lane.

Lastly, I'm not surprised you'd have difficulty setting statistics - I'd have assumed they'd be read-only.

Best,
Chris
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links