the elastix call center protocol revealed

68
Elastix Call Center Protocol Revealed Eduardo Sellane January 28–31, 2014 | Miami Beach Convention Cen

Upload: palosanto-solutions

Post on 10-Dec-2014

2.884 views

Category:

Technology


10 download

DESCRIPTION

Asterisk World, Thursday, January 30, 2014 ITEXPO EAST 2014 Miami USA Speaker: Eduardo Sellanes

TRANSCRIPT

Page 1: The Elastix Call Center Protocol Revealed

Elastix Call Center ProtocolRevealed

Eduardo Sellanes January 28–31, 2014 | Miami Beach Convention Center

Page 2: The Elastix Call Center Protocol Revealed

ECCP?

Elastix Call Center Protocol

Protocol developed by Elastix for the community

Page 3: The Elastix Call Center Protocol Revealed

Goal?

• Allow client applications to communicate easily with a Call Center Server.

• Provide scalability and organization.

• Send asynchronous events.

Page 4: The Elastix Call Center Protocol Revealed

What do we need?

Elastix

• Download from www.elastix.org

Page 5: The Elastix Call Center Protocol Revealed

Elastix…?

• Elastix is an Open Source Software to establish Unified Communications

It’s Free !!

Page 6: The Elastix Call Center Protocol Revealed

Visit us!!!

Asterisk World Pavilion

Page 7: The Elastix Call Center Protocol Revealed

What else do we need?

CallCenter Addon

• Installable from the Elastix Market Place

• > v2.0.0-14

It’s Free also !!

Page 8: The Elastix Call Center Protocol Revealed

Install with a click

Page 9: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVER

CLIENT APPLICATIONs

CLIENT APPLICATIONs

CLIENT APPLICATIONs

Page 10: The Elastix Call Center Protocol Revealed

ECCP Architecture

Main service is called ‘dialerd’

ECCP SERVER

dialerd

Page 11: The Elastix Call Center Protocol Revealed

ECCP Architecture

dialerd

→ /opt/elastix/dialer/dialerd

• daemon doesn’t execute as root user

[root@localhost dialer]#[root@localhost dialer]#[root@localhost dialer]#[root@localhost dialer]# cd /opt/elastix/dialer/[root@localhost dialer]# ./dialerd start

SECURITY WARNING: Sorry, I STRONGLY OBJECT to run as root.

This program requires only network access and therefore does not require root privileges.

[root@localhost dialer]#

Page 12: The Elastix Call Center Protocol Revealed

ECCP Architecture

Start/Stop from Elastix Dashboard

Page 13: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVER

dialerd

20005 CLIENT APPLICATIONs

Server is listening on port 20005

Page 14: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVERdialerd

/opt/elastix/dialer/

php files

libs

Page 15: The Elastix Call Center Protocol Revealed

ECCP Architecture

dialerd libs

[root@localhost dialer]# [root@localhost dialer]# ls *.phpAMIClientConn.class.php ECCPConn.class.phpMultiplexConn.class.phpAMIEventProcess.class.php ECCPProcess.class.php MultiplexServer.class.phpAbstractProcess.class.php ECCPServer.class.php Predictivo.class.phpAgente.class.php HubProcess.class.php TuberiaMensaje.class.phpAppLogger.class.php HubServer.class.php TuberiaProcess.class.phpCampaignProcess.class.php ListaAgentes.class.php phpagi.phpCampania.class.php ListaLlamadas.class.phpConfigDB.class.php Llamada.class.php[root@localhost dialer]# [root@localhost dialer]#

Page 16: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVERdialerd

CallCenter Database

Page 17: The Elastix Call Center Protocol Revealed

ECCP Architecture

Configuration file: → /opt/elastix/dialer/dialerd.conf

[database]# Credenciales para base de datos call_centerdbhost=localhostdbuser=asteriskdbpass=asterisk

(Credentials for database "call_center”)

Page 18: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVERdialerd

Asterisk - AMI

Page 19: The Elastix Call Center Protocol Revealed

ECCP Architecture

Page 20: The Elastix Call Center Protocol Revealed

ECCP Architecture

ECCP SERVERdialerd

Logs files

Page 21: The Elastix Call Center Protocol Revealed

ECCP Architecture

Logs file: → /opt/elastix/dialer/dialerd.log

logrotate configure file→ /etc/logrotate.d/elastixdialer

dialerd.log.1 dialerd.log.2..dialerd.log.5

Page 22: The Elastix Call Center Protocol Revealed

Protocol

Simple – plain text

Based on XML (elements and attributes)

<event> <agentloggedin> <agent>Agent/9000</agent> <queues> <queue>8001</queue> <queue>8000</queue> </queues> </agentloggedin></event>

Page 23: The Elastix Call Center Protocol Revealed

Protocol

Session oriented

Listen to multiple clients at the same time

• Client login (user/secret), Server create session• Client logout, Server destroy session• Timeout (5minutes), Server destroy session

Page 24: The Elastix Call Center Protocol Revealed

Protocol

Three kinds of information packets

• Event

• Request

• Response

Each one is a well formed XML document

Page 25: The Elastix Call Center Protocol Revealed

Protocol

Events

• Generated asynchronously from the server-side

<event>…</event>

Page 26: The Elastix Call Center Protocol Revealed

Protocol

Events

<event> <agentloggedin> <agent>Agent/9000</agent> <queues> <queue>8001</queue> <queue>8000</queue> </queues> </agentloggedin></event>

Page 27: The Elastix Call Center Protocol Revealed

Protocol

Requests

Message sent from the client to the server

<request id="identificador">...</request>

id identify each requestid = ‘timestamp LINUX‘ ‘dot’ ‘6 char random number’

id = 1292899827.123456

Page 28: The Elastix Call Center Protocol Revealed

Protocol

Responses

Server response based on a client's previous requirement

<response id="identificador" >...</response>

response id is the same as request id

Page 29: The Elastix Call Center Protocol Revealed

Protocol

CLIENTAPPLICATION

SERVER

request id=“x"

response id=“x"

response id=“x"

Request - Responses

Page 30: The Elastix Call Center Protocol Revealed

Protocol

<request id="1292899827.123456">...</request>

<response id="1292899827.123456">...</response>

<response id="1292899827.123456">...</response>

Request - Responses

Page 31: The Elastix Call Center Protocol Revealed

Protocol

<request id="1292899827.123456"> <getagentstatus> <agent_number>Agent/9000</agent_number> </getagentstatus></request >

<response id="1292899827.123456"> <getagentstatus_response> <status>offline</status> </getagentstatus_response></response>

Request - Responses

Page 32: The Elastix Call Center Protocol Revealed

Protocol

<response id="identificador"> <failure> <code>XXX</code> <message>Error message</message> </failure></response>

An error is a response with failure element

Error Responses

Page 33: The Elastix Call Center Protocol Revealed

Protocol

Protocol Error:

< response id="identificador"> < failure > <code>XXX</code> <message>Error messages</message> </ failure ></ response >

Error type

Page 34: The Elastix Call Center Protocol Revealed

Protocol

Error at processing time:

< response id="identificador"> < failure > <request_response>

<code>XXX</code> <message>Error messages</message>

</request_response > </ failure ></ response >

Error type

Page 35: The Elastix Call Center Protocol Revealed

Protocol

<response id="1292899827.123456"> <failure> <code>401</code> <message>Unauthorized</message> </failure></response>

<response id="1292899827.123456"> <login_response> <failure> <code>401</code> <message>Invalid username or password </message> </failure> </login_response ></response>

Error Samples

Page 36: The Elastix Call Center Protocol Revealed

Protocol

Complete list of requests-response-events-error :

→ /opt/elastix/dialer/Protocolo ECCP.txt

Source code

→ /opt/elastix/dialer/dialerd → /opt/elastix/dialer/*.php (libs)

It’s OPENSOURCE !!

Page 37: The Elastix Call Center Protocol Revealed

Create agent login/logout application

Page 38: The Elastix Call Center Protocol Revealed

Application

We need…

ECCP user/secret - server connection

Agent user/secret - queue login

Page 39: The Elastix Call Center Protocol Revealed

ApplicationECCP user/secret

Page 40: The Elastix Call Center Protocol Revealed

ApplicationECCP user/secret

Page 41: The Elastix Call Center Protocol Revealed

ApplicationAGENT user/secret

Page 42: The Elastix Call Center Protocol Revealed

ApplicationAGENT user/secret

Page 43: The Elastix Call Center Protocol Revealed

ApplicationLogin request

• Authenticate a client application

• Establish a session

Page 44: The Elastix Call Center Protocol Revealed

Application

<request id="1292899827.123456"> <login> <username>userECCP</username> <password>secretECCP</password> </login></request>

ECCP Login request :

Page 45: The Elastix Call Center Protocol Revealed

Application

<response id="1292899827.123456"> <login_response> <success/><app_cookie>35d290884ef77a78cc6c0006b7e1d576</app_cookie> </login_response></response>

<response id="1292899827.123456"> <login_response> <failure> <code>401</code> <message>Invalid username or password</message> </failure> </login_response></response>

OK response :

Fail response :

Page 46: The Elastix Call Center Protocol Revealed

Application

<request id="1292899827.123456"> <loginagent> <agent_number>Agent/9000</agent_number> <agent_hash>XXXXXXXXXXXXXXXXXXXXXXXXX</agent_hash> <extension>1064</extension> </loginagent></request>

<response id="1292899827.123456"> <loginagent_response> <status>logging</status> </loginagent_response></response>

AGENT Queue Login request :

Page 47: The Elastix Call Center Protocol Revealed

Application

CLIENTAPPLICATION

SERVER

login request

response “app_cookie”

CLIENTAPPLICATION

SERVERloginagent request

agent_hash

app_cookie - agent_hash

Page 48: The Elastix Call Center Protocol Revealed

Application

<response id="1292899827.123456"> <login_response> <success/><app_cookie>35d290884ef77a78cc6c0006b7e1d576</app_cookie> </login_response></response>

<request id="1292899827.123456"> <loginagent> <agent_number>Agent/9000</agent_number> <agent_hash>XXXXXXXXXXXXXXXXXXXXXXXXX</agent_hash> <extension>1064</extension> </loginagent></request>

app_cookie - agent_hash

Page 49: The Elastix Call Center Protocol Revealed

Applicationapp_cookie - agent_hash

s = app_cookie + "Agent/9000" + "AgentSecret“

agent_hash = MD5(s)

+ implies concatenate

Page 50: The Elastix Call Center Protocol Revealed

Application

<request id="1292899827.123456"> <logoutagent> <agent_number>Agent/9000</agent_number> <agent_hash>XXXXXXXXXXXXXXXXXXXXXXXXX</agent_hash> </logoutagent></request>

<response id="1292899827.123456"> < logoutagent_response> <status>logged-out</status> </logoutagent_response></response>

AGENT Queue Logout request :

Page 51: The Elastix Call Center Protocol Revealed

Application

<request id="1292899827.123456"><logout></logout>

</request>

<response id="1292899827.123456"> <logout_response>

<success/></logout_response>

</response>

ECCP Logout request :

Page 52: The Elastix Call Center Protocol Revealed

Do we have to parse XML every time?

Page 53: The Elastix Call Center Protocol Revealed

The answer is …

Page 54: The Elastix Call Center Protocol Revealed

NO, of course…

Page 55: The Elastix Call Center Protocol Revealed

Elastix does it for us

Page 56: The Elastix Call Center Protocol Revealed

ECCP.class

/var/www/html/modules/agent_console/libs/ECCP.class.php

Take a look, read it, use it

It’s OPENSOURCE !!

Page 57: The Elastix Call Center Protocol Revealed

How we use it?

It’s a class!!,

#!/usr/bin/php<?php

require_once("libs/ECCP.class.php");

$obj = new ECCP();

Page 58: The Elastix Call Center Protocol Revealed

#!/usr/bin/php<?php

require_once("libs/ECCP.class.php");

$obj = new ECCP();

$host = “Elastix_Server_IP";$eccp_user = "ECCP_user";$eccp_pass = "ECCP_pass";

$agent = "Agent/9000";$agent_pass = "secret";$agent_extension = "2120";

print "Connecting.....\n";//try

$obj->connect($host, $eccp_user, $eccp_pass);

obj->setAgentNumber($agent);obj->setAgentPass($eccp_pass);

$ag_obj = $obj->loginagent($agent_extension);

//check if login ok? Failure?

print "Disconnecting...\n";$obj->disconnect();

//error?>

Page 59: The Elastix Call Center Protocol Revealed

Download a complete example from:

http://elx.ec/eccpexample

Page 60: The Elastix Call Center Protocol Revealed

What else?

Page 61: The Elastix Call Center Protocol Revealed
Page 62: The Elastix Call Center Protocol Revealed

Call Center PRO

Page 63: The Elastix Call Center Protocol Revealed

Call Center PRO

Page 64: The Elastix Call Center Protocol Revealed

Call Center PRO

Page 65: The Elastix Call Center Protocol Revealed

Available Soon

Page 66: The Elastix Call Center Protocol Revealed

Smart Assistant

Worldwide release19th of February, 2014

Page 67: The Elastix Call Center Protocol Revealed

[email protected] @elastixworld-

Page 68: The Elastix Call Center Protocol Revealed

disconnect()