首頁>>廠商>>CT中間件廠商>>朗深技術(shù)

UniMedia MSIX座席Jar包用Java調(diào)用實(shí)例解析

2009/05/31

目標(biāo)功能

  在Java應(yīng)用中實(shí)現(xiàn)來話通知和電話應(yīng)答。

Java調(diào)用實(shí)例

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("摘機(jī)失敗:"
+ msi.getLastErrorString());
}
else
{
System.out.println("摘機(jī)成功!");
}
}
});
}
return jButtonAnswer;
}

}


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

說明:

  1. 先初始化控件,然后登錄座席,登錄成功后打內(nèi)線電話1000或通過ACD分配到1000,應(yīng)答來話即可;

  2. SetConnInfo/SetDN/Start等函數(shù)都有返回值,可以判斷是否成功;

  3. 具體API以及事件的用法請參考開發(fā)文檔。

CTI論壇報(bào)道



相關(guān)閱讀:
UniMedia 中間件典型應(yīng)用-外線座席呼叫中心 2009-09-23
UniMedia IDE集成環(huán)境訪問網(wǎng)絡(luò)服務(wù)器實(shí)例解析 2009-09-23
UniMedia MSIX座席控件Javascript調(diào)用實(shí)例 2009-09-23
基于UniMedia融合媒體中間件的企業(yè)通信平臺 2009-07-27
PBX常用功能 2009-06-10