public int getState() {
		if ((this.state == 2)
				|| ((monitorIsSet()) && (this.provider.getCapabilities()
						.getReadyEvent() != 0))) {
			return this.state;
		}
		if (this.provider.getCapabilities().getQueryAgentState() != 0) {
			CSTAPrivate priv = null;

			if ((this.provider.isLucent()) && (this.acdDevice != null)) {
				LucentQueryAgentState lqas = new LucentQueryAgentState(
						this.acdDevice.getName());
				priv = lqas.makeTsapiPrivate();
			}

			ConfHandler handler = new QueryAgentStateConfHandler(this);
			try {
				this.provider.tsapi.queryAgentState(this.agentDevice.getName(),
						priv, handler);
			} catch (TsapiPlatformException e) {
				throw e;
			} catch (Exception e) {
				if ((e instanceof ITsapiException)) {
					throw new TsapiPlatformException(
							((ITsapiException) e).getErrorType(),
							((ITsapiException) e).getErrorCode(),
							"queryAgentState failure");
				}
				throw new TsapiPlatformException(4, 0,
						"queryAgentState failure");
			}
			return this.state;
		}

		return this.state;
	}