The Elastix Call Center Protocol Revealed

7,219 views

Published on

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

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
7,219
On SlideShare
0
From Embeds
0
Number of Embeds
49
Actions
Shares
0
Downloads
339
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

The Elastix Call Center Protocol Revealed

  1. 1. Eduardo Sellanes January 28–31, 2014 | Miami Beach Convention Center
  2. 2. ECCP? Elastix Call Center Protocol Protocol developed by Elastix for the community
  3. 3. Goal? • Allow client applications to communicate easily with a Call Center Server. • Provide scalability and organization. • Send asynchronous events.
  4. 4. What do we need? Elastix • Download from www.elastix.org
  5. 5. Elastix…? • Elastix is an Open Source Software to establish Unified Communications It’s Free !!
  6. 6. Asterisk World Pavilion
  7. 7. What else do we need? CallCenter Addon • Installable from the Elastix Market Place • > v2.0.0-14 It’s Free also !!
  8. 8. Install with a click
  9. 9. ECCP Architecture CLIENT APPLICATIONs ECCP SERVER CLIENT APPLICATIONs CLIENT APPLICATIONs
  10. 10. ECCP Architecture ECCP SERVER dialerd Main service is called „dialerd‟
  11. 11. ECCP Architecture dialerd → /opt/elastix/dialer/dialerd • daemon doesn‟t execute as root user [root@localhost [root@localhost [root@localhost [root@localhost [root@localhost dialer]# dialer]# dialer]# dialer]# cd /opt/elastix/dialer/ 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]#
  12. 12. ECCP Architecture Start/Stop from Elastix Dashboard
  13. 13. ECCP Architecture ECCP SERVER 20005 dialerd Server is listening on port 20005 CLIENT APPLICATIONs
  14. 14. ECCP Architecture libs ECCP SERVER dialerd /opt/elastix/dialer/ php files
  15. 15. ECCP Architecture dialerd libs [root@localhost dialer]# [root@localhost dialer]# ls *.php AMIClientConn.class.php ECCPConn.class.php AMIEventProcess.class.php ECCPProcess.class.php AbstractProcess.class.php ECCPServer.class.php Agente.class.php HubProcess.class.php AppLogger.class.php HubServer.class.php CampaignProcess.class.php ListaAgentes.class.php Campania.class.php ListaLlamadas.class.php ConfigDB.class.php Llamada.class.php [root@localhost dialer]# [root@localhost dialer]# MultiplexConn.class.php MultiplexServer.class.php Predictivo.class.php TuberiaMensaje.class.php TuberiaProcess.class.php phpagi.php
  16. 16. ECCP Architecture CallCenter Database ECCP SERVER dialerd
  17. 17. ECCP Architecture Configuration file: → /opt/elastix/dialer/dialerd.conf [database] # Credenciales para base de datos call_center dbhost=localhost dbuser=asterisk dbpass=asterisk (Credentials for database "call_center”)
  18. 18. ECCP Architecture Asterisk - AMI ECCP SERVER dialerd
  19. 19. ECCP Architecture
  20. 20. ECCP Architecture Logs files ECCP SERVER dialerd
  21. 21. 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
  22. 22. 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>
  23. 23. 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
  24. 24. Protocol Three kinds of information packets • Event • Request • Response Each one is a well formed XML document
  25. 25. Protocol Events • Generated asynchronously from the server-side <event> … </event>
  26. 26. Protocol Events <event> <agentloggedin> <agent>Agent/9000</agent> <queues> <queue>8001</queue> <queue>8000</queue> </queues> </agentloggedin> </event>
  27. 27. Protocol Requests Message sent from the client to the server <request id="identificador"> ... </request> id identify each request id = ‘timestamp LINUX‘ ‘dot’ ‘6 char random number’ id = 1292899827.123456
  28. 28. Protocol Responses Server response based on a client's previous requirement <response id="identificador" > ... </response> response id is the same as request id
  29. 29. Protocol Request - Responses request id=“x" CLIENT APPLICATION response id=“x" response id=“x" SERVER
  30. 30. Protocol Request - Responses <request id="1292899827.123456"> ... </request> <response id="1292899827.123456"> ... </response> <response id="1292899827.123456"> ... </response>
  31. 31. Protocol Request - Responses <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>
  32. 32. Protocol Error Responses <response id="identificador"> <failure> <code>XXX</code> <message>Error message</message> </failure> </response> An error is a response with failure element
  33. 33. Protocol Error type Protocol Error: < response id="identificador"> < failure > <code>XXX</code> <message>Error messages</message> </ failure > </ response >
  34. 34. Protocol Error type Error at processing time: < response id="identificador"> < failure > <request_response> <code>XXX</code> <message>Error messages</message> </request_response > </ failure > </ response >
  35. 35. Protocol Error Samples <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>
  36. 36. Protocol Complete list of requests-response-events-error : → /opt/elastix/dialer/Protocolo ECCP.txt Source code It’s OPENSOURCE !! → /opt/elastix/dialer/dialerd → /opt/elastix/dialer/*.php (libs)
  37. 37. Create agent login/logout application
  38. 38. Application We need… ECCP user/secret - server connection Agent user/secret - queue login
  39. 39. Application ECCP user/secret
  40. 40. Application ECCP user/secret
  41. 41. Application AGENT user/secret
  42. 42. Application AGENT user/secret
  43. 43. Application Login request • Authenticate a client application • Establish a session
  44. 44. Application ECCP Login request : <request id="1292899827.123456"> <login> <username>userECCP</username> <password>secretECCP</password> </login> </request>
  45. 45. Application OK response : <response id="1292899827.123456"> <login_response> <success/> <app_cookie>35d290884ef77a78cc6c0006b7e1d576</app_cookie> </login_response> </response> Fail response : <response id="1292899827.123456"> <login_response> <failure> <code>401</code> <message>Invalid username or password</message> </failure> </login_response> </response>
  46. 46. Application AGENT Queue Login request : <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>
  47. 47. Application app_cookie - agent_hash login request CLIENT APPLICATION CLIENT APPLICATION response “app_cookie” loginagent request agent_hash SERVER SERVER
  48. 48. Application app_cookie - agent_hash <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>
  49. 49. Application app_cookie - agent_hash s = app_cookie + "Agent/9000" + "AgentSecret“ agent_hash = MD5(s) + implies concatenate
  50. 50. Application AGENT Queue Logout request : <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>
  51. 51. Application ECCP Logout request : <request id="1292899827.123456"> <logout></logout> </request> <response id="1292899827.123456"> <logout_response> <success/> </logout_response> </response>
  52. 52. Do we have to parse XML every time?
  53. 53. The answer is …
  54. 54. NO, of course…
  55. 55. Elastix does it for us
  56. 56. ECCP.class /var/www/html/modules/agent_console/libs/ECCP.class.php It’s OPENSOURCE !! Take a look, read it, use it
  57. 57. How we use it? It‟s a class!!, #!/usr/bin/php <?php require_once("libs/ECCP.class.php"); $obj = new ECCP();
  58. 58. #!/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 ?>
  59. 59. Download a complete example from: http://elx.ec/eccpexample
  60. 60. What else?
  61. 61. Call Center PRO
  62. 62. Call Center PRO
  63. 63. Call Center PRO
  64. 64. Smart Assistant Worldwide release 19th of February, 2014
  65. 65. -
  66. 66. disconnect()

×