Stephan Steiner | Is this another race condition issue? When my JTAPI apps start up, I set up Address and Call Observers on each terminal that is not restricted. for (Terminal term : provider.getTerminals()) { addTerminal((CiscoTerminal)term); } protected void addTerminal(CiscoTerminal term) { CiscoTerm ct = null; if (!term.isRestricted()) { if (term instanceof CiscoMediaTerminal) // this is a cti port ct = new CiscoCTIPort(provider, term, this.tracer, false); else if (term instanceof CiscoRouteTerminal) // this is a routepoint ct = new CTIRoutePoint(provider, term, this.tracer, false); else ct = new CiscoTerm(provider, term, this.tracer); ct.registerCallbacks(); this.terminals.put(term.getName(), ct); } else tracer.Trace("Terminal " + term.getName() + " is currently on the restriction list and cannot be monitored", 4); } .. in CiscoTerm.java (term = the CiscoTerminal) public boolean registerCallbacks() { boolean retval = false; lines = term.getAddresses(); try { term.addCallObserver(this); term.addObserver(this); CiscoAddress caddr = null; if (this.lines == null) { tracer.Trace("Device " + this.terminalName + " has no lines, monitoring it will be a rather futile attempt.", 4); } else { for (Address addr : this.lines) { caddr = (CiscoAddress)addr; if (caddr.isRestricted((Terminal)this.term)) tracer.Trace("Unable to monitor line " + caddr.getName(), 3); else addr.addObserver(this); } } retval = true; setDeviceEventFilter(false, TerminalEventFilterType.rtp); //setDeviceEventFilter(true, TerminalEventFilterType.buttonPressed); } catch (javax.telephony.ResourceUnavailableException r) { tracer.Trace("Problem when registering callbacks for terminal " + term.getName() + ": " + r.getMessage(), 1); } catch (javax.telephony.MethodNotSupportedException m) { tracer.Trace("Problem when registering callbacks for terminal " + term.getName() + ": " + m.getMessage(), 1); } catch (javax.telephony.PlatformException p) { JtapiProvider.GetProvider().processPlatformException(p, "registerCallback(" + terminalName + ")"); } catch (Exception e) { tracer.Trace("Generic exception during initialization of terminal " + this.terminalName, 1); } return retval; } Now, I have never had any issues in my lab, but on site, with both CCM 6.1 and 7.1 deployments, I have a handful of phones that dump an exception when I try to add the listeners. Now I'm wondering if I'm doing something wrong here or is there an issue in JTAPI that makes this fail from time to time? Note that when I check the offending terminals, they are not restricted, and neither are their addresses (so that makes me thing it's not race condition related... but I've seen it happening too with restricted terminals). |