Skip to content
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

Cannot create numberless outbound trunk despite it being optional for operation #976

Open
chasemcdo opened this issue Feb 10, 2025 · 1 comment

Comments

@chasemcdo
Copy link

Issue:
When creating an outbound trunk the numbers attribute is enforced as required by this; however, when initiating calls via the sip_create_participant of the livekit api you can use any arbitrary number regardless of its inclusion in this number list.

Possible Fix:

  • validate inbound api creations against the numbers list
  • allow nullable numbers param

Step to reproduce:

  1. Create an outbound trunk
from livekit import api
OUTBOUND_TRUNK = CreateSIPOutboundTrunkRequest(
    trunk=SIPOutboundTrunkInfo(
        name="Outbound trunk",
        numbers=["15555555555"], # Placeholder number
        address=..., # Telephony sip auth/address
        auth_username=...,
        auth_password=...
    )
)
async with api.LiveKitAPI() as client:
    outbound_trunk = await client.sip.create_sip_outbound_trunk(OUTBOUND_TRUNK)
  1. Create SIP participant
from livekit import api
client = api.LiveKitAPI()
call_response: livekit_api.SIPParticipantInfo = await client.sip.create_sip_participant(
    livekit_api.CreateSIPParticipantRequest(
        room_name=call.id,
        sip_trunk_id=<TRUNK_ID_FROM_STEP_ONE>,
        sip_call_to=<NUMBER_TO_CALL>,
        participant_identity=<ARBITRARY_ID>,
        sip_number=<SOME_RANDOM_NUMBER_THAT_IS_DIFFERENT_FROM_15555555555>,
    )
)
  1. Observe that this was successful despite a misalignment of numbers and sip_number

This may be a misunderstanding of the expected behaviour on my part, but it seems that numbers being a required field during creation isn't strictly enforced during participant addition. The work around I am presently using is the put an arbitrary number into the numbers field, but would be nice to have that be an optional field given it doesn't seem to do anything.

TIA!

@chasemcdo
Copy link
Author

Something like this would seem to allow my expected behaviour, but I imagine there must be a reason that this should be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant