Example 2. Set property values
This is a sample program demonstrating how to set property values using string arrays of property names and property values:
<script> var socket = null; var host = 'ws://192.168.200.10:18080/pbx/ws?tenant=test&login_user=1000&login_password=1000'; if('WebSocket' in window){ socket = new WebSocket(host); }else if('MozWebSocket' in window){ socket = new MozWebSocket(host); } socket.onmessage = function(event){ var response = JSON.parse(event.data); var properties = {"name":"0001", "desc":"admin", "language":"en", "login.password":"0001", "admin":"true"}; var request = '{"jsonrpc": "2.0", "method": "setExtensionProperties", "params": {"extension": "0001", "properties": properties}, "id":1}; var json_request = JSON.stringify(request); socket.send(json_request); switch(response['id']){ case '1': console.log(response['result']); break; } } </script>