-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WP-1275: call park api #309
Conversation
Build failed. ✔️ tox-linters SUCCESS in 6m 48s |
Tests failed because it didnt use wazo-test-helpers updated image that supports parking mocks. wazo-test-helpers will need to be merged first |
Build failed. ✔️ tox-linters SUCCESS in 6m 59s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️ If we start to use typing, then mypy should be adding in linters
✔️ edit: We must listen on parking_lot_edited
instead of parking_lot_updated
✔️ edit2: changelog is missing for the new parked
options for calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The endpoint to unpark a call is missing: need to be discussed
edit: after discussion, no use case for now
# If call is already parked, preserve callback | ||
park_payload['TimeoutChannel'] = parked_call.parker_dial_string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If call is already parked, should we just thrown an exception?
(I didn't test) Swapping feature seems a dedicate endpoint to me, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more related to reparking a call since it wont leave the parking. We could throw an exception to prevent a call from being reparked, but reparking allows to update timeout for instance. A call can also be reparked in the same space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️ When testing on my wazo, I get a OverflowError
2024-03-20 17:56:07,067 [2263762] (ERROR) (wazo_calld): Exception on /1.0/parking_lots/2 [GET]
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3/dist-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/lib/python3/dist-packages/flask_restful/__init__.py", line 468, in wrapper
resp = resource(*args, **kwargs)
File "/usr/lib/python3/dist-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/usr/lib/python3/dist-packages/flask_restful/__init__.py", line 583, in dispatch_request
resp = meth(*args, **kwargs)
File "/usr/lib/python3/dist-packages/xivo/rest_api_helpers.py", line 41, in wrapper
return func(*args, **kwargs)
File "/usr/src/wazo/wazo-calld/wazo_calld/http.py", line 20, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/xivo/mallow_helpers.py", line 30, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/xivo/auth_verifier.py", line 225, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/xivo/auth_verifier.py", line 190, in wrapper
return func(*args, **kwargs)
File "/usr/src/wazo/wazo-calld/wazo_calld/plugins/parking_lots/http.py", line 32, in get
return ParkingLotSchema(context={'calls': calls}).dump(parking_lot), 200
File "/usr/lib/python3/dist-packages/marshmallow/schema.py", line 559, in dump
result = self._serialize(processed_obj, many=many)
File "/usr/lib/python3/dist-packages/marshmallow/schema.py", line 523, in _serialize
value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 330, in serialize
return self._serialize(value, attr, obj, **kwargs)
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 718, in _serialize
return [self.inner._serialize(each, attr, obj, **kwargs) for each in value]
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 718, in <listcomp>
return [self.inner._serialize(each, attr, obj, **kwargs) for each in value]
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 585, in _serialize
return schema.dump(nested_obj, many=many)
File "/usr/lib/python3/dist-packages/marshmallow/schema.py", line 559, in dump
result = self._serialize(processed_obj, many=many)
File "/usr/lib/python3/dist-packages/marshmallow/schema.py", line 523, in _serialize
value = field_obj.serialize(attr_name, obj, accessor=self.get_attribute)
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 330, in serialize
return self._serialize(value, attr, obj, **kwargs)
File "/usr/lib/python3/dist-packages/marshmallow/fields.py", line 1757, in _serialize
return method(obj)
File "/usr/src/wazo/wazo-calld/wazo_calld/plugins/parking_lots/schemas.py", line 68, in compute_timeout
timeout_at = now + timedelta(seconds=int(parked_call.parking_timeout))
OverflowError: Python int too large to convert to C int
80d682c
to
4d49bc6
Compare
Build failed. ✔️ tox-linters SUCCESS in 7m 21s |
Please don't use collocutor, it doesn't make any sense here. |
Build failed. ✔️ tox-linters SUCCESS in 7m 19s |
Build failed. ❌ tox-linters FAILURE in 7m 15s |
Build failed. ✔️ tox-linters SUCCESS in 7m 22s |
bda7c1e
to
1b0596b
Compare
Build failed. ✔️ tox-linters SUCCESS in 7m 02s |
Build failed. ✔️ tox-linters SUCCESS in 4m 48s |
efb42b0
to
d68d203
Compare
Build succeeded. ✔️ tox-linters SUCCESS in 4m 45s |
Because we cache the results of confd, we need a way to invalidate results in between tests. The cache listens on parking lot's created, deleted and updated events to clear it's value
* Changed the version * Changed the user call parking route * Added attribute to calls object
why: avoid specific ACL and be consistent with others API
* when setting a timeout of 0, internally, asterisk will use a value of 2^64 (max int). Calculating a timestamp of now + this max value will overflow and return an error. We now detect this and return a null timeout_at value when timeout is disabled
* microseconds were removed, making the check inaccurate
* mitigates a possible issue if there's system slowness
* change /parking_lots/$id -> /parkinglots/$id For symmetry with confd route * remove collocutor from user's route /users/me/calls/$callid/collocutor/park -> /users/me/calls/$callid/park
- test_reparking_call_updates_timeout: fix false negative where only first event was pickup - test_503_when_is_full: check bridge to be full before trying to park
Build succeeded. ✔️ tox-linters SUCCESS in 4m 49s |
eec19db
to
4ae7e13
Compare
Build failed. ✔️ tox-linters SUCCESS in 4m 43s |
recheck |
Build failed. ✔️ tox-linters SUCCESS in 7m 07s |
Build failed. ❌ tox-linters FAILURE in 7m 03s |
- Fix an issue w/ calls without tenant_uuid or user_uuid - Up default parking timeout to 45 to prevent channels from timing out before all channels are parked with a slow asterisk
a7ed31a
to
b8f2346
Compare
Quality Gate passedIssues Measures |
Build succeeded. ✔️ tox-linters SUCCESS in 4m 51s |
Build succeeded (gate pipeline). ✔️ tox-linters SUCCESS in 4m 48s |
Depends-On: wazo-platform/wazo-bus#102
Depends-On: wazo-platform/wazo-asterisk-config#58
Depends-On: wazo-platform/wazo-auth-keys#77
Depends-On: wazo-platform/wazo-calld-client#57
Provides an API to park a call
/parking_lots/$parking-id
Retrieve parking realtime information/calls/$call-id/park
Park the call into parking/users/me/calls/$call-id/park
Park the user's recipient callTo test
/calls