Re: Incoming Telephone Number
Jörg Wiesmann <[email protected]> Mon, 12 Jun 2006 23:18:28 +0200
| Newsgroups | gmane.comp.java.sun.jtapi |
|---|---|
| Message-ID | <[email protected]> |
Hi Pavel,
the first try looks quite good, the only thing i see is, that the call
maybe is null.
If you are saying you allready get some events, you may want to try this:
first of all, your class has to implement some other classes:
like this: public class YOURCLASS implements AddressObserver,
TerminalObserver, CallControlCallObserver
if you have done so, you have to add the observer to every "phone"
(address and terminal).
You can do it like that: (you do not need all of them, as i remember :) )
observedAddress.addCallObserver(this);
observedTerminal.addCallObserver(this);
observedAddress.addObserver(this);
observedTerminal.addObserver(this);
if you have done so, you should have the following function implemented:
public final void callChangedEvent(CallEv[] events)
there i do get the numbers like this:
//
public final void callChangedEvent(CallEv[] events) {
for (int i =3D 0; i < events.length; i++) {
Call call =3D events[i].getCall();
try {
if (call !=3D null && call instanceof CallControlCall) {
Address myCalledAddress =3D ((CallControlCall)
call).getCalledAddress();
Address myCallingAddress =3D ((CallControlCall)
call).getCallingAddress();
System.out.println (myCalledAddress.getName());
System.out.println (myCallingAddress.getName());
} else {
if (call=3D=3Dnull) System.out.println ("call is nul=
l
.. ");
} catch (Exception e) {
//someting went wrong :(
e.printStackTrace();
}
}
if it does not help you, just write down, what exactly is going wrong.
greetz J=F6rg Wiesmann
Pavel Vesely schrieb:
> Hi All,
>
> I would like to get a telephone number of incoming calls. I am able to =
make
> a call and I am getting events - it means the instalation should be OK.
>
> I am using GJTAPI with TAPI 3.0 Provider. And I have an optiPoint 500 /
> HiPath 3000 / CallBridge TU TAPI. If I use directly the TAPI with C++
> everything is fine but with JAVA I don't get the telephone number.
>
> Please, could you help me?
>
> Thanks a lot,
> Pavel
>
> I am using two ideas that I have found on this forum but no success:
>
> if (ev instanceof TermConnRingingEv) {
> // first try
> String A_number;
> String B_number;
> CallControlCall call =3D (CallControlCall)ev.getCall();
> if(call instanceof CallControlCall) {
> Address myCalledAddress =3D
> ((CallControlCall)call).getCalledAddress();
> Address myCallingAddress =3D
> ((CallControlCall)call).getCallingAddress();
> A_number=3DmyCallingAddress.getName();
> B_number=3DmyCalledAddress.getName();
> System.out.println("\n\nA=3D"+A_number+" B=3D"+B_number);
> }
>
> // second try
> TerminalConnection tc =3D ((TermConnEv)ev).getTerminalConnection();
> try {
> Call c =3D ev.getCall();
> Connection m_connections[] =3D c.getConnections();
> TerminalConnection termCons[] =3D
> m_connections[0].getTerminalConnections();
> TerminalConnection termCon =3D termCons[0];
> Terminal t =3D termCon.getTerminal();
> Address a[] =3D t.getAddresses();
> String incoming =3D a[0].getName();
> System.out.println("address is "+incoming);
> System.out.println("terminal is "+t.getName());
> System.out.println("the phone is ringing");
> } catch (Exception excp) {
> excp.printStackTrace();
> }
> }
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the =
body
> of the message "signoff JTAPI-INTEREST". For general help, send email =
to
> [email protected] and include in the body of the message "help".
>
>
>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
To unsubscribe, send email to [email protected] and include in the bo=
dy
of the message "signoff JTAPI-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".