简介
本文档介绍如何在Intelligent Contact Manager(ICM)中配置DBLookup函数,以便从外部数据库提取数据并在脚本中使用它。为了说明如何配置该功能,本文档使用用户尝试识别主叫方是否为列表一部分的示例场景(例如,为了提供优先级服务)。
先决条件
要求
本文档没有任何特定的要求。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
配置
- 创建数据库。
首先,创建数据库。在Microsoft SQL Server Management Studio中,右键单击Databases并选择New Database:
然后,在此数据库中创建一个表。右键单击新创建的数据库下的Tables。然后,您可以添加几列:
注意:将DBLookup节点访问的表中的所有整数字段定义为NOT NULL。SQL数据库仅支持以下数据类型:SQLINT1(tinyint)、SQLINT2(smallint)、SQLINT4(int)、SQLCHAR(char)、SQLVARCHAR(varchar)、SQLFLT4DBFLT4(real)、SQLFLT8DBFLT8(float)和SQLDATETIME(datetime)。 必须将SQLDATETIME、SQLVARCHAR和SQLCHAR以外的所有字段定义为NOT NULL字段。可以将这三个字段定义为NULL。
选择varchar数据类型,因为它允许灵活地在数字中使用字符。要将Phone列设置为主键,请取消选中复选框中的Allow Nulls。要将此列设置为主键,请右键单击并选择设置主键:
完成这些步骤后,保存更改。现在,您可以向表中添加数据:
- 配置ICM以连接到此数据库。
使用资源管理器工具下的Configuration Manager以打开Database Lookup Explorer。然后,添加新创建的数据库和列:
您还需要配置用户名/口令才能登录数据库,因为系统默认使用sa和空口令。使用以下密钥配置注册表中的用户名/密码:
HKEY_LOCAL_MACHINE\SOFTWARE\Cisco Systems,
Inc.\ICM\inst1\RouterA\Router\CurrentVersion\Configuration\Database\SQLLogin
此示例显示如何为域用户配置密钥:
\\POD2SPRAWLA\DBLookup=(ZFB\Administrator,password)
注意:请勿在密码中使用以下特殊字符:"="、")"、"("、"、"、"?"、"\"、"/"
-
确保在Edit Router屏幕中选择Enable Database Routing,该屏幕可在Web界面上的路由器设置中访问:
- 在脚本中使用此数据库。
添加DBLookup节点并指定要搜索的表。此示例显示了使用CallingLineID搜索Priority表的过程。由于选择nchar作为数据类型,因此必须在输入查找之前将数字转换为字符串:
在设置为主键的列上进行查找。以后,您可以使用同一行的数据来填充调用变量。本示例显示了在数据库和配置管理器中添加的另一列City,该列可以填充到脚本中:
验证
使用此部分可确认DB Worker能够连接到外部数据库。创建一个txt文件dbw.txt,其中包含自上次重新启动数据库工作进程以来的日志:
C:\Users\Administrator.ZFB>cdlog
ra
C:\icm\inst1\ra\logfiles>dumplog dbw /o /ms /last
验证DB Worker能够使用dbw.txt连接到数据库:
12:39:08:413 ra-dbw Trace: Attempting integrated security open of
POD2SPRAWLA using ZFB\Administrator
12:39:08:451 ra-dbw Trace: Sucessfully impersonated ZFB\Administrator
12:39:08:476 ra-dbw Trace: 'id' is column 2 in sysobjects.
12:39:08:477 ra-dbw Trace: ID for table Priority is 5575058
12:39:08:484 ra-dbw Trace: Columns for Priority:
12:39:08:484 ra-dbw Trace: Column 1: Phone, type=47, length=30
12:39:08:536 ra-dbw Trace: Primary key for Priority is Phone, column 1.
12:39:08:557 ra-dbw Trace: Created connection to POD2SPRAWLA,DBLookup for thread 0
12:39:08:557 ra-dbw Trace: Created connection to POD2SPRAWLA,DBLookup for thread 1
12:39:08:558 ra-dbw Trace: Created connection to POD2SPRAWLA,DBLookup for thread 2
12:39:08:558 ra-dbw Trace: Created connection to POD2SPRAWLA,DBLookup for thread 3
12:39:08:558 ra-dbw Trace: Created connection to POD2SPRAWLA,DBLookup for thread 4
12:39:08:558 ra-dbw Trace: ScriptTable Piority is now available.
12:39:08:559 ra-dbw Trace: ScriptTable Piority (ID 5000) connected to
POD2SPRAWLA,DBLookup,Priority
12:39:08:559 ra-dbw Trace: Internal connect for POD2SPRAWLA,DBLookup,Priority
12:39:08:559 ra-dbw Trace: 'id' is column 2 in sysobjects.
12:39:08:560 ra-dbw Trace: ID for table Priority is 5575058
12:39:08:560 ra-dbw Trace: Columns for Priority:
12:39:08:560 ra-dbw Trace: Column 1: Phone, type=47, length=30
12:39:08:561 ra-dbw Trace: Primary key for Priority is Phone, column 1.
12:39:08:561 ra-dbw Trace: Column Phone (ID 5002) is table column 1, type 47.
12:39:08:561 ra-dbw Trace: ScriptTable Piority (ID 5000) connected to
POD2SPRAWLA,DBLookup,Priority
当主键列中没有匹配的条目(由脚本中的DBLookup节点触发)时,数据库辅助进程日志会显示此响应:
13:24:05:294 ra-dbw Trace: Queue a lookup request
13:24:05:295 ra-dbw Trace: DBWorker Thread 0 (ID 350760 Table:Priority):
Received request: transactionID 1
13:24:05:295 ra-dbw Trace: DBWorker Thread 0 (ID 350760),transactionID 1,
Attempt to read the record:
13:24:05:295 ra-dbw Trace: DBWorker transactionID 1, Failed! result=1
当存在匹配时,会得到以下响应:
13:25:25:810 ra-dbw Trace: Queue a lookup request
13:25:25:810 ra-dbw Trace: DBWorker Thread 1 (ID 354428 Table:Piority):
Received request: transactionID 2
13:25:25:810 ra-dbw Trace: DBWorker Thread 1 (ID 354428),transactionID 2,
Attempt to read the record:
13:25:25:811 ra-dbw Trace: DBWorker Thread 1 (ID 354428),transactionID 2,
Succeeded.
故障排除
目前没有针对此配置的故障排除信息。