📄 testcalllistener.java
字号:
package net.sourceforge.gjtapi.raw.sipprovider;
/*
Copyright (c) 2002 8x8 Inc. (www.8x8.com)
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, provided that the above
copyright notice(s) and this permission notice appear in all copies of
the Software and that both the above copyright notice(s) and this
permission notice appear in supporting documentation.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Except as contained in this notice, the name of a copyright holder
shall not be used in advertising or otherwise to promote the sale, use
or other dealings in this Software without prior written authorization
of the copyright holder.
*/
import java.io.*;
import javax.telephony.callcontrol.CallControlTerminalConnection;
import net.sourceforge.gjtapi.*;
import javax.telephony.*;
import net.sourceforge.gjtapi.*;
import javax.telephony.media.*;
import net.sourceforge.gjtapi.media.*;
import java.io.*;
import javax.telephony.callcontrol.CallControlTerminalConnection;
import net.sourceforge.gjtapi.*;
import javax.telephony.*;
/**
* Simple test script for the emulator raw provider
* Creation date: (2000-02-03 15:40:58)
* @author: Richard Deadman
*/
public class TestCallListener implements TerminalConnectionListener
{
/**
* callActive method comment.
*/
public void callActive(javax.telephony.CallEvent event)
{
System.out.println("5.1.1: Active Call event with cause: " + this.causeToString(event.getCause()));
}
/**
* callEventTransmissionEnded method comment.
*/
public void callEventTransmissionEnded(javax.telephony.CallEvent event)
{
System.out.println("5.1.3: Event Transmission Ended Call event with cause: " + this.causeToString(event.getCause()));
}
/**
* callInvalid method comment.
*/
public void callInvalid(javax.telephony.CallEvent event)
{
System.out.println("5.1.2: Invalid Call event with cause: " + this.causeToString(event.getCause()));
}
/**
* Convert the event cause string to a cause.
* Creation date: (2000-05-01 9:58:39)
* @author: Richard Deadman
* @return English description of the cause
* @param cause The Event cause id.
*/
public String causeToString(int cause)
{
switch (cause)
{
case Event.CAUSE_CALL_CANCELLED:
{
return "Call cancelled";
}
case Event.CAUSE_DEST_NOT_OBTAINABLE:
{
return "Destination not obtainable";
}
case Event.CAUSE_INCOMPATIBLE_DESTINATION:
{
return "Incompatable destination";
}
case Event.CAUSE_LOCKOUT:
{
return "Lockout";
}
case Event.CAUSE_NETWORK_CONGESTION:
{
return "Network congestion";
}
case Event.CAUSE_NETWORK_NOT_OBTAINABLE:
{
return "Network not obtainable";
}
case Event.CAUSE_NEW_CALL:
{
return "New call";
}
case Event.CAUSE_NORMAL:
{
return "Normal";
}
case Event.CAUSE_RESOURCES_NOT_AVAILABLE:
{
return "Resource not available";
}
case Event.CAUSE_SNAPSHOT:
{
return "Snapshot";
}
case Event.CAUSE_UNKNOWN:
{
return "Unknown";
}
}
return "Cause mapping error: " + cause;
}
/**
* connectionAlerting method comment.
*/
public void connectionAlerting(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.3: Alerting Connection event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionConnected method comment.
*/
public void connectionConnected(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.4: Connection Connected event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionCreated method comment.
*/
public void connectionCreated(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.1: Connection Created event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionDisconnected method comment.
*/
public void connectionDisconnected(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.5: Connection Disconnected event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionFailed method comment.
*/
public void connectionFailed(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.6: Connection Failed event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionInProgress method comment.
*/
public void connectionInProgress(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.2: Connection in Progress event with cause: " + this.causeToString(event.getCause()));
}
/**
* connectionUnknown method comment.
*/
public void connectionUnknown(javax.telephony.ConnectionEvent event)
{
System.out.println("5.3.7: Connection Unknown event with cause: " + this.causeToString(event.getCause()));
}
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args)
{
// Report error if insufficient parameters passed in
if (args.length < 3)
{
System.err.println("Usage: java net.sourceforge.gjtapi.test.TestCallListener Provider from to");
// System.exit(1);
}
test("net.sourceforge.gjtapi.raw.sip.SipProvider", "sip:pingtel@192.168.0.2", "sip:pingtelP@192.168.0.22");
}
/**
* multiCallMetaMergeEnded method comment.
*/
public void multiCallMetaMergeEnded(javax.telephony.MetaEvent event)
{
System.out.println("X.X: Multicall merge ended event with cause: " + this.causeToString(event.getCause()));
}
/**
* multiCallMetaMergeStarted method comment.
*/
public void multiCallMetaMergeStarted(javax.telephony.MetaEvent event)
{
System.out.println("X.X: Multicall merge started event with cause: " + this.causeToString(event.getCause()));
}
/**
* multiCallMetaTransferEnded method comment.
*/
public void multiCallMetaTransferEnded(javax.telephony.MetaEvent event)
{
System.out.println("X.X: Multicall transfer ended event with cause: " + this.causeToString(event.getCause()));
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -