cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
485
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11

Subject: RE: Displaying List of Parked Calls?
Replied by: Joseph Moskie on 15-02-2012 06:22:21 PM
JTAPI comes with several sample applciations when you install it on a machine.
 
Under the installation base folder (typically C:\Program Files\JTAPI Tools\ on a Windows machine), there are two folders that contain sample apps: makecall and jtrace.
 
JTrace observes a number of Address objects that are specified at the command line, and prints out events for them until you close the application.
 
Makecall does what the name would imply, and makes a basic call from one Address to another.
 
 
These are the very basic examples that can be built upon to write the sort of application you want. I would recommend looking at the JTrace application and seeing how the application gets a list of available addresses, how it adds observers to them, how the observers work and fire events, etc.
 
 
For your specific application, the most direct approach is to just get a list of Call objects from the provider and iterate through them, checking the status to see if they are parked. From there you can use the call info on the object and handle it however you want (cache it in a web service, throw it into a database, whatever).

Subject: RE: Displaying List of Parked Calls?
Replied by: Stefania Oliviero on 16-02-2012 03:34:50 AM
I have an application that monitors calls on specific terminals and addresses. I'm also interested in this feature (monitor parked calls).
I found that if a call is an external incoming call, and if it is parked, you can't retrieve it from the provider (provider.getCalls()).
The only method I found with JTapi is to monitor CiscoProvCallParkEv provider events and callEvents to the observer object and store the parked calls in a cache.


Stefania.
This document was generated from CDN thread

Created by: James Wagner on 15-02-2012 05:54:05 PM
First off, I'm going to admit that I've never done TAPI/JTAPI before, though I am proficient in a variety of languages.
 
That being said, I need to write something that will connect to our CUCM 8.5.1 server and display all the calls currently parked with some basic information about each (park extension, caller ID, extension who parked them, etc) and keep it updated.  It can be done either on a unix server I have in place already (my thought was that building a web page with an auto-refresh of 1 second to keep information up-to-date would work) or on the windoze PCs as a standalone application.  Server-based would probably be easier than trying to write something for windoze.  I'm much better coding in unix (perl rocks IMO for quick & easy development and is my present language of choice) and the PCs are a mix of 2000, XP, and 7.
 
I've been searching the internet and have determined that TAPI/JTAPI is the animal that I need to use in order to monitor when calls get parked/picked up.  Originally, I was hoping to do this via SOAP/XML/SQL, but found that that is not possible.  However, I've been unable to find even a basic example of a program using TAPI/JTAPI and most of the documentation seems to assume a base level of knowledge which I do not currently possess.
 
Does anybody know of any examples, any programs written to do such a task, or have any advice of where to start?

Subject: RE: Displaying List of Parked Calls?
Replied by: James Wagner on 16-02-2012 04:05:37 PM
Thank you both for your input.

What you mentioned Joseph illustrates what I was referring to earlier about everything assuming a base level of knowledge that I don't have.  I was under the impression that JTAPI was either part of Java or accessed over the network like AXL APIs.  Didn't know one had to download/install it separately.  I got it from the server and unfortunately, there's no unix version, so it looks like I'm going to have to code up something for windoze.

The makecall program kinda works - it makes a connection between the two phones, but drops and reconnects immediately when one or the other phones are picked up.  Don't know what's wrong with it, but really don't care all that much either as the operations I'm interested in aren't going to make any calls.  Haven't been able to get jtrace to run no matter what I do... can't find class is the result, even though the .class file is in the directory I'm running it from.

Stefania, would you mind sharing the source code for the application you have?  While not exactly what I'm intending, it sounds close enough to eliminate a considerable duplication of effort to get the base working.  When (if) I get a functional application to do what's described above, I'll of course send a copy to you.

Subject: RE: Displaying List of Parked Calls?
Replied by: Joseph Moskie on 16-02-2012 04:13:03 PM
What you mentioned Joseph illustrates what I was referring to earlier about everything assuming a base level of knowledge that I don't have.  I was under the impression that JTAPI was either part of Java or accessed over the network like AXL APIs.  Didn't know one had to download/install it separately.

 
JTAPI is a spec for a Java library put out by Sun/Oracle. Cisco JTAPI is an implementation of this library with Cisco-specific enhancements that allows developers to write Java applications to monitor and control devices and calls.
 
There is an overview here: http://developer.cisco.com/web/jtapi/overview
 
And a getting started guide here: http://developer.cisco.com/web/jtapi/start
 
The getting started guide has links to the developer's guide, and the JTAPI Interface Specification.
 
I got it from the server and unfortunately, there's no unix version, so it looks like I'm going to have to code up something for windoze.

 
JTAPI is a Java library and as such easily runs on linux/unix. There are two downloads available from the "Plugin" page of the CUCM Admin panel: "Cisco JTAPI 64-bit Client for Linux" and "Cisco JTAPI 32-bit Client for Linux", which are full installation scripts, just like the Windows variants.
 
 
That said, all your application needs is the jtapi.jar file in it's classpath. After that, it's just a Java application that can invoke any of our APIs and can be run anywhere.

Subject: RE: Displaying List of Parked Calls?
Replied by: Stefania Oliviero on 17-02-2012 08:20:27 AM
Stefania, would you mind sharing the source code for the application you have? While not exactly what I'm intending, it sounds close enough to eliminate a considerable duplication of effort to get the base working. When (if) I get a functional application to do what's described above, I'll of course send a copy to you.

My applicatione is very comepls, so it's difficult to share source code. By the way what I do is to intercept in my CallObserver the
TermConnDroppedEv event and check the CiscoFeatureReason.REASON_PARK so I'm able to understand the call it is parked.
 
In the provider Observer I intercept the CiscoProvCallParkEv event so I'm able to understand when the call is unparked or dropped from the remote endpoint.
Example:


<font size="2" color="#7f0055"><font size="2" color="#7f0055">
case
</font></font>
<font size="2" color="#7f0055">
 
</font>
CiscoProvCallParkEv.ID:<font size="2">
 
</font>
final CiscoProvCallParkEv ev = (CiscoProvCallParkEv) event;
 



 



 





 



 




<font size="2">
 
</font>
 
if (ev.getReason() == CiscoProvCallParkEv.REASON_CALLPARK
)<font size="2">
 
</font>
 
if (ev.getState() == CiscoProvCallParkEv.PARK_STATE_ACTIVE
) {<font size="2">
 
</font>
 
// Parked call
<font size="2">
 
</font>
 
LOG.debug(String.format("Call Parked, ParkDN: %s, ParkedParty: %s, ParkingParty: %s"
, ev.getParkDN(),
ev.getParkedParty(), ev.getParkingParty()));
<font size="2">
 
</font>
 

}
<font size="2">
}
</font>
 
else if (ev.getState() == CiscoProvCallParkEv.PARK_STATE_IDLE
) {<font size="2">
 
</font>
 
LOG.debug(String.format("Parked Event with State Idle ParkDN: %s, ParkedParty: %s, ParkingParty: %s"
,
ev.getParkDN(), ev.getParkedParty(), ev.getParkingParty()));
<font size="2">
 
</font>
 
<font size="2">
 
</font>
 
// Remote hangup
}
<font size="2">
 
</font>
 
if (ev.getReason() == CiscoProvCallParkEv.REASON_CALLUNPARK
)<font size="2">
 
</font>
 
// Unparked call
<font size="2">
 
</font>
 
LOG.debug(String.format("Call UnParked, ParkDN: %s, ParkedParty: %s, ParkingParty: %s"
, ev.getParkDN(),
ev.getParkedParty(), ev.getParkingParty()));
<font size="2">
 
</font>
 
break
;

 



 

Subject: RE: Displaying List of Parked Calls?
Replied by: James Wagner on 23-02-2012 04:00:16 PM
I've been working on this since my last post and have discovered something.

I freakin *H-A-T-E* working in Java!!!  I've never seen a language that has so much that you're just supposed to know.  The code looks aesthetically similar to C++, but that's about where it ends.  This is not the first time I've learned a language while writing a needed program and have to say that it's the worst.  Even including every language I've learned (well over a dozen), about the only ones I can say are more user-unfriendly are LISP (Lots of Irritating Single Parentheses ;) ) and RPG (column 4 is this which means column 5 is that unless column 2 contains...), both of which are hampered by clumsy structure more than anything else.  Even assembler makes sense and isn't too bad once one gets used to it.  Of course I can't say for certain without more experience, but right now I don't see where I'll ever feel comfortable without having gobs of reference material open in a web browser while writing Java.


OK, now that I'm done pissing & moaning about the language, I have made significant (at least to me) progress.  Right now, I have a console application that runs, connects to the CUCM, logs in, registers to receive notifications of parked call events, and receives those events (as evidenced by the logs generated).  However, I've thus far been unable to get a function in my application to be notified of those events.  Much to my surprise, existing parked calls show up when the app starts, so I don't have to explicitly look for parked calls on startup; they're automagically sent by the CUCM.

Most likely related is that when I hit control-c to break out of the program, the dispose() method of the class is not run.  (Currently, control-C is the only way to exit the program.  It will eventually have a nice GUI built on top of it with a close button so control-C will not be needed, but I want to get the actual work done before adding the pretty fluff.)  So far, I've gone on the assumption that breaking out a program with control-C will prevent the dispose() function from running, but this is just that - an assumption.  I figure that once the GUI is done and if it's not working right, I'll worry about fixing it then; it's a similar enough item though that I didn't want to not mention it in this post.

I'd wager that both of these issues are caused by the same underlying problem.  Namely, I don't know how one is supposed to register functions to be run when events are generated.  I've seen much code online where people just create a function with a specific name and it's automatically called when the event is triggered.  I've seen others that use a registerListener() function to run their function when the event happens.  Neither has worked so far, unless I've not hit upon the right function name (assuming that's what's needed).  Once this is done, I can write the rather simple event handler and start implementing the GUI I have in mind.

Any ideas/advice/thoughts/suggestions would be appreciated.

Subject: RE: Displaying List of Parked Calls?
Replied by: James Wagner on 06-03-2012 03:36:55 PM
My application now has a nice GUI and keeps track not only of the currently parked calls, but also of history for each park line for each store, all organized in an intuitive fashion so it's easy to find what you're looking for.  (Still hate working in Java though... )  I've learned how to receive events when a call is parked, picked up, or <mostly> if a person hangs up while parked.  This is done via the code below.  However, there are a few things that I am missing which I'm hopeful somebody here will know how to solve or at least be able to point me in the right direction.

 1
 2<in my primary object, after the form creation and where it connects to the Call Manager>
 3      CucmPeer=JtapiPeerFactory.getJtapiPeer(null);
 4      CucmObserver=new CucmObs();
 5      CucmObserver.SetParentObject(this);
 6      CucmProvider=CucmPeer.getProvider("<provider connection string>");
 7      System.out.println("Provider name: " + CucmProvider.getName());
 8      CucmProvider.addObserver(CucmObserver);
 9      while(((CiscoProvider) CucmProvider).getState() != Provider.IN_SERVICE)
10        {
11        System.out.println("Waiting for connection to server to become active...");
12        try
13          {
14          Thread.sleep(1500);
15          }
16        catch(Exception e)
17          {
18          System.out.println("Exception while sleeping!\n" + e);
19          System.exit(1);
20          }
21        }
22      ((CiscoProvider) CucmProvider).registerFeature(CiscoProvFeatureID.MONITOR_CALLPARK_DN);
23
24<below the main class>
25class CucmObs implements CiscoProviderObserver
26  {
27  frmMain ParentForm;
28
29  public void SetParentObject(frmMain parent)
30    {
31    ParentForm = parent;
32    return;
33    }
34 
35  public synchronized void providerChangedEvent(ProvEv[] eventlist)
36    {
37    int counter;
38    try
39      {
40      for(counter=0; counter < eventlist.length; counter++)
41        {
42        System.out.println("provider change event - " + eventlist[counter].getID() + ", iteration " + counter);
43        if(eventlist[counter].getID() == CiscoProvCallParkEv.ID)
44          {
45          ProcessCallParkEvent(eventlist[counter]);
46//ProcessCallParkEvent is a private function in the same class; it sifts through the event and
47//eventually calls a function in ParentForm with a bunch of simple parameters to control the
48//display of calls and history for each line.
49          }
50        if(eventlist[counter].getID() == TermConnDroppedEv.ID)
51          {
52          System.out.println("caller hung up");
53          }
54        }
55      }
56    catch(Exception e)
57      {
58      System.out.println(e);
59      }
60    return;
61    }




Outstanding Issues:

1.  If I call a phone via the internal 4-digit dial, am put on park, then hang up, there's no call park event generated.  Because of this, I never know that the call has gone away and it gets 'stuck' in the display until somebody else is parked at that park extension.

2.  If I call a phone via the PSTN, am put on park, then linger there until the park times out and the call reverts back to the phone which parked me, there's no call park event generated.  Again, this leads to the parked call becoming 'stuck' in the display until somebody else is parked at that park extension.

3.  In the debug logs generated in the application directory, there is all sorts of information shown - date and time of the server when the event was generated, the text name of the person if it's an internal extension, global call ID, etc.  However, in the call park event, most of this information is not available according to the cisco API spec.  I can work around some (date/time) and others aren't strictly necessary (text name of extension), but such information would be very nice to include if possible and not too cumbersome.  Is there a method of accessing this information?


I'd appreciate any input or advice on these.

Subject: RE: Displaying List of Parked Calls?
Replied by: Jose Luis Baptista on 30-03-2012 08:57:46 AM
I'm experiencing a similar situation.

I store my parked calls in a cache, processing  the events CiscoProvCallParkEv.PARK_STATE_IDLE and CiscoProvCallParkEv.PARK_STATE_ACTIVE to remove and add to the cache.

But as James Wagner detected, there are some situations when the event CiscoProvCallParkEv.PARK_STATE_IDLE is not received. And has Stefania Oliviero stated above, provider.getCalls() doesn't retuns the parked calls.

So I would like to know if there is a way to get all the parked calls or confirm if a specific call is still parked or not.

Thanks in advance.

Subject: RE: Displaying List of Parked Calls?
Replied by: Jose Luis Baptista on 30-03-2012 11:52:01 AM
The issue I refered is happening sporadically in a client, but I haven't been able to replicate it in my lab enviroment. Also I haven't been able to identify the call flow in the client that triggers this behaviour.

All I can say is the CCM version, 7.0.2.20000-5. Don't know if this helps.

Sorry for not been able to give more information.

Subject: RE: Displaying List of Parked Calls?
Replied by: David Staudt on 30-03-2012 12:10:27 PM
If you have a CDN Developer Support contract we'd be happy to work with you to get detailed logs and analyze the issue with the customer.

Subject: RE: Displaying List of Parked Calls?
Replied by: David Staudt on 30-03-2012 11:39:33 AM
I am seeing similar issues reported by other developers, and we're looking at a potential defect. 
 
It would be great if you could help us reproduce the problem: can you provide your setup/config, the call flows, etc. that results in the missing call park Idle events?

Subject: RE: Displaying List of Parked Calls?
Replied by: Jose Luis Baptista on 02-04-2012 08:09:40 AM
Unfortunately we don't have a contract. But since we are not the ones in charge of the management of the CCM's on the customer, maybe I can get the data you asked or at least part of it. I'll get in touch with them.

When I have something new regarding this issue I'll post it.

Thanks.

Subject: RE: Displaying List of Parked Calls?
Replied by: James Wagner on 02-04-2012 08:02:34 PM
I also do not have a contract with Cisco - we bought our IPT system through a huge 3rd party who does this nationwide and I'm the customer, albeit a customer with far more technical knowledge and programming experience than most.

I should be able to get you the information you asked for, but it'll be a while before I'm able to.  There's a major project that came up and I'm in the middle of that; once complete, I plan to revisit this.  (I'd guess end of April at the earliest. )  IIRC, it was fairly reproducible - I simply made a list of all possible dispositions of a call that was parked and then tested them one by one; my app was never sent an event for some possibilities.
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