File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,10 @@ var (
369369 Usage : "timeout for the call to dial" ,
370370 Value : 80 * time .Second ,
371371 },
372+ & cli.StringSliceFlag {
373+ Name : "header" ,
374+ Usage : "Custom SIP header in format 'Key:Value' (can be specified multiple times)" ,
375+ },
372376 },
373377 },
374378 {
@@ -1154,6 +1158,26 @@ func createSIPParticipant(ctx context.Context, cmd *cli.Command) error {
11541158 if cmd .Bool ("wait" ) {
11551159 req .WaitUntilAnswered = true
11561160 }
1161+
1162+ // Parse headers from repeatable "header" flag
1163+ if headers := cmd .StringSlice ("header" ); len (headers ) > 0 {
1164+ if req .Headers == nil {
1165+ req .Headers = make (map [string ]string )
1166+ }
1167+ for _ , header := range headers {
1168+ parts := strings .SplitN (header , ":" , 2 )
1169+ if len (parts ) != 2 {
1170+ return fmt .Errorf ("invalid header format '%s', expected 'Key:Value'" , header )
1171+ }
1172+ key := strings .TrimSpace (parts [0 ])
1173+ value := strings .TrimSpace (parts [1 ])
1174+ if key == "" {
1175+ return fmt .Errorf ("header key cannot be empty in '%s'" , header )
1176+ }
1177+ req .Headers [key ] = value
1178+ }
1179+ }
1180+
11571181 return req .Validate ()
11581182 }, func (ctx context.Context , req * livekit.CreateSIPParticipantRequest ) (* livekit.SIPParticipantInfo , error ) {
11591183 // CreateSIPParticipant will wait for LiveKit Participant to be created and that can take some time.
You can’t perform that action at this time.
0 commit comments