Re: Address is out of service - ErrorMessage

"Potluri, Mohan" <[email protected]> Mon, 14 Mar 2005 14:34:34 -0800
Newsgroups gmane.comp.java.sun.jtapi
Message-ID <6677B3346233B94EBB11C060935101200A2D2755@vtg-um-e2k1.sj21ad.cisco.com>
Application needs to wait for address to come in service before calling "connect". Check makecall source code for this. jtrace has sample code which  implements "callChangedEvent" that receives call events and process them.


-----Original Message-----
From: Discussion list for Java Telephony API [mailto:[email protected]] On Behalf Of J. Wiesmann
Sent: Monday, March 14, 2005 7:21 AM
To: [email protected]
Subject: [JTAPI] Address is out of service - ErrorMessage

Hi,

i am trying to place a call with the example from the java site ( Outcall
&& MyOutCallObServer ) and i am getting the errormessage
com.cisco.jtapi.InvalidStateExceptionImpl: Address is out of service

i am using cisco manager 4.0

when i try to execute the makecall example ( from the cisco site ) it
works fine, but i now want to create my own functions and test it a
little, but it does not work.

here is the code
===================
public class Outcall {

  public static final void main(String args[]) {

    /*
     * Create a provider by first obtaining the default implementation of
     * JTAPI and then the default provider of that implementation.
     */
    Provider myprovider = null;
    try {
      JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(null);
      String providerString = "IP-ADRESS;login=XXXX;passswd=XXXX";
      myprovider = peer.getProvider(providerString);
    } catch (Exception excp) {
      System.out.println("Can't get Provider: " + excp.toString());
      System.exit(0);
    }
    System.out.println("got provider ..");

   /*
    * We need to get the appropriate objects associated with the
    * originating side of the telephone call. We ask the Address for a list
    * of Terminals on it and arbitrarily choose one.
    */
    Address origaddr = null;
    Terminal origterm = null;
    try {
      System.out.println("getting address.");
      origaddr = myprovider.getAddress("532");
      System.out.println("got address.");
      System.out.println(origaddr);
      /* Just get some Terminal on this Address */
      Terminal[] terminals = origaddr.getTerminals();
      if (terminals == null) {
        System.out.println("No Terminals on Address.");
        System.exit(0);
      }
      origterm = terminals[0];
      System.out.println(terminals[0]);
    } catch (Exception excp) {
      System.out.println("ADDRESS: " + excp.toString());
    }


    /*
     * Create the telephone call object and add an observer.
     */
    Call mycall = null;
    try {
      System.out.println("trying to add the observer... ");
      mycall = myprovider.createCall();
      mycall.addObserver(new MyOutCallObserver());
    } catch (Exception excp) {
        System.out.println("adding observer: " + excp.toString());
    }

    /*
     * Place the telephone call.
     */

    try {
      System.out.println("trying to place a call ");
      System.out.println(origaddr);
      System.out.println(origaddr.getTerminals ()[0]);
      Connection c[] = mycall.connect(origaddr.getTerminals ()[0],
origaddr, "001777943887");
      //Connection c[] = mycall.connect(origterm, origaddr, "529");
    } catch (Exception excp) {
        System.out.println("call ... : " + excp.toString());
        System.exit(1);
      // Handle all Exceptions
    }
  }
}




and here the result:
====================
got provider ..
getting address.
got address.
532
MAC-ADDRESS
trying to add the observer...
trying to place a call
532
MAC-ADDRESS
call ... : com.cisco.jtapi.InvalidStateExceptionImpl: Address is out of
service


what am i doing wrong ????
thx for help

greetz Jörg Wiesmann

===========================================================================
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".

===========================================================================
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".