1.1개요
NEXUSCUBE 와 연동하기 위한 nxproxy_rio API 개발 가이드 입니다.
1.2구성도
1.2.1싱글모드(Single)
nxproxy_rio 가 CTI 서버와 동일한 위치에 위치하여 실행 될 때 입니다.
단일화 구성 일 때 입니다.
1.2.2이중화모드(HA)
nxproxy_rio 가 APP 서버와 동일한 위치에 위치하여 실행 될 때 입니다.
이중화 구성일 때 입니다.
nxproxy_rio 가 단독으로 위치하여 실행 될 때 입니다.
1.3브라우저 지원
기능 | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
버전 76 지원 | 6 | 4.0 (2.0) | Not supported | 11.00 (disabled) | 5.0.1 |
버전 7 지원 | Not supported | Not supported | Not supported | Not supported | |
버전 10 지원 | 14 | HTML5 Labs | ? | ? | |
표준 - RFC 6455 지원 | 16 | 11.0 (11.0) | 10 | 12.10 | 6.0 |
1.4JavaScript Sample
1.4.1접속과 해제
최초 nxproxy_rio와 연동 하기 위해 nxproxy_rio 서버의 IP 정보와 PORT 정보가 필요합니다.
login(접속)을 하게되면 connection이 유지되고 메세지를 주고받을수 있습니다.
Login을 하지 않은 상태에서는 어떠한 요청도 할 수 없습니다.
1.4.1.1Login & Logout Code Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <body> <button id="btnLogin" >Login</button> <button id="btnLogout" >Logout</button> <script> $("btnLogin").click(function(){ // nxproxy_rio 서버의 IP/PORT 정보로 WebSocket을 생성합니다. socket = new WebSocket("ws://127.0.0.1:8877"); // 정상적으로 생성이 되면 아래 onopen 이벤트가 발생됩니다. // 최초 login 메세지를 보내 id 인증을 요청합니다. // JQuery를 이용하여 메세지를 생성하여 발신합니다. // *자세한 필드 값은 본문 [Interface장] 에서 확인하시기 바랍니다. socket.onopen = function() { var login = new Object(); login.fname = "login"; login.id = "cube"; login.pwd = "cube123"; socket.send(JSON.stringify(login)); }; // onmessage는 서버로 부터 수신되는 메시지 이벤트 입니다. // 주로 호출(socket.send())에 대한 response와 event message가 있습니다. // 최초 login message를 보내면 결과를 수신 할 수 있습니다. // JSON을 이용하여 메시지를 수신하고 login에 대한 결과를 확인합니다. socket.onmessage = function(message) { console.log( message.data ); } // connection이 정상 종료가 되면 onclose를 발생합니다. socket.onclose = function() { console.log("Closed socket. "); }; // connection 이 비정상 종료가 되면 onerror 를 발생합니다. // 이때는 client 에서 재접속이 필요합니다. socket.onerror = function() { console.log("Error during transfer. "); }; }); // logout 메시지를 생성하여 서버로 logout 요청을 합니다. $("#btnLogout").click(function() { var logout = new Object(); logout.fname = "logout"; logout.id = "cube"; socket.send(JSON.stringify(logout)); }); </script> </body> </html>
1.4.2Monitor 등록 및 해제
Device를 Monitor 등록 하지 않으면 이벤트를 수신 할 수 없습니다.
Call / Queue 혹은 Agent 사용 시 해당 Device 번호를 Monitor 등록/해제 요청 하시기 바랍니다.
1.4.2.1addMonitor & removeMonitor Code Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 이 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <body> <button id="btnAddMonitor" >AddMonitor</button> <button id="btnRemoveMonitor" >removeMonitor</button> <script> //등록 할 Device 번호로 메시지를 생성하여 요청합니다. $("#btnAddMonitor").click(function() { var addmonitor = new Object(); addmonitor.fname = "addmonitor"; addmonitor.device = "1001"; socket.send(JSON.stringify(addmonitor)); }); //이벤트 수신의 종료를 원할 때 해제 하시기 바랍니다. //해제 할 Device 번호로 메시지를 생성하여 요청합니다. $("#btnRemoveMonitor").click(function() { var removemonitor = new Object(); removemonitor.fname = "removemonitor"; removemonitor.device = "1001"; socket.send(JSON.stringify(removemonitor)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "addmonitor"){ console.log("addmonitor 결과 : " + json.result ); } if(json.fname == "removemonitor"){ console.log("removemonitor결과 : " + json.result ); } }
1.4.3에이전트 상태 변경
에이전트의 상태 변경 예제 코드입니다.
1.4.3.1Logon Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor 가 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <body> <button id="btnLogon" >Logon</button> <script> // 상태를 변경 할 Dn 번호와 에이전트 정보로 메시지를 생성하여 요청합니다. $("#btnLogon").click(function() { var logon = new Object(); logon.fname = "logon"; logon.this = "1001"; var agent = new Object(); agent.id = "1001"; agent.group = "401"; agent.channel = "0"; agent.wmode = "1"; logon.agent = agent; socket.send(JSON.stringify(logon)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "logon"){ console.log("상태변경 결과 : " + json.result ); } }
// onmessage에서 이벤트 수신을 확인하여 상태를 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 201 : //201 은 LoggedOn 상태 코드 입니다. console.log("Logon 상태 입니다. "); break; } } }
1.4.3.2Logoff Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor 가 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <body> <button id="btnLogoff">Logoff</button> <script> // 상태를 변경 할 Dn 번호와 에이전트 정보로 메시지를 생성하여 요청합니다. $("#btnLogoff").click(function() { var logoff = new Object(); logoff.fname = "logoff"; logoff.this = "1001"; var agent = new Object(); agent.id = "1001"; agent.reason = "0"; logoff.agent = agent; socket.send(JSON.stringify(logoff)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "logoff"){ console.log("상태변경 결과 : " + json.result ); } }
// onmessage에서 이벤트 수신을 확인하여 상태를 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 202 : //202 는 LoggedOff 상태 코드 입니다. console.log("Logoff 상태 입니다. "); break; } } }
1.4.3.3Ready Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor 그리고 Logon 이 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <body> <button id="btnReady">Ready</button> <script> // 상태를 변경 할 Dn 번호와 에이전트 정보로 메시지를 생성하여 요청합니다. $("#btnReady").click(function() { var ready = new Object(); ready.fname = "ready"; ready.this = "1001"; var agent = new Object(); agent.id = "1001"; agent.reason = "0"; ready.agent = agent; socket.send(JSON.stringify(ready)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "ready"){ console.log("상태변경 결과 : " + json.result ); } }
// onmessage에서 이벤트 수신을 확인하여 상태를 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 204 : //204 는 ready 상태 코드 입니다. console.log("Ready 상태 입니다. "); break; } } }
1.4.3.4Not Ready Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor 그리고 Logon 이 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <body> <button id="btnNotready">NotReady</button> <script> // 상태를 변경 할 Dn 번호와 에이전트 정보로 메시지를 생성하여 요청합니다. $("#btnNotready").click(function() { var notready = new Object(); notready.fname = "notready"; notready.this = "1001"; var agent = new Object(); agent.id = "1001"; agent.reason = "0"; notready.agent = agent; socket.send(JSON.stringify(notready)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "notready"){ console.log("상태변경 결과 : " + json.result ); } }
// onmessage에서 이벤트 수신을 확인하여 상태를 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 203 : //203 은 Not ready 상태 코드 입니다. console.log("Not Ready 상태 입니다. "); break; } } }
1.4.3.5After Work Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor 그리고 Logon 이 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> <body> <button id="btnAfterwork">AfterWork</button> <script> // 상태를 변경 할 Dn 번호와 에이전트 정보로 메시지를 생성하여 요청합니다. $("#btnAfterwork").click(function() { var afterwork = new Object(); afterwork.fname = "afterwork"; afterwork.this = "1001"; var agent = new Object(); agent.id = "1001"; agent.reason = "0"; afterwork.agent = agent; socket.send(JSON.stringify(afterwork)); }); </script> </body> </html>
// 결과는 onmessage에서 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "afterwork"){ console.log("상태변경 결과 : " + json.result ); } }
// onmessage에서 이벤트 수신을 확인하여 상태를 확인 할 수 있습니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 206 : //206 은 After Work 상태 코드 입니다. console.log("After Work 상태 입니다. "); break; } } }
1.4.4호 발신 및 수신, 종료
호 발신 방법과 수신에 대한 예제 코드입니다.
예로서 발신자는 1001번 이며 수신자는 1002번 입니다.
1.4.4.1Dial Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.- 위의 Login 과 addMornitor이 선행 되어야 합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnDial" >Dial</button> <script> //등록 할 Device 번호로 메시지를 생성하여 요청합니다. $("#btnDial").click(function() { var dial = new Object(); dial.fname = "dial"; dial.this = "1001"; dial.called = "1002"; dial.uui = "user to user information data"; var attach = new Object(); attach.uei= "user extend information data"; attach.ci= "campaign information data"; dial.attach = attach; socket.send(JSON.stringify(dial)); }); </script> </body> </html>
//onmessage에서 이벤트 수신을 확인하여 //Delivered 이벤트 (전화 발신성공 : 링이 울리는 상태) 를 확인 합니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 4 : //4 는 Delivered 이벤트 코드 입니다. if( json.monitor == json.call.other ){ console.log("호가 발신 되었습니다."); } break; } } }
1.4.4.2Answer Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Delivered (수신) 이벤트 상태에서 가능합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnAnswer" >Answer</button> <script> // Delivered 이벤트 상태에서 Answer 버튼을 클릭하여 전화 받기를 요청합니다. // 요청이 성공 하면 Established (호 연결) 이벤트가 발생 됩니다. $("#btnAnswer").click(function() { var answer = new Object(); answer.fname = "answer"; answer.this = "1001"; // 수신된 Delivered 이벤트에서 Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. answer.c1 = "1"; socket.send(JSON.stringify(answer)); }); </script> </body> </html>
// 전화받기 answer를 요청하면Established 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 6 : //6 은 Established 이벤트 코드 입니다. console.log("호가 연결 되었습니다."); break; } } }
1.4.4.3Clear Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Established(통화 중) 이벤트 상태에서 가능합니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnClear" >Clear</button> <script> // Established 이벤트 상태에서 Clear 버튼을 클릭하여 전화 끊기를 요청합니다. // 요청이 성공 하면 ConnectionCleared (호 끊김) 이벤트가 발생 됩니다. $("#btnClear").click(function() { var clear = new Object(); clear.fname = "clear"; clear.this = "1001"; // 수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. clear.c1 = "1"; socket.send(JSON.stringify(clear)); }); </script> </body> </html>
// 전화끊기 clear를 요청하면ConnectionCleared 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 3 : //3 은 ConnectionCleared이벤트 코드 입니다. console.log("호가 종료 되었습니다."); break; } } }
1.4.5보류 및 회수
1.4.5.1Hold Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Established (통화 중) 이벤트 상태에서 가능합니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnHold" >Hold</button> <script> // Established 이벤트 상태에서 Hold 버튼을 클릭하여 통화 보류를 요청합니다. // 요청이 성공 하면 Held (통화 보류) 이벤트가 발생 됩니다. $("#btnHold").click(function() { var hold= new Object(); hold.fname = "hold"; hold.this = "1001"; //수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. hold.c1 = "1"; socket.send(JSON.stringify(hold)); }); </script> </body> </html>
// 통화 보류 hold 를 요청하면held 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 8 : //8 은 held 이벤트 코드 입니다. console.log("호가 보류 되었습니다."); break; } } }
1.4.5.2Retrieve Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Held (호 보류) 이벤트 상태에서 가능합니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnRetrieve" >Retrieve</button> <script> // Held 이벤트 상태에서Retrieve 버튼을 클릭하여 통화 회수를 요청합니다. // 요청이 성공 하면 retreived (호 회수) 이벤트가 발생 됩니다. $("#btnRetrieve").click(function() { var retrieve = new Object(); retrieve.fname = "retrieve"; retrieve.this = "1001"; // 수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. retrieve c1 = "1"; socket.send(JSON.stringify(retrieve)); }); </script> </body> </html>
// 호 회수 retrieve를 요청하면 Retrieved 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 12 : //12 은 Retrieved 이벤트 코드 입니다. console.log("호가 회수 되었습니다."); break; } } }
1.4.6협의, 전환, 회의
1.4.6.1Consult Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Established (통화 중) 이벤트 상태에서 가능합니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnConsult" >Consult</button> <script> // Established 이벤트 상태에서 Consult 버튼을 클릭하여 협의 통화를 요청합니다. // 요청이 성공 하면 Delivered (전화 연결) 이벤트가 발생 됩니다. $("#btnConsult").click(function() { var consult = new Object(); consult.fname = "consult"; consult.this = "1001"; // 수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. consult.c1 = "1"; consult.called = "1002"; consult.mode = "0"; //mode 0 : Transfer , mode 1 : Confer consult.uui = "user to user information data"; var attach = new Object(); attach.uei = "user extend information data"; attach.ci = "campaign information data"; consult.attach = attach; socket.send(JSON.stringify(consult)); }); </script> </body> </html>
// 협의 통화 Consult 가 성공되면 Ctype = 4로 들어오는 협의 Delivered 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( event.id ){ case 4 : //4 는 Delivered 이벤트 코드 입니다. if ( json.ctype == 4){ //협의 요청 시 if( json.monitor == json.call.other ) //협의 발신 시 console.log("협의 호가 발신 되었습니다."); else //협의 수신 시 console.log("협의 호가 수신 되었습니다."); } break; } } }
1.4.6.2Transfer Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Consult ( mode : 0 )요청 후Established (통화 중) 이벤트 상태에서 가능합니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnTransfer" >Transfer</button> <script> // Consult (mode : 0 ) 요청 후 Established(협의 통화 중) 상태에서 Transfer 버튼을 클릭하여 전환 통화를 요청합니다. // 요청이 성공 하면 Transferred (전환) 이벤트가 발생 됩니다. $("#btnTransfer").click(function() { var transfer = new Object(); transfer.fname = "transfer"; transfer.this = "1001"; // 수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. transfer.c1 = "1"; transfer.held = "1002"; //held 이벤트에서 추출한 Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. transfer.c2 = "2"; socket.send(JSON.stringify(transfer)); }); </script> </body> </html>
// 전환 통화 Trensfer 가 성공되면 Transferred 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( event.id ){ case 14 : //14 는 Transferred 이벤트 코드 입니다. console.log("Transferred 이벤트 입니다."); break; } } }
1.4.6.3Confer Sample
- 해당 Sample Code에는 Jquery2.x 가 사용 되었습니다.
- Consult ( mode : 1 )요청 후Established (통화) 이벤트 상태에서 가능합니다
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script> </head> <button id="btnConfer" >Confer</button> <script> // Consult ( mode : 1 ) 요청 후 Established 이벤트 상태에서 Confer 버튼을 클릭하여 회의 통화를 요청합니다. // 요청이 성공 하면 Conferenced(회의 통화) 이벤트가 발생 됩니다. $("#btnConfer").click(function() { var confer = new Object(); confer.fname = "confer"; confer.this = "1001"; // 수신된 이벤트에서 통화중인(Delivered or Established) Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. confer.c1 = "1"; confer.held = "1002"; //held 이벤트에서 추출한 Call ID (event.call.c1) 값을 이용 할 수 있도록 합니다. confer.c2 = "2"; socket.send(JSON.stringify(confer)); }); </script> </body> </html>
// 회의 통화 Confer 가 성공되면 Conferenced 이벤트가 발생됩니다. socket.onmessage = function(message){ var json = $.parseJSON(message.data); if(json.fname == "event"){ switch( json.id ){ case 2 : //2 는 Conferenced 이벤트 코드 입니다. console.log("Conferenced 이벤트 입니다."); break; } } }
1.5Interface (Json)
* Interface의 Type과 Range는 버전에 따라 변경 될 수 있습니다.
1.5.1정의
object { Key : Value, Key : Value }
object { Key : Value, Key : obejct { Key : Value } }
1.5.1.1사용 예
1.5.1.1.1case1
request Message(Add Monitor)
{ "fname":"addmonitor", "device":"1001" }
1.5.1.1.2case2
response Message
{ "fname":"addmonitor", "device":"1001", "result":"1" }
1.5.1.1.3case3
request Message(dial)
{ "fname":"dial", "this":"1001", "called":"1002", "uui":"User2UserInfo", "attach": { "uei":"ueisize1024", "ci":"cisize1024" } }
1.5.1.1.4case4
response Message
{ "fname":"dial", "this":"1001", "called":"1002", "uui":"User to User Information Data", "attach": { "uei":"User Extend Information Data", "ci":"Campaign Information Data" }, "result":"2011" }
1.5.2Session
1.5.2.1Login
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | login | M | String | 서비스 이름 |
Id | 24(한글,특수문자 제외) | M | String | 유저 아이디 | |
pwd | M | String | 유저 비밀번호 | ||
response | request messagem | ||||
result | 1 | Integer | 결과 |
1.5.2.2logout
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | logout | M | String | 서비스 이름 |
id | 24(한글,특수문자 제외) | M | String | 유저 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.2.3addMonitor
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | addmonitor | M | String | 서비스 이름 |
device | 64 | M | String | 모니터 등록 요청 Device | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.2.4removeMonitor
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | removemonitor | M | String | 서비스 이름 |
device | 64 | M | String | 모니터 해제 요청 Device | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3Switch
1.5.3.1dial
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | dial | M | String | 서비스 이름 | |
this | 64 | M | String | 발신자 번호 | ||
called | 64 | M | String | 수신자 번호 | ||
uui | 256 | O | String | User to User Information Data | ||
attach | uei | 1024 | O | String | User Extend Information Data | |
ci | 1024 | O | String | Campaign Information Data | ||
response | request messageo | |||||
result | 1 | Integer | 결과 |
1.5.3.2answer
key | range | M/O | type | desc | |
---|---|---|---|---|---|
Request | fname | answer | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3.3clear
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | clear | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3.4hold
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | hold | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3.5retrieve
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | retrieve | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3.6singletransfer
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | sstransfer | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | ||
called | 64 | M | String | 협의 대상자 번호 | ||
uui | 256 | O | String | User to User Information Data | ||
attach | uei | 1024 | O | String | User Extend Information Data | |
ci | 1024 | O | String | Campaign Information Data | ||
response | request messagem | |||||
result | 1 | Integer | 결과 |
1.5.3.7consult
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | consult | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
c1 | 0 < n < 32767 | M | Integer | 콜 아이디 | ||
called | 64 | M | String | 협의 대상자 번호 | ||
mode | 0 / 1 | M | Integer | 0=TRANSFER / 1=CONFERENCE | ||
uui | 256 | O | String | User to User Information Data | ||
attach | uei | 1024 | O | String | User Extend Information Data | |
ci | 1024 byte | O | String | Campaign Information Data | ||
response | request message | |||||
result | 1 | Integer | 결과 |
1.5.3.8confer
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | confer | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | Active 콜 아이디 | |
held | 64 | M | String | Held 대상자 번호 | |
c2 | 0 < n < 32767 | M | Integer | Held 콜 아이디 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.3.9transfer
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | transfer | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
c1 | 0 < n < 32767 | M | Integer | Active 콜 아이디 | |
held | 64 | M | String | Held 대상자 번호 | |
c2 | 0 < n < 32767 | M | Integer | Held 콜 아이디 | |
response | request messagem | ||||
result | 1 | Integer | 결과 |
1.5.3.10bargein
key | range | M/O | type | desc | |
---|---|---|---|---|---|
request | fname | bargein | M | String | 서비스 이름 |
this | 64 | M | String | 수신자 번호 | |
called | 0 < n < 2^31 | M | String | 감청 대상자 번호 | |
response | request message | ||||
result | 1 | Integer | 결과 |
1.5.4Agent
1.5.4.1logon
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | logon | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
agent | id | 64 | M | String | agent ID | |
group | 0 < n < 10^6 | M | String | 그룹 | ||
channel | 0 <= n < 8 | M | String | 로그인 채널 voice = 0 twitter = 1 facebook = 2 reserved = 3 chat = 4 video = 5 email = 6 fax = 7 | ||
wmode | 0 < n < 5 | M | Integer | AUX_WORK = 1 AFTCAL_WK = 2 AUTO_IN = 3 MANUAL_IN = 4 | ||
response | request message | |||||
result | 1 | Integer | 결과 |
1.5.4.2logoff
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | logoff | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
agent | id | 64 | M | String | agent ID | |
group | 0 < n < 10^6 | M | String | 그룹 | ||
reason | 0< n <= 9 | M | String | 사유 코드 | ||
response | request message | |||||
result | 1 | Integer | 결과 |
1.5.4.3notready
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | notready | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
agent | id | 64 | M | String | agent ID | |
reason | 0< n <= 9 | M | String | 사유 코드 | ||
response | request message | |||||
result | 1 | Integer | 결과 |
1.5.4.4ready
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | ready | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
agent | id | 64 | M | String | agent ID | |
reason | 0< n <= 9 | M | String | 사유 코드 | ||
response | request message | |||||
result | 1 | Integer | 결과 |
1.5.4.5afterwork
key | range | M/O | type | desc | ||
---|---|---|---|---|---|---|
request | fname | afterwork | M | String | 서비스 이름 | |
this | 64 | M | String | 수신자 번호 | ||
agent | id | 64 | M | String | agent ID | |
reason | 0< n <= 9 | M | String | 사유 코드 | ||
response | request messagem | |||||
result | 1 | Integer | 결과 |
1.5.5Event
1.5.5.1Event
key | type | desc | ||
---|---|---|---|---|
event | fname | String | event (고정값) | |
id | Integer | 이벤트 번호 | ||
msid | Integer | 미디어 번호 | ||
this | String | 이벤트 대상 번호 | ||
cnid | String | 콜 고유 번호 | ||
cnsq | Integer | 콜 고유 번호 시퀀스 | ||
tag | Integer | |||
ftime | String | 서버 이벤트 발행 시간 yyyy/mm/dd/hh/mm/ss/msec 2016/02/04 15:28:43.01 | ||
call | c1 | Integer | Call의 reference ID | |
c2 | Integer | Call이 변경 되었을 경우 첫번째 Call ID | ||
c3 | Integer | Call이 변경 되었을 경우 두번째 Call ID | ||
cause | Integer | Event Cause | ||
ctype | Integer | 콜 타입1 : Inbound 2 : Outbound 3 : Internal 4 : Consult 5 : Transfer 6 : Conference | ||
ohter | Integer | Calling Device가 MonitorParty와 다를 때 Calling Device (ANI) | ||
third | Integer | Calling Device가 monitor와 같을 때의 Calling Device | ||
called | Integer | 회의 또는 전환 호일 때 협의를 시도한 Device | ||
origin | Integer | Inbound Call에 대한 교환기의 entry point 또는 Outbound Call에 대한 교환기의 exit point | ||
uui | String | User to User Information Data | ||
queue | dn | Integer | Queue 번호 | |
wqueue | Integer | Queue에 대기중인 호의 개수 | ||
wtime | Integer | Queue에 대기중인 호의 대기시간 | ||
attach | uei | Integer | User Extend Information Data | |
ci | Integer | Campaign Information Data | ||
agent | id | String | Agent ID | |
reason | Integer | 사유 코드 | ||
wmode | Integer | 로그인시 설정된 Work Mode |
1.6ErrorCode
1.6.1nxproxy
1.6.1.1rio에 대한 ErrorCode 정의
name | value | desc |
---|---|---|
SUCCSSS | 1 | 성공 |
NOT_SUPPORT | -4001 | 알수 없는 서비스명 |
RESPONSE_FAIL | -4005 | 응답실패 |
TIME_OUT | -4006 | 응답타임아웃 |
LOGIN_FAIL | -4007 | 로그인 실패 |
BAD_LOGIN | -4008 | 유효하지 않은 세션 (로그인 상태 아님) |
MONITOR_ADD_FALL | -4009 | 모니터 추가 실패 |
INVALID_JSON_TYPE | -4010 | Json 형식 에러 |
INVALID_PARAMS | -4011 | 필수 값 누락 |
SERVER_UNKNOWN | -4901 | 미들웨어 연결 안됨 |
1.6.2Web Socket
1.6.2.1Web Socket에 대한 ErrorCode 정의
name | value | desc |
---|---|---|
CLOSE_NORMAL | 1000 | Normal closure; the connection successfully completed whatever purpose for which it was created. |
CLOSE_GOING_AWAY | 1001 | The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection. |
CLOSE_PROTOCOL_ERROR | 1002 | The endpoint is terminating the connection due to a protocol error. |
CLOSE_UNSUPPORTED | 1003 | The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data). |
CLOSE_NO_STATUS | 1005 | Reserved. Indicates that no status code was provided even though one was expected. |
CLOSE_ABNORMAL | 1006 | Reserved. Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected. |
Unsupported Data | 1007 | The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message). |
Policy Violation | 1008 | The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable. |
CLOSE_TOO_LARGE | 1009 | The endpoint is terminating the connection because a data frame was received that is too large. |
Missing Extension | 1010 | The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't. |
Internal Error | 1011 | The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. |
Service Restart | 1012 | The server is terminating the connection because it is restarting. |
Try Again Later | 1013 | The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. |
1014 | ||
TLS Handshake | 1015 | Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified). |
http://tools.ietf.org/html/rfc6455#section-7.4.1 ( 참고 URL )