Hello,
Is it still possible to use the websocket API to listen the status updates of the endpoints ? Indeed, endpoint_status_update has been removed from the published messaged in V19.05.
Regards,
Adrien
Hello,
Is it still possible to use the websocket API to listen the status updates of the endpoints ? Indeed, endpoint_status_update has been removed from the published messaged in V19.05.
Regards,
Adrien
Hello,
We changed the events in the bus for presences, lines, trunk etc … For the line of an endpoint the event is line_status_updated. Is it what you are looking for?
Hello,
Does it work only for the owner of the line, or can an admin user listen for the change in status of all the lines of his tenant ?
nope, an API user with the good ACL have access to this information if you want to program a soft.
Oh, wait looks like we missed something with lines events to get it on websocketd. I just made a test, i’ll check.
Ok, so i did a test and yes it missed something on websocketd. You can patch it if you want.
On /usr/lib/python3/dist-packages/wazo_websocketd/bus.py it miss lines.# for the routing keys accepted. I did a PR to fix that.
But with this patch, it works for me.
Please note this is to get event for register. or unregister event in a line or on a new call. Is it what you are looking for?
OK, thanks Sylvain for this update (je m’arrachais les cheveux à tester ça). I will test it as soon as possible, but I have a lot of work during the day. I am using wazo for my company, which sales spare parts to farmers. When our clients dial our phone, the call is dispatch on all the users via a queue. However, with the new version, only the main line of a user rings. Therefore I need to detect which line is registered to promote it as main line via the API, or to redirect the call. Before being able to code that, I will make the status of all the lines available to my 4 employees, to facilitate the transfer of the calls between people.
OK Sylvain, I made the modif and now I get the registered / unregistered event.
Thanks for the support,
Adrien
Hello Sylvain,
Could you please have a look at wazo-chatd again, in V20.07, the presence_initialization revert with fail status. I have tried with the console of the documentation to be sure that the problem was not coming from my code. I have the problem with 2 different installation of wazo. Unfortunately, I haven’t kept a copy of the VM in V20.06.
Your result is from the endpoint status in chatd?
Indeed
Can you restart wazo-chatd and attach log here (/var/log/wazo-chatd.log
)?
systemctl restart wazo-chatd
After restarting wazo-chatd only it works! I tried to restart the server, to restart wazo-service without success. Thanks for the advise. I will look after the logs to check if something is causing this API to stop. We are doing a lot of requests with the web application we are developping to provide a global view of the lines.
Adrien
OK, once chatd is restarted, it only works for one API call. I get the status of all the users/lines for example. Then, I get the erro “presence not initialized”.
Where should I check what is causing the API to crash? I have this in wazo-chatd.log
2020-07-07 14:53:09,423 [21224] (WARNING) (wazo_chatd.controller): Stopping wazo-chatd: SIGTERM
2020-07-07 14:54:46,991 [5148] (INFO) (wazo_chatd.controller): wazo-chatd starting…
2020-07-07 14:54:47,010 [5148] (INFO) (wazo_chatd.bus): Running AMQP consumer
2020-07-07 14:54:47,028 [5148] (INFO) (service_discovery): Registering wazo-chatd on Consul as xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx with 000.000.00.000:9304
2020-07-07 14:54:47,129 [5148] (INFO) (kombu.mixins): Connected to amqp://guest:**@127.0.0.1:5672//
2020-07-07 14:54:48,616 [5148] (INFO) (flask.app): request: OPTIONS http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘Access-Control-Request-Method’: ‘GET’, ‘Access-Control-Request-Headers’: ‘x-auth-token’, ‘Accept’: ‘/’, ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Language’: ‘fr-fr’, ‘Accept-Encoding’: ‘gzip, deflate, br’, ‘Content-Length’: ‘0’}
2020-07-07 14:54:48,624 [5148] (INFO) (flask.app): response: (127.0.0.1) OPTIONS http://www.xxxx.zzz/1.0/users/presences 200
2020-07-07 14:54:48,663 [5148] (INFO) (flask.app): request: GET http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘X-Auth-Token’: ‘XXXXXXXX-XXXX-XXXX-XXXX-XXXX506edd71’, ‘Accept’: ‘application/json’, ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Accept-Language’: ‘fr-fr’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Encoding’: ‘gzip, deflate, br’}
2020-07-07 14:54:48,795 [5148] (ERROR) (xivo.rest_api_helpers): Presences are not initialized: {}
2020-07-07 14:54:48,808 [5148] (INFO) (flask.app): response: (127.0.0.1) GET http://www.xxxx.zzz/1.0/users/presences 503
2020-07-07 14:54:52,757 [5148] (ERROR) (STDERR): Exception in thread presence_initialization:
2020-07-07 14:54:52,758 [5148] (ERROR) (STDERR): Traceback (most recent call last):
2020-07-07 14:54:52,758 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/urllib3/response.py”, line 360, in _error_catcher
2020-07-07 14:54:52,759 [5148] (ERROR) (STDERR): yield
2020-07-07 14:54:52,759 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/urllib3/response.py”, line 442, in read
2020-07-07 14:54:52,760 [5148] (ERROR) (STDERR): data = self._fp.read(amt)
2020-07-07 14:54:52,760 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/http/client.py”, line 457, in read
2020-07-07 14:54:52,761 [5148] (ERROR) (STDERR): n = self.readinto(b)
2020-07-07 14:54:52,761 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/http/client.py”, line 501, in readinto
2020-07-07 14:54:52,762 [5148] (ERROR) (STDERR): n = self.fp.readinto(b)
2020-07-07 14:54:52,763 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/socket.py”, line 589, in readinto
2020-07-07 14:54:52,763 [5148] (ERROR) (STDERR): return self._sock.recv_into(b)
2020-07-07 14:54:52,764 [5148] (ERROR) (STDERR): ConnectionResetError: [Errno 104] Connection reset by peer
2020-07-07 14:54:52,765 [5148] (ERROR) (STDERR):
2020-07-07 14:54:52,765 [5148] (ERROR) (STDERR): During handling of the above exception, another exception occurred:
2020-07-07 14:54:52,767 [5148] (ERROR) (STDERR):
2020-07-07 14:54:52,768 [5148] (ERROR) (STDERR): Traceback (most recent call last):
2020-07-07 14:54:52,768 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/models.py”, line 750, in generate
2020-07-07 14:54:52,769 [5148] (ERROR) (STDERR): for chunk in self.raw.stream(chunk_size, decode_content=True):
2020-07-07 14:54:52,769 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/urllib3/response.py”, line 494, in stream
2020-07-07 14:54:52,770 [5148] (ERROR) (STDERR): data = self.read(amt=amt, decode_content=decode_content)
2020-07-07 14:54:52,771 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/urllib3/response.py”, line 459, in read
2020-07-07 14:54:52,771 [5148] (ERROR) (STDERR): raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
2020-07-07 14:54:52,771 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/contextlib.py”, line 130, in exit
2020-07-07 14:54:52,772 [5148] (ERROR) (STDERR): self.gen.throw(type, value, traceback)
2020-07-07 14:54:52,772 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/urllib3/response.py”, line 378, in _error_catcher
2020-07-07 14:54:52,773 [5148] (ERROR) (STDERR): raise ProtocolError(‘Connection broken: %r’ % e, e)
2020-07-07 14:54:52,773 [5148] (ERROR) (STDERR): urllib3.exceptions.ProtocolError: (“Connection broken: ConnectionResetError(104, ‘Connection reset by peer’)”, ConnectionResetError(104, ‘Connection reset by peer’))
2020-07-07 14:54:52,773 [5148] (ERROR) (STDERR):
2020-07-07 14:54:52,774 [5148] (ERROR) (STDERR): During handling of the above exception, another exception occurred:
2020-07-07 14:54:52,774 [5148] (ERROR) (STDERR):
2020-07-07 14:54:52,775 [5148] (ERROR) (STDERR): Traceback (most recent call last):
2020-07-07 14:54:52,775 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
2020-07-07 14:54:52,775 [5148] (ERROR) (STDERR): self.run()
2020-07-07 14:54:52,776 [5148] (ERROR) (STDERR): File “/usr/lib/python3.7/threading.py”, line 865, in run
2020-07-07 14:54:52,776 [5148] (ERROR) (STDERR): self._target(self._args, **self._kwargs)
2020-07-07 14:54:52,779 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/wazo_chatd/plugins/presences/initiator_thread.py”, line 39, in _run
2020-07-07 14:54:52,779 [5148] (ERROR) (STDERR): self._initiate()
2020-07-07 14:54:52,780 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/wazo_chatd/plugins/presences/initiator_thread.py”, line 50, in _initiate
2020-07-07 14:54:52,780 [5148] (ERROR) (STDERR): self._initiator.initiate()
2020-07-07 14:54:52,781 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/wazo_chatd/plugins/presences/initiator.py”, line 99, in initiate
2020-07-07 14:54:52,781 [5148] (ERROR) (STDERR): users = self._confd.users.list(recurse=True)[‘items’]
2020-07-07 14:54:52,782 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/wazo_confd_client/crud.py”, line 70, in list
2020-07-07 14:54:52,782 [5148] (ERROR) (STDERR): response = self.session.get(url, headers=headers, params=kwargs)
2020-07-07 14:54:52,783 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/wazo_confd_client/session.py”, line 53, in get
2020-07-07 14:54:52,784 [5148] (ERROR) (STDERR): response = self.session.get(url, **kwargs)
2020-07-07 14:54:52,784 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 546, in get
2020-07-07 14:54:52,785 [5148] (ERROR) (STDERR): return self.request(‘GET’, url, **kwargs)
2020-07-07 14:54:52,785 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 533, in request
2020-07-07 14:54:52,786 [5148] (ERROR) (STDERR): resp = self.send(prep, **send_kwargs)
2020-07-07 14:54:52,786 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/sessions.py”, line 686, in send
2020-07-07 14:54:52,787 [5148] (ERROR) (STDERR): r.content
2020-07-07 14:54:52,787 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/models.py”, line 828, in content
2020-07-07 14:54:52,788 [5148] (ERROR) (STDERR): self._content = b’‘.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b’’
2020-07-07 14:54:52,788 [5148] (ERROR) (STDERR): File “/usr/lib/python3/dist-packages/requests/models.py”, line 753, in generate
2020-07-07 14:54:52,790 [5148] (ERROR) (STDERR): raise ChunkedEncodingError(e)
2020-07-07 14:54:52,791 [5148] (ERROR) (STDERR): requests.exceptions.ChunkedEncodingError: (“Connection broken: ConnectionResetError(104, ‘Connection reset by peer’)”, ConnectionResetError(104, ‘Connection reset by peer’))
2020-07-07 14:55:09,979 [5148] (INFO) (flask.app): request: OPTIONS http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘Access-Control-Request-Method’: ‘GET’, ‘Access-Control-Request-Headers’: ‘x-auth-token’, ‘Accept’: '/', ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Language’: ‘fr-fr’, ‘Accept-Encoding’: ‘gzip, deflate, br’, ‘Content-Length’: ‘0’}
2020-07-07 14:55:09,985 [5148] (INFO) (flask.app): response: (127.0.0.1) OPTIONS http://www.xxxx.zzz/1.0/users/presences 200
2020-07-07 14:55:10,028 [5148] (INFO) (flask.app): request: GET http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘X-Auth-Token’: ‘XXXXXXXX-XXXX-XXXX-XXXX-XXXX506edd71’, ‘Accept’: ‘application/json’, ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Accept-Language’: ‘fr-fr’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Encoding’: ‘gzip, deflate, br’}
2020-07-07 14:55:10,132 [5148] (ERROR) (xivo.rest_api_helpers): Presences are not initialized: {}
2020-07-07 14:55:10,138 [5148] (INFO) (flask.app): response: (127.0.0.1) GET http://www.xxxx.zzz/1.0/users/presences 503
2020-07-07 14:55:40,027 [5148] (INFO) (flask.app): request: OPTIONS http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘Access-Control-Request-Method’: ‘GET’, ‘Access-Control-Request-Headers’: ‘x-auth-token’, ‘Accept’: '/', ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Language’: ‘fr-fr’, ‘Accept-Encoding’: ‘gzip, deflate, br’, ‘Content-Length’: ‘0’}
2020-07-07 14:55:40,030 [5148] (INFO) (flask.app): response: (127.0.0.1) OPTIONS http://www.xxxx.zzz/1.0/users/presences 200
2020-07-07 14:55:40,085 [5148] (INFO) (flask.app): request: GET http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘X-Auth-Token’: ‘XXXXXXXX-XXXX-XXXX-XXXX-XXXX506edd71’, ‘Accept’: ‘application/json’, ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Accept-Language’: ‘fr-fr’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Encoding’: ‘gzip, deflate, br’}
2020-07-07 14:55:40,171 [5148] (ERROR) (xivo.rest_api_helpers): Presences are not initialized: {}
2020-07-07 14:55:40,176 [5148] (INFO) (flask.app): response: (127.0.0.1) GET http://www.xxxx.zzz/1.0/users/presences 503
2020-07-07 14:56:52,122 [5148] (INFO) (flask.app): request: OPTIONS http://www.xxxx.zzz/1.0/users/presences {‘Host’: ‘www.xxxx.zzz’, ‘X-Script-Name’: ‘/api/chatd’, ‘X-Forwarded-For’: ‘00.000.00.000’, ‘Connection’: ‘close’, ‘Origin’: ‘http://localhost:3000’, ‘Access-Control-Request-Method’: ‘GET’, ‘Access-Control-Request-Headers’: ‘x-auth-token’, ‘Accept’: '/*', ‘User-Agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15’, ‘Referer’: ‘http://localhost:3000/’, ‘Accept-Language’: ‘fr-fr’, ‘Accept-Encoding’: ‘gzip, deflate, br’, ‘Content-Length’: ‘0’}
2020-07-07 14:56:52,135 [5148] (INFO) (flask.app): response: (127.0.0.1) OPTIONS http://www.xxxx.zzz/1.0/users/presences 200
Adrien