0

i am a novice to java and netbeans both and complete newbie to java telephony.I am trying to import JTAPI (java telephony api) in netbeans project for past few days but i am unable to do so. I tried a lot of things and searched almost everywhere on internet but couldn't find a solution. I am desperate to find a solution so any help would really be appreciated.

coming to point.
i downloaded Jtapi from
http://download.oracle.com/otndocs/jcp/jtapi-1.4-fr3-spec-oth-JSpec/
and saved the jtapi-1_4-fr3-spec.zip file on desktop
then made a new netbeans java project. then i right clicked on libraries tab under the project->click add zip/folder-> entered the location of downloaded api.
then added a java file named "MyOutCallObserver.java" in the project

i opened the Jtapi specification and copied the code for detecting calls and pasted in the project. this code is provided in the following link too.
http://www.brekeke.com/products/jtapi/JTAPIspecdoc/javax/telephony/package-summary.html

import javax.telephony.*;
import javax.telephony.events.*;

/*
* The MyOutCallObserver class implements the CallObserver
* interface and receives all events associated with the Call.
*/

public class MyOutCallObserver1 implements CallObserver {

   public void callChangedEvent(CallEv[] evlist) {

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

  if (evlist[i] instanceof ConnEv) {

    String name = null;
    try {
      Connection connection = ((ConnEv)evlist[i]).getConnection();
      Address addr = connection.getAddress();
      name = addr.getName();
    } catch (Exception excp) {
      // Handle Exceptions
    }
    String msg = "Connection to Address: " + name + " is ";

    if (evlist[i].getID() == ConnAlertingEv.ID) {
      System.out.println(msg + "ALERTING");
    }
    else if (evlist[i].getID() == ConnInProgressEv.ID) {
      System.out.println(msg + "INPROGRESS");
    }
    else if (evlist[i].getID() == ConnConnectedEv.ID) {
      System.out.println(msg + "CONNECTED");
    }
    else if (evlist[i].getID() == ConnDisconnectedEv.ID) {
      System.out.println(msg + "DISCONNECTED");
    }
  }  
}
  }
}


but an compile-time error was generated in the project stating the import statement wasn't working. then i tried shifting the zip file to
C:\Program Files\Java\jdk1.7.0_25
C:\Program Files\Java\jdk1.7.0_25\jre\lib\ext
also i created a new library from tools menu and then added it to project but nothing seemed to work.
adding new library

importing normal zip file of api


after nothing was working i extracted the zip file and copied it where netbeans project was saved. i thought the problem was solved as there was no compile time error but another blood-sucking issue showed up! now the netbeans won't be able to import the CallObserver interface and appeared in dashed line and i had no clue about how to proceed.!

CallObserver issue

i will be really grateful to anyone who could tell me what am i not doing right and how to get it right.

2 Answers2

0

I use NetBeans 8.0.1 I got the same situation but this is not the problem.I compile the project an there is no errors

  • Did you import jtapi or any other Api? – Sparsh Parnami Oct 13 '14 at 01:18
  • I download JTAPI from link you provide in your request.This file contains source code not the compiled code that why i paste the contents of file in my project src folder. – user4132613 Oct 13 '14 at 14:48
  • thanks for the help.I upgraded the netbeans to 8.0.1. yet the issue is unwilling to get resolved.
    i would be really grateful if you can tell me step by step procedure and if possible with screenshots.
    thanks a lot in advance.
    – Sparsh Parnami Oct 14 '14 at 12:52
0

I did the same thing like you.I extracted the jtapi zip file and copi and paste javax folder in my Source Packages in my project.When i build the project a got the following error. Screenshot of error enter image description here

After that i opened the file that contains error ASRConstants.java and there is on row 204 in comment has some symbol like square in word vendors.After i deleted it the project compiles successfully. enter image description here

After that i copy and paste your code and compile also successfully.

enter image description here