📄 gencall.java
字号:
* @return true if these Objects are equal; false otherwise.
* @see java.util.Hashtable
*/
public boolean equals(Object obj) {
if (obj instanceof GenCall) {
return this.getFrameCall().equals(((GenCall)obj).getFrameCall());
}
return false;
}
/**
* Return the set of routed or pending (not yet routed) connections.
* This is synchronized to ensure that Connection.routeConnection() can transfer
* a pending connection to a routed one without causing "getConnections()" errors.
*/
public synchronized JccConnection[] getConnections() {
GenConnection[] conns = null;
int routedSize = 0;
javax.telephony.Connection[] frameConns = this.getFrameCall().getConnections();
if (frameConns != null) {
routedSize = frameConns.length;
conns = new GenConnection[routedSize];
for (int i = 0; i < routedSize; i++) {
conns[i] = this.getPrivateProvider().findConnection((FreeConnection)frameConns[i]);
}
}
// Now see if we have any pending connections to add (not yet routed to the fabric)
Set pending = this.getPendingConns();
int pendSize = pending.size();
if (pendSize > 0) {
GenConnection[] routed = conns;
conns = new GenConnection[routedSize + pendSize];
int i = 0;
for (; i < routedSize; i++) {
conns[i] = routed[i];
}
Iterator it = pending.iterator();
while (it.hasNext()) {
conns[i] = (GenConnection)it.next();
i++;
}
}
return conns;
}
/**
* Accessor for the Generic JTAPI Framework Call I wrap.
* Creation date: (2000-10-10 12:45:02)
* @return net.sourceforge.gjtapi.FreeCall
*/
net.sourceforge.gjtapi.FreeCall getFrameCall() {
return frameCall;
}
/**
* Insert the method's description here.
* Creation date: (2000-11-10 10:31:16)
* @return java.util.Set
*/
private java.util.Set getPendingConns() {
return pendingConns;
}
/**
* Internal accessor.
* Creation date: (2000-10-30 11:34:12)
* @return com.uforce.jain.generic.Provider
*/
private Provider getPrivateProvider() {
return this.provider;
}
/**
* getProvider method comment.
*/
public JccProvider getProvider() {
return this.getPrivateProvider();
}
/**
* Morph the JTAPI call state into a Jcc Call state
*/
public int getState() {
switch (this.getFrameCall().getState()) {
case javax.telephony.Call.IDLE: {
return JccCall.IDLE;
}
case javax.telephony.Call.ACTIVE: {
return JccCall.ACTIVE;
}
case javax.telephony.Call.INVALID: {
return JccCall.INVALID;
}
}
return JccCall.INVALID;
}
/**
* Return the set of Supervisor Runnables that are invoked on a call when if goes active.
* Creation date: (2000-11-10 14:37:52)
* @return java.util.Set
*/
java.util.Set getWaitingSupervisors() {
return waitingSupervisors;
}
/**
* Generates a hash code for the receiver.
* This method is supported primarily for
* hash tables, such as those provided in java.util.
* @return an integer hash code for the receiver
* @see java.util.Hashtable
*/
public int hashCode() {
return this.getFrameCall().hashCode();
}
/**
* release method comment.
*/
public void release() throws javax.csapi.cc.jcc.InvalidStateException, javax.csapi.cc.jcc.PrivilegeViolationException, javax.csapi.cc.jcc.ResourceUnavailableException {
try {
this.getFrameCall().drop();
} catch (javax.telephony.InvalidStateException ise) {
throw new javax.csapi.cc.jcc.InvalidStateException(ise.getObject(),
ise.getObjectType(),
ise.getState(),
ise.getMessage());
} catch (javax.telephony.PrivilegeViolationException pve) {
throw new javax.csapi.cc.jcc.PrivilegeViolationException(pve.getType(), pve.getMessage());
} catch (javax.telephony.MethodNotSupportedException mnse) {
throw new RuntimeException("Framework doesn't support drop but yet declares it does!");
} catch (javax.telephony.ResourceUnavailableException rue) {
throw new javax.csapi.cc.jcc.ResourceUnavailableException(rue.getType());
}
}
/**
This method requests the release of the call object and associated connection
objects. Thus this method is equivalent to using the {@link JccConnection#release(int)}
method on each JccConnection which is part of the Call. Typically each JccConnection
associated with this call will move into the {@link JccConnection#DISCONNECTED} state.
The call will also be terminated in the network. If the application
has registered as a listener then it receives the {@link JcpCallEvent#CALL_EVENT_TRANSMISSION_ENDED}
event. <p>
Valid cause codes (prefixed by <code>CAUSE_</code>) for the integer that is
named causeCode are defined in {@link JcpEvent} and {@link JccCallEvent}.
<P>Note: currently cuase codes are not properly reported in events due to a
limitation in the CoreTpi. Causes are not sent to the underlying fabric.
<p> <B>Pre-conditions:</B> <OL>
<LI>(this.getProvider()).getState() == IN_SERVICE <br>
<LI> this.getState() == ACTIVE
</OL>
<p> <B>Post-conditions:</B> <OL>
<LI>(this.getProvider()).getState() == IN_SERVICE <br>
<LI> this.getState() == INVALID
<LI>CALL_EVENT_TRANSMISSION_ENDED event delivered to the
valid Calllisteners.
<LI>Appropriate ConnectionEvents are also delivered to the ConnectionListeners.
</OL>
@param causeCode an integer that represents a cause code. Valid values
are defined in {@link JcpEvent} and {@link JccCallEvent}, they are typically prefixed
by <code>CAUSE_</code>.
@throws PrivilegeViolationException The application does not have
the authority or permission to disconnect the Call. For example,
an Address associated with this Call may not be controllable
in the Provider's domain.
@throws ResourceUnavailableException An internal resource required
to drop a connection is not available.
@throws InvalidStateException Some object required for the
successful invocation of this method is not in the proper state as
given by this method's pre-conditions.
@throws InvalidArgumentException The given release cause code is invalid.
@since 1.0a
*/
public void release(int causeCode) throws javax.csapi.cc.jcc.PrivilegeViolationException,
javax.csapi.cc.jcc.ResourceUnavailableException, javax.csapi.cc.jcc.InvalidStateException, javax.csapi.cc.jcc.InvalidArgumentException {
this.release();
}
/**
* removeCallListener method comment.
*/
public void removeCallListener(JccCallListener listener) {
this.getFrameCall().removeCallListener(new CallListenerAdapter(this.getPrivateProvider(), listener));
}
/**
* removeConnectionListener method comment.
*/
public void removeConnectionListener(JccConnectionListener cl) {
this.getFrameCall().removeCallListener(new ConnListenerAdapter((Provider)this.getProvider(), cl, null));
}
/**
* Remove a Connection to the list of those about to be routed.
* Creation date: (2000-11-09 16:27:58)
* @param conn com.uforce.jain.generic.GenConnection
*/
void removePendingConn(GenConnection conn) {
this.getPendingConns().remove(conn);
}
/**
* routeCall method comment.
*/
public JccConnection routeCall(String targetAddress, String originatingAddress, String originalDestinationAddress, String redirectingAddress) throws javax.csapi.cc.jcc.MethodNotSupportedException, javax.csapi.cc.jcc.ResourceUnavailableException, javax.csapi.cc.jcc.InvalidPartyException, javax.csapi.cc.jcc.InvalidArgumentException, javax.csapi.cc.jcc.InvalidStateException, javax.csapi.cc.jcc.PrivilegeViolationException {
JccConnection conn = (JccConnection)this.createConnection(targetAddress, originatingAddress, originalDestinationAddress, redirectingAddress);
conn.routeConnection(true);
return conn;
}
/**
* Insert the method's description here.
* Creation date: (2000-10-10 12:45:02)
* @param newFrameCall net.sourceforge.gjtapi.FreeCall
*/
private void setFrameCall(net.sourceforge.gjtapi.FreeCall newFrameCall) {
frameCall = newFrameCall;
}
/**
* Set the Provider for the Jain Jcc Call.
* Creation date: (2000-10-10 12:45:02)
* @param prov The Provider that created this call.
*/
private void setProvider(Provider prov) {
this.provider = prov;
}
/**
* superviseCall method comment.
*/
public void superviseCall(JccCallListener cl, double time, int treatment, double bytes) throws javax.csapi.cc.jcc.MethodNotSupportedException {
if (time == 0) {
throw new javax.csapi.cc.jcc.MethodNotSupportedException("Volume based supervision not supported");
}
Supervisor supervisor = new Supervisor(this, cl, time, treatment);
Set sups = this.getWaitingSupervisors();
// ensure we don't have a race condition with any installed SuperviseInstallers
synchronized(sups) {
int initialSize = sups.size();
// add the new supervisor listeners
cl.callSuperviseStart(new SuperviseEvent(this,
JccCallEvent.CALL_SUPERVISE_START));
sups.add(supervisor);
// See if we can trigger the supervisor right away.
if (this.getState() == JccCall.ACTIVE) {
new Thread(supervisor).start();
} else {
if (initialSize == 0)
try {
this.addCallListener(new SuperviseInstaller());
} catch (javax.csapi.cc.jcc.ResourceUnavailableException rue) {
throw new javax.csapi.cc.jcc.MethodNotSupportedException("Could not listen for active event: " + rue);
}
}
}
}
/**
* Suppervise a call based on time
*/
public void superviseCall(JccCallListener cl, double time, int treatment) throws javax.csapi.cc.jcc.MethodNotSupportedException {
this.superviseCall(cl, time, treatment, 0);
}
/**
* Describe myself
* @return a string representation of the receiver
*/
public String toString() {
return "Jcc Call for: " + this.getFrameCall().toString();
}
/* (non-Javadoc)
* @see javax.jcat.JcatCall#addTerminalConnectionListener(javax.jcat.JcatTerminalConnectionListener)
*/
public void addTerminalConnectionListener(JcatTerminalConnectionListener termConnListener)
throws MethodNotSupportedException, ResourceUnavailableException {
this.getFrameCall().addCallListener(new TerminalConnectionListenerAdapter((Provider)this.getProvider(), termConnListener));
}
/* (non-Javadoc)
* @see javax.jcat.JcatCall#blindTransfer(java.lang.String)
*/
public JcatConnection blindTransfer(String dialledDigits)
throws
InvalidArgumentException,
InvalidStateException,
InvalidPartyException,
MethodNotSupportedException,
PrivilegeViolationException,
ResourceUnavailableException {
try {
Connection conn = this.getFrameCall().transfer(dialledDigits);
return new GenConnection(this.getPrivateProvider(), conn);
} catch (javax.telephony.PrivilegeViolationException pve) {
throw new PrivilegeViolationException(pve.getType());
} catch (javax.telephony.InvalidArgumentException iae) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -