Skip to content

Commit f54f5d6

Browse files
committed
chore: support listupdate when updating dispatch rule
1 parent fdf9771 commit f54f5d6

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

livekit-api/livekit/api/sip_service.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,16 @@ async def update_inbound_trunk_fields(
175175
update.numbers.set.extend(numbers)
176176
if allowed_addresses is not None:
177177
if isinstance(allowed_addresses, ListUpdate):
178-
update.allowed_addresses.set.extend(numbers.set)
179-
update.allowed_addresses.add.extend(numbers.add)
180-
update.allowed_addresses.remove.extend(numbers.remove)
178+
update.allowed_addresses.set.extend(allowed_addresses.set)
179+
update.allowed_addresses.add.extend(allowed_addresses.add)
180+
update.allowed_addresses.remove.extend(allowed_addresses.remove)
181181
else:
182182
update.allowed_addresses.set.extend(allowed_addresses)
183183
if allowed_numbers is not None:
184184
if isinstance(allowed_numbers, ListUpdate):
185-
update.allowed_numbers.set.extend(numbers.set)
186-
update.allowed_numbers.add.extend(numbers.add)
187-
update.allowed_numbers.remove.extend(numbers.remove)
185+
update.allowed_numbers.set.extend(allowed_numbers.set)
186+
update.allowed_numbers.add.extend(allowed_numbers.add)
187+
update.allowed_numbers.remove.extend(allowed_numbers.remove)
188188
else:
189189
update.allowed_numbers.set.extend(allowed_numbers)
190190

@@ -607,7 +607,7 @@ async def update_dispatch_rule_fields(
607607
self,
608608
rule_id: str,
609609
*,
610-
trunk_ids: Optional[list[str]] = None,
610+
trunk_ids: Optional[ListUpdate | list[str]] = None,
611611
rule: Optional[SIPDispatchRule] = None,
612612
name: Optional[str] = None,
613613
metadata: Optional[str] = None,
@@ -624,6 +624,14 @@ async def update_dispatch_rule_fields(
624624
attributes=attributes,
625625
trunk_ids=ListUpdate(set=trunk_ids) if trunk_ids else None,
626626
)
627+
if trunk_ids is not None:
628+
if isinstance(trunk_ids, ListUpdate):
629+
update.trunk_ids.set.extend(trunk_ids.set)
630+
update.trunk_ids.add.extend(trunk_ids.add)
631+
update.trunk_ids.remove.extend(trunk_ids.remove)
632+
else:
633+
update.trunk_ids.set.extend(trunk_ids)
634+
627635
return await self._client.request(
628636
SVC,
629637
"UpdateSIPDispatchRule",

0 commit comments

Comments
 (0)