Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
New Member

How to get the ANI in a service ?

Hi !

I have to develop a service which displays the name of the caller during a call

To do this, I must have the ANI but I don't know how ?!

(My service is developed in Java - Servlet - )

Perhaps there is an "option" in the call manager to setup the variable ANI in the request to the service ?

If you have an idea ... thanks you in advance !

Thierry

38 REPLIES
New Member

Re: How to get the ANI in a service ?

If you use the JTAPI interface, you can exploit the CiscoAddress (public interface CiscoAddress extends javax.telephony.Address,

CiscoObjectContainer). Within this is a method named "getAddressCallInfo(Terminal)". One of the fields returned is a field "External". This is an external address with a valid name. An address of this type is

created when ANI or callerID is available on the call.

New Member

Re: How to get the ANI in a service ?

Hi,

I have the version 1.3 of the Cisco JTAPI Implementation

but in the CiscoAddress interface, I have only these methods :

clearCallConnections()

getRegistrationState() deprecated

getState()

getType()

?

Thanks you in advance...

New Member

Re: How to get the ANI in a service ?

hi thierry!

how do i have to use the getaddresscallinfo(terminal) method? i'm able to start a call between to phones (f.e. origterm/origaddress, destterm/destaddress). i think i have to implement this method to destaddress.getaddresscallinfo(destterm)? i'm not really sure how to get along...

could you give me a tip for the right direction?

thx jochen

New Member

Re: How to get the ANI in a service ?

Ok I found a solution !

Thks

New Member

Re: How to get the ANI in a service ?

hi thierry!

i also want to use the jtapi-interface in a service for different things, but i don't know how to connect the ccm with the jtapi-interface to execute the jtapi-functions! can you give me a tip how to implement this in a service?

thanks in advance, jochen

New Member

Re: How to get the ANI in a service ?

Configure a user on the CCM (which will be your application)

Associate a device (CTI/RP)

Assign a DN to the device

Route calls to the DN that meet your requirements

That is one method, dependent upon your needs there are more, can you be specific?

New Member

Re: How to get the ANI in a service ?

One last thing I did not add, is that your application must register as the user, using the username/password that you set up. This is very important

New Member

Re: How to get the ANI in a service ?

hi jashepard,

i have a little simple sample script:

public void getProvider () {

try {

JtapiPeer peer = JtapiPeerFactory.getJtapiPeer ( null );

System.out.println ("Got peer "+peer);

Provider provider = peer.getProvider("manihss-cm1;login=mani2;passwd=mani2");

System.out.println ("Got provider "+provider);

MyProviderObserver providerObserver = new MyProviderObserver ();

provider.addObserver(providerObserver);

while (outOfService ) {

Thread.sleep(500);

}

System.out.println ("Provider is now in service");

Address[] addresses = provider.getAddresses();

System.out.println ("Found "+ addresses.length +" addresses");

for(int i=0; i< addresses.length; i++){

System.out.println(addresses[i]);

}

provider.shutdown();

} catch (Exception e){

}

}

but i always have problems with the addprovider function! i can establish a connection, get the provider object and so on, but i can't add to my provider an observer! can you give me a tip?

thx, jochen

New Member

Re: How to get the ANI in a service ?

do i have to implement a own class for myproviderobserver?

New Member

Re: How to get the ANI in a service ?

i use jtapi version 1.4 instead of 1.3! could this be a problem?

New Member

Re: How to get the ANI in a service ?

ok, i just move like a snail, but i'm still moving :-)

i do need a class myproviderobserver! is it right, that the only thing this class does, is to listen to events and handle the eventlist?

it is quite hard to find a good documentation... :-(

could anyone recommend a good book (or ebook) or something else?

thx, jochen

New Member

Re: How to get the ANI in a service ?

Hi

I am developing the code to caputre the run time status of an IP Phone. My code is almost similar to urs.

I am facing the problem to get the Xtn and the use associated with the phone.

Can you please throw some light on the same.

Thanks

-vk

New Member

Re: How to get the ANI in a service ?

Hi Guys,

Sorry for this long time ...

I found a solution for my problem ;-)

so I will give you my code (this is a prototype) :

this is my CallObserver :

import javax.telephony.*;

import javax.telephony.events.*;

import javax.telephony.callcontrol.*;

public class MyCallObserver implements CallObserver {

public void callChangedEvent(CallEv[] evlist)

{

for (int i = 0; i < evlist.length; i++)

{

if (evlist[i] instanceof ConnEv) {

String name = null;

Connection connection = null;

try

{

connection = ((ConnEv)evlist[i]).getConnection();

Address addr = connection.getAddress();

name = addr.getName();

}

catch (Exception excp)

{

// Handle Exceptions

}

String msg = "Connection to Address: " + name + " is ";

switch (evlist[i].getID())

{

case ConnAlertingEv.ID :

{

System.out.println(msg + "ALERTING");

CallEv call_event = (CallEv) evlist[i];

CallControlCall ccc = (CallControlCall) call_event.getCall();

Address ori_adresse = ccc.getCallingAddress();

System.out.println("The CALLER IS : " + ori_adresse.getName());

}

case ConnInProgressEv.ID :

{

System.out.println(msg + "INPROGRESS");

}

case ConnConnectedEv.ID :

{

System.out.println(msg + "CONNECTED");

}

case ConnDisconnectedEv.ID :

{

System.out.println(msg + "DISCONNECTED");

}

}

}

}

}

}

Now, I have to discover how to send info on the screen of the IP Phone ...

(push method)

New Member

Re: How to get the ANI in a service ?

hi thierry, it's me again :-)

i have two more questions:

1) i got the caller id, but not with the getaddresscallinfo methode, but in the callobserver i print out the "name" when the state is "CONNECTED"! that's it! but how can i get the callerid to the phone? i think, i have to use a java url-connection and push it to an .asp file which invokes a database query and pushes the db-data to the phone? is this possible?

2) when i call the ip phone from external (f.e. with my handy) the calling number is displayed on the phone! is it possible to catch the displayed number with an http-get command?

thanks for your help!

jochen

New Member

Re: How to get the ANI in a service ?

Hi,

I found that the new SDK v3.3 has this aplication called CallerInfo, but you need a callManager 3.3.

I have access to a CM 3.1.

I hope someone in this form could help me.

I always get the some error, when executing:

Initializing Jtapi

Opening JTAPI provider connection to 192.168.226.220...

com.cisco.jtapi.PlatformExceptionImpl: Unable to create provider -- null

Has anyone seen this exception,I hope someone could help seening that your all more advanced in JTAPI than me.

Thanks in advanced

Hugo

New Member

Re: How to get the ANI in a service ?

try something like this:

Provider myprovider = null;

JtapiPeer peer = null;

JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(null);

myprovider = peer.getProvider("[ip-adddress];login=[application-user];passwd=application-user-password");

MyProviderObserver providerObserver = new MyProviderObserver ();

try {

if (myprovider != null) {

System.out.println("Provider Ready\n");

while (myprovider.getState() != Provider.IN_SERVICE)

{

Thread.sleep(3000);

}

}

else {

System.out.println ("Error: Provider could not be created\n\n");

}

}

catch (Exception excp) {

System.out.println("Can't get Provider: " + excp.toString());

System.exit(0);

}

}

you also need a provider-observer!

cheers, jochen

New Member

Re: How to get the ANI in a service ?

Hi jochen

Thanks for answering me. I really need help.

I haven' tried it yet, but I have a few questions.

For the imports...

For example:

import javax.telephony.*;

import com.cisco.jtapi.extensions.*;

I'm using the a JTAPI.jar from JTAPI plug-in callManager 3.1) I installed in my computer. But found that the examples when I installed the plug-in are in Visual J++.Can I use this JTAPi.jar with Java and not J++. Will this JAR work?

The code you gave what class will it implement? Have you tried it yourself?

Something like:

public class classYouGaver implements CallObserver, ProviderObserver {

Where do I configure application-user?

Is it in the global directory in the call Manager?

In your code you don't have add a observer: provider.addObserver(this), is this necessary?

I will tell you something on Monday, If I was able to make it work.

Thanks,

Hugo

New Member

Re: How to get the ANI in a service ?

Hi Hugo,

You have to create the user in the callmanager

and give the control of yours phones to this user.

Thierry

New Member

Re: How to get the ANI in a service ?

hi hugo!

uff, a lot off question :-)

a little tip:

i also startet this way, but first you have to check if your environment is ok! cisco provides an example called makecall! search this example and test it! it is a testcall between two ip phones an check if you have installed your environment completly!

check this out! if this works fine, we'll take the next step :-)

but hurry up, i'll be in holidays soon ;-)

jochen

New Member

Re: How to get the ANI in a service ?

Hi

I'm very happy your all are helping me.

Today I wasn't able to test this properly, something came on the way, maybe only Wednesday I'll try to d something properly.

I have tested the plug-in example makeacall and works well I made a phone call from one phone 7960 to a softphone on my computer.

when are you going on holiday, In USA when do people go on holiday?

thanks

hugo

New Member

Re: How to get the ANI in a service ?

Hi,

I tried this out today

try {

JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(null);

String providerString = "192.168.226.220;login=ID;passwd=cisco";

System.out.println( "Opening " + providerString + "...\n");

myprovider= peer.getProvider(providerString);

myprovider.addObserver(this);

System.out.println ("Nome-->" + peer.getName());

System.out.println ("getServices-->" + peer.getServices());

System.out.println("Wait till Provider in service...");

conditionInService.waitTrue ();

}

catch (Exception excp) {System.out.println("Error: Can't get Provider!");

System.exit(1);}

System.out.println("Provider in service!");

System.out.println ("getState-->" + myprovider.getState());

System.out.println ("name-->" + myprovider.getName());

System.out.println ("valor on service-->" + myprovider.IN_SERVICE);

System.out.println ("valor out of service-->" + myprovider.OUT_OF_SERVICE);

System.out.println ("valor shutdown-->" + myprovider.SHUTDOWN);

it stayed on the conditionInService.waitTrue ();

so I put it in comments, on this line.

And got the getState was at 17 OUT_OF_SERVICE,

The Name„³192.168.226.220 is correct is the IP of the callManager.

thanks

Hugo

New Member

Re: How to get the ANI in a service ?

hi hugo!

i'm from germany and tomorrow is my last day bevor the holidays :-)

ok, it seems that you don't have a providerobserver?

if you have one, try this:

MyProviderObserver providerObserver = new MyProviderObserver ();

try {

if (myprovider != null) {

System.out.println("Provider Ready\n");

while (myprovider.getState() != Provider.IN_SERVICE)

{

Thread.sleep(3000);

}

}

else {

System.out.println ("Error: Provider could not be created\n\n");

}

}

catch (Exception excp) {

System.out.println("Can't get Provider: " + excp.toString());

System.exit(0);

}

hope this works!

jochen

New Member

Re: How to get the ANI in a service ?

Hi jochen,

I have discovered the problem:

The problem wasn't the code.

Since I'm using a callManager 3.1, I have to use a JDK 1.1.x, 1.2, I also tried 1.3.1 and still works.

I was using 1.4.

thanks,

Hugo

New Member

Re: How to get the ANI in a service ?

hi jrachut,

what JAR must I use, I'm using the JTAPI.jar JTAPI plug-in from the callManager ou must I use the one from SUN. But I found that I have to re-implement the classes because they are all interfaces.

thanks

Hugo

New Member

Re: How to get the ANI in a service ?

Hi Hugo,

Thanks for this info about the CallerInfo !

I had the same problem : Unable to create provider -- null

You have to install the JDK 1.3, the cisco SDK is not compatible with JDK 1.4.x

Thierry

New Member

Re: How to get the ANI in a service ?

hi,

yes hugo, nice info!

i'm not really sure if this is a prob with the sdk 1.4! i also use the 1.4 and it works! i think hugo's problem is the class path! have you made an entry?

jochen

New Member

Re: How to get the ANI in a service ?

hi

What is a class path?

I have included a JTAPI.jar.

how should I have the class path?

does it have to be c:\winnt\java\lib\JTAPI.jar?

thanks,

Hugo

New Member

Re: How to get the ANI in a service ?

Hi thierry.berwart,

You are welcome. I had download the SDK for the IP phone services in the beinging of the year only recently, actually in this form that there was a application on the new SDK 3.3 of a watermark service,. In this service it’s possible to join text with an image.

There are big differences between them there are a whole lot of services, using JSP.

I have access to a call Manager 3.1 I’m not sure if it will work with a call Manger 3.1.

In the requirements says a call Manager 3.3.

I haven’t installed TOMCAT because of the JSP.

I found a good site for this:

http://www.moreservlets.com/Using-Tomcat-4.html

I have explored well the old SDK, but this one has so many things especial with Java.

If I could understand JTAPI, I could play around.

It’s a pity that, I only have access to a call Manager 3.1.

JDK

At home I use JDK 1.3; I will have to check what JDK my school uses. That’s where I have access to the call Manager.

Thanks,

Hugo

New Member

Re: How to get the ANI in a service ?

hi hugo!

where did you found this info about the callerinfo? i can't find it!

thx jochen

491
Views
20
Helpful
38
Replies
CreatePlease to create content