Brekeke Contact Center Suite Wiki

Create a call log view for each agent

Here, you’ll learn how to add a page where agents can review their own call logs and check their call recording files. 

CIM:

1. Add the following parameter in CIM’s advanced settings, and you can add items (max 5 items) from the menu that you wish to view in pop-up window.

widget.menu.app.url.1 = < application's URL 1>
widget.menu.app.title.1 = <application's name1>
widget.menu.app.url.2 = < application's URL 2>
widget.menu.app.title.2 = <application's name2>
  :
widget.menu.app.url.5 = < application's URL 5>
widget.menu.app.title.5 = <application's name5>
Example:
widget.menu.app.url.1=http://127.0.0.1:8080/ca/page?tenant=#agentInfo.tenantName#&loginkey=#loginkey#&script=call_history&function=select
widget.menu.app.title.1=call history

<Settings>

 

<New menu>

 

 

CA:

1. Set the following parameter and save it at [Administrator menu] > [Settings] > [advanced option].

adminui.scripting.enabled = true

 

2. The “script” menu appears under the left menu.

 

3. Add the following script.

Script name: call_history
Type: page

 

Sample script:

var pre_html = '<html>';
pre_html +='<head>';
pre_html +='<meta http-equiv="Refresh" content="10">';
pre_html +='<title>call history</title>';
pre_html +='</head>';
pre_html +='<body><table border="1">';
pre_html +='<tr>';
pre_html +='<th nowrap>rid</th>';
pre_html +='<th nowrap>customer</th>';
pre_html +='<th nowrap>start</th>';
pre_html +='<th nowrap>end</th>';
pre_html +='<th nowrap>call time</th>';
pre_html +='<th nowrap>rfs</th>';
pre_html +='</tr>';

var suf_html = '</table></body></html>';

var select = function(request,ca,user){
	var tenant=request.getParameter('tenant');
	var user_id = user.getUser_id();
	var limit = 3;//10
	
	var sql = 'select a.rid,a.customer,a.start_date,a.end_date,a.call_time from `'+ tenant + '_m_call` a';
	sql += ' where a.rid in (';
	sql += ' select b.rid from `'+ tenant + '_r_session` b USE INDEX (r_session_index3) where   b.ua_number="' + user_id + '" and (b.ua_type=32770 or b.ua_type =2 or b.ua_type =32769 or b.ua_type =1)';
	sql += ' )';
	sql += ' and a.type !=0 and a.invalidated = 0';
	sql += ' order by a.start_date desc limit ' + limit;

	var con, stm;
	
	var buf = '';

	try {
		con = ca.getConnection();
		stm = con.createStatement();
		var rs = stm.executeQuery(sql);

		while(rs.next()){
			var rid = rs.getObject('rid');
			buf +='<tr>';
			buf += '<td nowrap>' + rid + '</td>';
			buf += '<td nowrap>' + rs.getObject('customer') + '</td>';
			buf += '<td nowrap>' + ca.toYmdhms(rs.getObject('start_date')) + '</td>';
			buf += '<td nowrap>' + ca.toYmdhms(rs.getObject('end_date')) + '</td>';
			buf += '<td nowrap>' + ca.toHms(rs.getObject('call_time')) + '</td>';
			var url = ca.getRfsUrl(tenant,rid,user_id,request);
			if(url){
				if(url.indexOf('audio') > 0){
					buf += '<td nowrap><audio src="' + url + '" controls="controls" preload="none" ></audio></td>';
				} else {
					buf += '<td nowrap><a href="' + url + '">download</a></td>';
				}
			} else {
				buf += '<td nowrap></td>';
			}
		}
		rs.close();
	  }finally {
	    if(stm) {
	      stm.close();
	    }
	    if(con) {
	      con.close();
	    }
	  }
	return pre_html + buf + suf_html;
}

 

4. After all set, agents can see their own call records

 

Note:

For security reasons, as default, tenant user cannot change scripts in CA. The tenant user can change scripts when the following parameter at the [Advanced Options] in CA is set.

script.readonly.tenant.user=false (default:true)

 

Yes No
Suggest Edit