首页>>厂商>>CT中间件厂商>>朗深技术

UniMedia MSIX座席Jar包用Java调用实例解析

2009/05/31

目标功能

  在Java应用中实现来话通知和电话应答。

Java调用实例

package MsiDemo;
import javax.swing.*;
import lioncen.cti.jmsi.*;
import lioncen.cti.jmsi.object.*;
import lioncen.cti.jmsi.engine.*;

public class MsiDemo extends JFrame
{
private JButton jButtonInit = null;
private JButton jButtonLogin = null;
private JButton jButtonAnswer = null;

public static MSI msi = null;
public static MsiDemo msiDemo = null;

public MsiDemo()
{
super();

this.setTitle("Msi Demo");
this.setLocation(200, 200);
this.setSize(300, 200);

JPanel jContentPane = new JPanel();
jContentPane.add(getJButtonInit());
jContentPane.add(getJButtonLogin());
jContentPane.add(getJButtonAnswer());
this.setContentPane(jContentPane);

this.addWindowListener(new java.awt.event.WindowAdapter()
{
public void windowClosing(java.awt.event.WindowEvent e)
{
System.exit(0);
}
};
}

public static void main(String[] args)
{
msi = new MSI();
MSI.msiLog.setDebug(true);
msi.ctiEventListener = new MyMSIEventHandler();

msiDemo = new MsiDemo();
msiDemo.setVisible(true);
}

private JButton getJButtonLogin()
{
if (jButtonLogin == null)
{
jButtonLogin = new JButton();
jButtonLogin.setText("Login");
jButtonLogin.addActionListener(
new java.awt.event.ActionListener()
{
public void actionPerformed(
java.awt.event.ActionEvent e)
{
int ret = msi.login(1000, true, false,
"2000", "5", "xms", "");
if (ret == CTIConst.RET_FAIL)
{
System.out.println("登录失败:"
+ msi.getLastErrorString());
}
else
{
System.out.println("登录成功!");
}
}
});
}
return jButtonLogin;
}

private JButton getJButtonInit()
{
if (jButtonInit == null)
{
jButtonInit = new JButton();
jButtonInit.setText("Init");
jButtonInit.addActionListener(
new java.awt.event.ActionListener()
{
public void actionPerformed(
java.awt.event.ActionEvent e)
{
msi.setConnInfo("192.168.1.1", 10089);
msi.setDN("1000");
msi.start();
}
});
}
return jButtonInit;
}

private JButton getJButtonAnswer()
{
if (jButtonAnswer == null)
{
jButtonAnswer = new JButton();
jButtonAnswer.setText("Answer");
jButtonAnswer.addActionListener(
new java.awt.event.ActionListener()
{
public void actionPerformed(
java.awt.event.ActionEvent e)
{
int ret = msi.setHookStatus(2);
if (ret == CTIConst.RET_FAIL)
{
System.out.println("摘机失败:"
+ msi.getLastErrorString());
}
else
{
System.out.println("摘机成功!");
}
}
});
}
return jButtonAnswer;
}

}


class MyMSIEventHandler extends MSIEventAdapter
{
public void callIncome(String AlertingDN, String CallingDN, String CalledDN, String UUD)
{
System.out.println("来电话了!");
}
}

说明:

  1. 先初始化控件,然后登录座席,登录成功后打内线电话1000或通过ACD分配到1000,应答来话即可;

  2. SetConnInfo/SetDN/Start等函数都有返回值,可以判断是否成功;

  3. 具体API以及事件的用法请参考开发文档。

CTI论坛报道



相关阅读:
UniMedia 中间件典型应用-外线座席呼叫中心 2009-09-23
UniMedia IDE集成环境访问网络服务器实例解析 2009-09-23
UniMedia MSIX座席控件Javascript调用实例 2009-09-23
基于UniMedia融合媒体中间件的企业通信平台 2009-07-27
PBX常用功能 2009-06-10