Skip to content

Commit

Permalink
Merge pull request #243 from wazo-platform/WP-1612-early-hangup-wrong…
Browse files Browse the repository at this point in the history
…-tenant

[WP-1612] fix missing tenant_uuid when early hangup

Depends-On: wazo-platform/wazo-test-helpers#116

Reviewed-by: Pascal Cadotte Michaud
  • Loading branch information
wazo-community-zuul[bot] authored Oct 8, 2024
2 parents 92b3ff2 + e83b1e7 commit bf4da52
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
45 changes: 45 additions & 0 deletions integration_tests/suite/test_call_log_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,51 @@ def test_answered_incoming_call(self):
),
)

@raw_cels(
'''\
eventtype | eventtime | cid_name | cid_num | exten | context | channame | uniqueid | linkedid
CHAN_START | 2024-09-24 09:37:44.351668-04 | AF Test 1 | 14201 | 42307 | from-extern | SIP/trunk-00000011 | 1727185064.17 | 1727185064.17
HANGUP | 2024-09-24 09:37:44.412237-04 | AF Test 1 | 14201 | s | did | SIP/trunk-00000011 | 1727185064.17 | 1727185064.17
CHAN_END | 2024-09-24 09:37:44.412237-04 | AF Test 1 | 14201 | s | did | SIP/trunk-00000011 | 1727185064.17 | 1727185064.17
LINKEDID_END | 2024-09-24 09:37:44.412237-04 | AF Test 1 | 14201 | s | did | SIP/trunk-00000011 | 1727185064.17 | 1727185064.17
'''
)
def test_early_hung_up_incoming_call(self):
self.confd.set_users(
MockUser(USER_1_UUID, USERS_TENANT, line_ids=[1]),
)
self.confd.set_lines(
MockLine(
id=1,
name='42307',
users=[{'uuid': USER_1_UUID}],
tenant_uuid=USERS_TENANT,
extensions=[{'exten': '42307', 'context': 'default'}],
)
)
self.confd.set_contexts(
MockContext(id=1, name='default', tenant_uuid=USERS_TENANT)
)
self._assert_last_call_log_matches(
'1727185064.17',
has_properties(
tenant_uuid=USERS_TENANT,
date=datetime.fromisoformat('2024-09-24 09:37:44.351668-04:00'),
date_answer=None,
date_end=datetime.fromisoformat('2024-09-24 09:37:44.412237-04:00'),
source_name='AF Test 1',
source_exten='14201',
source_line_identity='sip/trunk',
requested_name=None,
requested_exten='42307',
requested_context='from-extern',
destination_name=None,
destination_exten='42307',
destination_line_identity=None,
),
)

@raw_cels(
'''\
eventtype | eventtime | cid_name | cid_num | exten | context | channame | uniqueid | linkedid | extra
Expand Down
6 changes: 3 additions & 3 deletions wazo_call_logd/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,9 @@ def _ensure_tenant_uuid_is_set(self, call_log):
if not call_log.tenant_uuid:
# NOTE(sileht): requested_context
if call_log.requested_context:
contexts = self.confd.contexts.list(name=call_log.requested_context)[
'items'
]
contexts = self.confd.contexts.list(
name=call_log.requested_context, recurse=True
)['items']
if contexts:
call_log.set_tenant_uuid(contexts[0]['tenant_uuid'])
return
Expand Down

0 comments on commit bf4da52

Please sign in to comment.