Skip to content

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

Open
@chasemcdo

Description

@chasemcdo

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions