RPC documentation
From LIVECHAT Developer Zone Wiki
Short summary
LIVECHAT server provides functionality to signal predefined LIVECHAT events using RPC (Remote Procedure Call). Events are signaled using popular HTTP protocol. To make this feature work you should take following steps:
- Set up proper parameters in lc_serv.cfg file (LIVECHAT server side)
- Create scripts that employ LIVECHAT events (HTTP server side)
LIVECHAT server side configuration
To make LIVECHAT RPC working you should define RPC_SERVER_IP and at least one of EVENT parameters in lc_serv.cfg. After setting up parameters you should restart LIVECHAT server.
Parameters:
- RPC_SERVER_IP – IP address of HTTP server in HOST:IP format (eg. 10.0.0.1:80)
- EVENT_NEW_LICENCE – URL address which is requested when a new licence was created (HTTP request is performed on server defined in RPC_SERVER_IP)
- EVENT_OPERATOR_TRANSFER – URL address which is requested when a client is transfered by an agent
- EVENT_OPERATOR_STATUS - URL address which is requested when an agent changes its status
- EVENT_BUTTON_STATUS - URL address which is requested when button(s) on a web page changes its state
- EVENT_CHAT_STARTED - URL address which is requested when a new chat is started
- EVENT_PRIVATE_CHAT_STATUS - URL address which is requested when a chat status is changed
- EVENT_CLIENT_INVITED - URL address which is requested when a client is invited to a chat
- EVENT_OPERATOR_STOPED_CHAT - URL address which is requested when an agent stops a chat
Sample lc_serv.cfg file:
EVENT_NEW_LICENCE http://labs.livechatinc.com/event_new_licence.pl EVENT_OPERATOR_TRANSFER http://labs.livechatinc.com/events.pl EVENT_OPERATOR_STATUS http://labs.livechatinc.com/events.pl EVENT_BUTTON_STATUS http://labs.livechatinc.com/events.pl RPC_SERVER_IP 83.12.68.106:80
HTTP server side configuration
HTTP server will receive one or more events (depends on lc_serv.cfg file) defined as:
- EVENT_NEW_LICENCE – a new licence and a first agent was created, available parameters:
- EVENT - equal to NEW_LICENCE (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- LIC_TYPE - type of licence
- WEB_PAGE - web page
- PROMO_CODE - a promotion code
- OPERATOR_ID - an agent's LIVECHAT ID (e-mail)
- PASSWORD - an agent's MD5 password
- NICK - an agent's nick
- LAST_NAME - an agent's last name
- FIRST_NAME - an agent's first name
- PHONE - an agent's phone number
- EVENT_OPERATOR_TRANSFER – a client is transfered by an agent, available parameters:
- EVENT - equal to OPERATOR_TRANSFER (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- CLIENT_ID - transferred client ID
- NEW_OPERATOR_ID - an new agent's LIVECHAT ID (e-mail)
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent that perform a transfer
- STATUS - a status of an agent that performs a transfer
- 0 = STATUS_ONLINE
- 1 = STATUS_AWAY
- 2 = STATUS_OFFLINE
- 3 = STATUS_TEXT_AVAILABLE
- 4 = STATUS_VOICE_AVAILABLE
- 5 = STATUS_INVISIBLE
- EVENT_OPERATOR_STATUS - an agent changes its status, available parameters:
- EVENT - equal to OPERATOR_STATUS (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent
- STATUS - a status of an agent
- 0 = STATUS_ONLINE
- 1 = STATUS_AWAY
- 2 = STATUS_OFFLINE
- 3 = STATUS_TEXT_AVAILABLE
- 4 = STATUS_VOICE_AVAILABLE
- 5 = STATUS_INVISIBLE
- EVENT_BUTTON_STATUS - button(s) on a web page changes its state, available parameters:
- EVENT - equal to BUTTON_STATUS (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- STATUS - equal "online" or "offline"
- EVENT_CHAT_STARTED - a new chat is started, available parameters:
- EVENT - equal to CHAT_STARTED (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- CLIENT_ID - ID of client that started a chat
- INVITING_OP - LIVECHAT ID of an agent which sent an invitation to a client (optional)
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent
- STATUS - a status of an agent
- 0 = STATUS_ONLINE
- 1 = STATUS_AWAY
- 2 = STATUS_OFFLINE
- 3 = STATUS_TEXT_AVAILABLE
- 4 = STATUS_VOICE_AVAILABLE
- 5 = STATUS_INVISIBLE
- EVENT_PRIVATE_CHAT_STATUS - a chat status is changed, available parameters:
- EVENT - equal to PRIVATE_CHAT_STATUS (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent that changed a status of a chat
- STATUS - "start" or "stop" of a private chat
- GROUP - LIVECHAT conference number
- EVENT_CLIENT_INVITED - a client is invited to a chat, available parameters:
- EVENT - equal to CLIENT_INVITED (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent which sent an invitation to a client
- CLIENT_ID - ID of client that was invited to a chat
- EVENT_OPERATOR_STOPED_CHAT - an agent stops a chat, available parameters:
- EVENT - equal to OPERATOR_STOPED_CHAT (as one script may deploy more than one events)
- LICENCE - LIVECHAT licence number
- OPERATOR_ID - LIVECHAT ID (e-mail) of an agent which stopped a chat
- GROUP - LIVECHAT conference number
