Re: [JTAPI] Incoming Telephone Number

pvseznam <[email protected]> Tue, 13 Jun 2006 12:46:38 +0200
Newsgroups gmane.comp.java.sun.jtapi
Message-ID <[email protected]>
--MessagePart:196242893.0-16831-1451699322-1150191174
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
        charset="iso-8859-2"

Hi J=F6rg,<br><br>Thanks for your reply.<br><br>I have tried to add "ob=
servedAddress.addCallObserver(this);
observedTerminal.addCallObserver(this);
"<br>and "callChangedEvent" function as you suggested. But the result w=
as:<br>CalledAddress=3DCallBridge TU<br>MyCallingAddress =3D null
<br>when incoming call was coming.<br><br>Recently I added all possible=
 core package observers and listeners - I only haven't casted calls to =
(CallControlCall)
as you do. And I stoped at proper places in debugger and went though st=
ructures but I have not found the incoming number anywhere. Always the =
callingAddress and callingTerminal are null.<br><br>Thanks a lot for an=
y help and suggestion,<br>Pavel<br><br><br><br>&nbsp;<br><br><br><br>
<br>
------------ P=F9vodn=ED zpr=E1va ------------<br>
<b>Od:</b> J=F6rg Wiesmann &lt;[email protected]&gt;<br>
<b>P=F8edm=ECt:</b> Re: [JTAPI] Incoming Telephone Number<br>
<b>Datum:</b> 12.6.2006 23:17:14<br>
---------------------------------------------<br>
Hi Pavel,
<br>
<br>the first try looks quite good, the only thing i see is,
that the call
<br>maybe is null.
<br>If you are saying you allready get some
events, you may want to try this:
<br>
<br>
<br>first of all, your class
has to implement some other classes:
<br>like this: public class YOURCLASS
implements AddressObserver,
<br>TerminalObserver, CallControlCallObserver
<br>
<br>if you have done so, you have to add the observer to every "phone"
<br>(address and terminal).
<br>You can do it like that: (you do not need all of
them, as i remember :) )
<br>
<br>
observedAddress.addCallObserver(this);
<br>
observedTerminal.addCallObserver(this);
<br>
observedAddress.addObserver(this);
<br>
observedTerminal.addObserver(this);
<br>
<br>if you have done so, you should
have the following function implemented:
<br>public final void
callChangedEvent(CallEv[] events)
<br>
<br>there i do get the numbers like
this:
<br>
<br>//
<br>public final void callChangedEvent(CallEv[] events)
{
<br>        for (int i =3D 0; i &lt; events.length; i++) {
<br>
Call call =3D events[i].getCall();
<br>             try {
<br>
if (call !=3D null &amp;&amp; call instanceof CallControlCall) {
<br>
Address myCalledAddress =3D ((CallControlCall)
<br>call).getCalledAddress();
<br>                    Address myCallingAddress =3D ((CallControlCall)=

<br>call).getCallingAddress();
<br>                    System.out.println
(myCalledAddress.getName());
<br>                    System.out.println
(myCallingAddress.getName());
<br>                 } else {
<br>
        if (call=3D=3Dnull) System.out.println ("call is null
<br>.. ");
<br>
         } catch (Exception e) {
<br>                   //someting went wrong
:(
<br>                   e.printStackTrace();
<br>             }
<br>
   }
<br>
<br>if it does not help you, just write down, what exactly is
going wrong.
<br>greetz J=F6rg Wiesmann
<br>
<br>
<br>Pavel Vesely
schrieb:
<br>&gt; Hi All,
<br>&gt;
<br>&gt; I would like to get a telephone number
of incoming calls. I am able to make
<br>&gt; a call and I am getting events - it
means the instalation should be OK.
<br>&gt;
<br>&gt; I am using GJTAPI with TAPI
3.0 Provider. And I have an optiPoint 500 /
<br>&gt; HiPath 3000 / CallBridge TU
TAPI. If I use directly the TAPI with C++
<br>&gt; everything is fine but with
JAVA I don't get the telephone number.
<br>&gt;
<br>&gt; Please, could you help
me?
<br>&gt;
<br>&gt; Thanks a lot,
<br>&gt; Pavel
<br>&gt;
<br>&gt; I am using two
ideas that I have found on this forum but no success:
<br>&gt;
<br>&gt; if (ev
instanceof TermConnRingingEv) {
<br>&gt;     // first try
<br>&gt;     String
A_number;
<br>&gt;     String B_number;
<br>&gt;     CallControlCall call =3D
(CallControlCall)ev.getCall();
<br>&gt;     if(call instanceof CallControlCall)
{
<br>&gt;         Address myCalledAddress =3D
<br>&gt;
((CallControlCall)call).getCalledAddress();
<br>&gt;         Address
myCallingAddress =3D
<br>&gt;
((CallControlCall)call).getCallingAddress();
<br>&gt;
A_number=3DmyCallingAddress.getName();
<br>&gt;
B_number=3DmyCalledAddress.getName();
<br>&gt;
System.out.println("\n\nA=3D"+A_number+"  B=3D"+B_number);
<br>&gt;     }
<br>&gt;
<br>&gt;     // second try
<br>&gt;     TerminalConnection tc =3D
((TermConnEv)ev).getTerminalConnection();
<br>&gt;     try {
<br>&gt;         Call
c =3D ev.getCall();
<br>&gt;         Connection m_connections[] =3D
c.getConnections();
<br>&gt;         TerminalConnection termCons[] =3D
<br>&gt;
       m_connections[0].getTerminalConnections();
<br>&gt;
TerminalConnection termCon =3D termCons[0];
<br>&gt;         Terminal t =3D
termCon.getTerminal();
<br>&gt;         Address a[] =3D t.getAddresses();
<br>&gt;
      String incoming =3D a[0].getName();
<br>&gt;
System.out.println("address is "+incoming);
<br>&gt;
System.out.println("terminal is "+t.getName());
<br>&gt;
System.out.println("the phone is ringing");
<br>&gt;      } catch (Exception
excp) {
<br>&gt;         excp.printStackTrace();
<br>&gt;      }
<br>&gt;  }
<br>&gt;
<br>&gt;
=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
<br>&gt; To unsubscribe, send email to [email protected] and includ=
e in the
body
<br>&gt; of the message "signoff JTAPI-INTEREST".  For general help, se=
nd
email to
<br>&gt; [email protected] and include in the body of the message
"help".
<br>&gt;
<br>&gt;
<br>&gt;
<br>
<br>=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
<br>To unsubscribe, send email to [email protected] and include in =
the
body
<br>of the message "signoff JTAPI-INTEREST".  For general help, send
email to
<br>[email protected] and include in the body of the message
"help".
<br>
=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".

--MessagePart:196242893.0-16831-1451699322-1150191174
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
        charset="iso-8859-2"

Hi J=F6rg,

Thanks for your reply.

I have tried to add "observedAddress.addCallObserver(this);
observedTerminal.addCallObserver(this); "
and "callChangedEvent" function as you suggested. But the result
was:
CalledAddress=3DCallBridge TU
MyCallingAddress =3D null
when incoming call was coming.

Recently I added all possible core package observers and listeners -
I only haven't casted calls to (CallControlCall) as you do. And I
stoped at proper places in debugger and went though structures but I
have not found the incoming number anywhere. Always the
callingAddress and callingTerminal are null.

Thanks a lot for any help and suggestion,
Pavel








------------ P=F9vodn=ED zpr=E1va ------------
Od: J=F6rg Wiesmann <[email protected]>
P=F8edm=ECt: Re: [JTAPI] Incoming Telephone Number
Datum: 12.6.2006 23:17:14
---------------------------------------------
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 null
.. ");
} 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 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 body
of the message "signoff JTAPI-INTEREST".  For general help, send email to
[email protected] and include in the body of the message "help".

--MessagePart:196242893.0-16831-1451699322-1150191174--