cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
608
Views
0
Helpful
0
Comments
cdnadmin
Level 11
Level 11
This document was generated from CDN thread

Created by: Paulo Silva on 03-05-2011 10:12:02 AM
Hello,
 
I am very new to JTAPI and was actually directed to it by somebody as a possible solution to the problem that i am faced with.
 
I need to monitor UCM for the list of active calls and, if possible, any associated information with each call: ANI, call duration, etc
 
Can somebody give me some pointers on the best way to accomplish this?
 
Thanks in advance,
 
Paulo Silva

Subject: RE: Get a list of active calls
Replied by: Abhishek Malhotra on 03-05-2011 10:31:08 AM
Provider.getCalls() would give you array of all calls in JTAPI Provider's domain.
Each of these call would be instanceof CiscoCall and you can invoke APIs available on CiscoCall to query details of calling and called parties, call id, call state, etc.... Based on the state of the call, you can filter the ones you are interested in.
 
As far as Call Duration is concerned, there is no API to retrieve this information but you can compute the call duration programatically based on the events that JTAPI sends out (basically RTP (media) start event and established event would tell you when the call is answered and when you get disconnected/Invalid event would tell you when is call torn down and you can subtract the timestamps of these events to get call duration).
Alternatively these can be picked from CDRs

Subject: RE: Get a list of active calls
Replied by: Paulo Silva on 03-05-2011 01:36:23 PM
Hi Abhishek,

Thank you very much for your quick reply!

I started tinkering around with and got this far:

try
        {           
            JtapiPeer peer = JtapiPeerFactory.getJtapiPeer ( null );
           
            System.out.println("Got peer " + peer);
           
            Provider provider = peer.getProvider("172.16.100.10;login=psilva;passwd=XXXXXXXXX");
           
            System.out.println("Got provider " + provider);
           
            provider.addObserver(this);
           
            conditionInService.waitTrue();
           
            System.out.println("Provider is now in service.");
           
            Call[] calls = provider.getCalls();
           
            if(calls != null)
            {
                System.out.println("calls is not null");
               
            }
            else
            {
                System.out.println("calls is null.");
            }           
    
            provider.shutdown();
           
            provider = null;
           
            peer = null;
           
            System.out.println("Terminated");
        }
        catch(Exception ex)
        {
            System.out.println("Exception:" + ex.getMessage());
        }

I can get a provider and what for it to be in service; however, when i call getCalls() i always get back null, despite the fact that i have an active call going.

Not sure what the problem is...help!

Thanks again,

Paulo Silva

Subject: RE: Get a list of active calls
Replied by: Abhishek Malhotra on 03-05-2011 07:08:27 PM
provider.getCalls(); would return you the list of calls which are in JTAPI Provider's domain. A call is said to be in JTAPI Provider's domain when it is on JTAPI observed Terminal/Address.
You will have to add devices (for whom you want to track these calls) to the control list of JTAPI user and then add observers on them to be able to have your code work. 
 
Regards,
Abhishek

Subject: RE: Get a list of active calls
Replied by: Paulo Silva on 04-05-2011 11:00:19 AM
Hi Abhishek,

Thank you once more for your assistance!

I followed your instructions and am now able to get a list of calls which i see increasing and decreasing as i start and terminate calls.

My ultimate goal is to be able to get call information like originator and destination for each of those active calls; for this, i looked at the Call object, but it was not obvious to me how to get that info.

Would you clear that for me, please?

Thanks,

Paulo Silva

Subject: RE: Get a list of active calls
Replied by: Abhishek Malhotra on 04-05-2011 11:29:47 AM
CiscoCall.getCallingAddress() would give you the Address object representing the caller (originator) of the call.
CiscoCall.getCalledAddress() would give you the Address object representing the called party (destination) of the call.
 
You can further invoke getName() API on these address object to get the number representing these address objects.
 
 
Please note you may also want to check getCurrentCallingAddress() and getCurrentCalledAddress() APIs as they give current caller and current called parties in the call.

Subject: RE: Get a list of active calls
Replied by: Paulo Silva on 04-05-2011 12:00:03 PM
It works like a charm!

Thank you very much for your assistance!

Paulo Silva
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