Arne Kröger
Arne Kröger

Reputation: 91

Connecting to a telephone system via java

I would like to develop a Java app that logs all incoming calls to our telephone system. We use an octopus open system provided by the telekom.

After some research I found out that jtapi would be an solution but I can't find any good tutorials. Am I on the right track? Can you provide some examples to me?

Upvotes: 0

Views: 3450

Answers (3)

Krishna
Krishna

Reputation: 438

  • Download JTAPI library files "ECsjtapia.jar" add it to your project.
  • Add tsapi.pro file to your project. change the below line in your tsapi.pro file 10.100.100.110 (your cms server ip)=450 (port)
  • create listener.java with below code ` import javax.telephony.*;

public class Listener {

static Provider provider;
static JtapiPeer peer1=null;
static String myService = "";

public static void main(String args[]){
    try {
        peer1 = JtapiPeerFactory.getJtapiPeer("com.avaya.jtapi.tsapi.TsapiPeer");
        //"com.avaya.jtapi.tsapi.TsapiPeer"
    }
    catch(Exception hata)
    {
        System.out.println("Error: "+hata.getMessage());
    }
    //System.out.println("Test is ok: "+peer1.getName());
    String[] services = peer1.getServices();

    if (services == null)
    {
        System.out.println("Unable to obtain the services list from JTAPI peer");
        System.exit(0);
    }
    myService = services[0];
    //System.out.println("Service is "+myService);

    System.out.println("Connecting to server-:"+myService+";login=;passwd=");       
    provider = peer1.getProvider(myService + ";login=;passwd=;");



    try {
        Terminal[] terminals = provider.getTerminals();
        for(int i=0;i<=terminals.length-380;i++){
            String arrterminals =terminals[i].getName() ;
            try {
                    Terminal terminal = provider.getTerminal(arrterminals);
                    terminal.addCallListener(new callListener());
                    System.out.println("Terminal added for monitoring : " + i + " : " + terminal.getName());

            } catch (InvalidArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (ResourceUnavailableException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (MethodNotSupportedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } catch (ResourceUnavailableException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } 




}   

}

Upvotes: 1

Hajo Thelen
Hajo Thelen

Reputation: 1135

I don't think that there is a JTAPI implementation that supports the Telekom Octopus directly. You can try JTAPI over TAPI with the gjtapi (on sourceforge).

The standard API documetation of the JTAPI can be found at the Java Comunity Process (jcp.org).

This documentation contains some sample code in the package description of javax.telephony.

Monitor/Track calls is quite easy :

  • Connect to you Phone system (details depend on the implementation), this will result in a Connection
  • Get the Extension you want to observe : Connection.getTerminal or Connection.getAddress
  • Implement CallObserver or CallListener
  • Now you can add your CallObserver or CallListener : e.g. Address.addCallObserver.

In the eventhandling routines e.g. CallObserver.callCahngedEvent(CallEv ev[]) you can get all relevant information out of the event Object and do whatever you want with it.

That's all ...

Observer Listener?

Depending on your JTAPI implementation Observer may be deprecated or not.

Upvotes: 0

Matt Westlake
Matt Westlake

Reputation: 3651

If you can find an old fax card, you can just envoke a listener on the phone line and while active record. Other then that, not sure what else would work.

Upvotes: 0

Related Questions