github.com/livekit/protocol@v1.39.3/protobufs/livekit_sip.proto (about) 1 // Copyright 2023 LiveKit, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 17 package livekit; 18 19 option go_package = "github.com/livekit/protocol/livekit"; 20 option csharp_namespace = "LiveKit.Proto"; 21 option ruby_package = "LiveKit::Proto"; 22 23 import "google/protobuf/duration.proto"; 24 import "google/protobuf/empty.proto"; 25 import "livekit_models.proto"; 26 import "livekit_room.proto"; 27 28 /* 29 LiveKit's SIP API is built with 3 high level primitives 30 - SIP Trunk 31 - SIP Dispatch Rule 32 - SIP Participant 33 34 35 The `SIP Trunk` is used to accept and make calls. A `SIP Trunk` is configured with 36 the IPs/Ports and Authentication details of your SIP Provider. When a call is accepted from 37 the `SIP Trunk` it is then handled by the `SIP Dispatch Rules`. When a `SIP Participant` is created 38 for a outbound call a `SIP Trunk` is chosen to make the call with. 39 40 41 The `SIP Dispatch Rule` is a list of rules that dictate how a incoming SIP call should be handled. 42 LiveKit currently supports 2 types, but may support more in the future. 43 44 - `Direct Dispatch` puts a caller into a existing room, possibly choosing between multiple rooms with a pin 45 - `Individual Dispatch` puts a caller into a new room created for the call 46 47 48 The `SIP Participant` represents an active SIP Session. These SIP Sessions are always associated with 49 a Participant on LiveKit side. Inbound calls create Participants directly (with a `SIP` kind), while outbound 50 calls must be initiated with `CreateSIPParticipant`. 51 */ 52 53 54 service SIP { 55 // rpc CreateSIPTrunk(CreateSIPTrunkRequest) returns (SIPTrunkInfo) { option deprecated = true; }; DELETED 56 57 rpc ListSIPTrunk(ListSIPTrunkRequest) returns (ListSIPTrunkResponse) { option deprecated = true; }; 58 59 rpc CreateSIPInboundTrunk(CreateSIPInboundTrunkRequest) returns (SIPInboundTrunkInfo); 60 rpc CreateSIPOutboundTrunk(CreateSIPOutboundTrunkRequest) returns (SIPOutboundTrunkInfo); 61 rpc UpdateSIPInboundTrunk(UpdateSIPInboundTrunkRequest) returns (SIPInboundTrunkInfo); 62 rpc UpdateSIPOutboundTrunk(UpdateSIPOutboundTrunkRequest) returns (SIPOutboundTrunkInfo); 63 rpc GetSIPInboundTrunk(GetSIPInboundTrunkRequest) returns (GetSIPInboundTrunkResponse); 64 rpc GetSIPOutboundTrunk(GetSIPOutboundTrunkRequest) returns (GetSIPOutboundTrunkResponse); 65 rpc ListSIPInboundTrunk(ListSIPInboundTrunkRequest) returns (ListSIPInboundTrunkResponse); 66 rpc ListSIPOutboundTrunk(ListSIPOutboundTrunkRequest) returns (ListSIPOutboundTrunkResponse); 67 rpc DeleteSIPTrunk(DeleteSIPTrunkRequest) returns (SIPTrunkInfo); 68 69 rpc CreateSIPDispatchRule(CreateSIPDispatchRuleRequest) returns (SIPDispatchRuleInfo); 70 rpc UpdateSIPDispatchRule(UpdateSIPDispatchRuleRequest) returns (SIPDispatchRuleInfo); 71 rpc ListSIPDispatchRule(ListSIPDispatchRuleRequest) returns (ListSIPDispatchRuleResponse); 72 rpc DeleteSIPDispatchRule(DeleteSIPDispatchRuleRequest) returns (SIPDispatchRuleInfo); 73 74 rpc CreateSIPParticipant(CreateSIPParticipantRequest) returns (SIPParticipantInfo); 75 rpc TransferSIPParticipant(TransferSIPParticipantRequest) returns (google.protobuf.Empty); 76 } 77 78 enum SIPStatusCode { 79 SIP_STATUS_UNKNOWN = 0; 80 81 SIP_STATUS_TRYING = 100; 82 SIP_STATUS_RINGING = 180; 83 SIP_STATUS_CALL_IS_FORWARDED = 181; 84 SIP_STATUS_QUEUED = 182; 85 SIP_STATUS_SESSION_PROGRESS = 183; 86 87 SIP_STATUS_OK = 200; 88 SIP_STATUS_ACCEPTED = 202; 89 90 SIP_STATUS_MOVED_PERMANENTLY = 301; 91 SIP_STATUS_MOVED_TEMPORARILY = 302; 92 SIP_STATUS_USE_PROXY = 305; 93 94 SIP_STATUS_BAD_REQUEST = 400; 95 SIP_STATUS_UNAUTHORIZED = 401; 96 SIP_STATUS_PAYMENT_REQUIRED = 402; 97 SIP_STATUS_FORBIDDEN = 403; 98 SIP_STATUS_NOTFOUND = 404; 99 SIP_STATUS_METHOD_NOT_ALLOWED = 405; 100 SIP_STATUS_NOT_ACCEPTABLE = 406; 101 SIP_STATUS_PROXY_AUTH_REQUIRED = 407; 102 SIP_STATUS_REQUEST_TIMEOUT = 408; 103 SIP_STATUS_CONFLICT = 409; 104 SIP_STATUS_GONE = 410; 105 SIP_STATUS_REQUEST_ENTITY_TOO_LARGE = 413; 106 SIP_STATUS_REQUEST_URI_TOO_LONG = 414; 107 SIP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415; 108 SIP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE = 416; 109 SIP_STATUS_BAD_EXTENSION = 420; 110 SIP_STATUS_EXTENSION_REQUIRED = 421; 111 SIP_STATUS_INTERVAL_TOO_BRIEF = 423; 112 SIP_STATUS_TEMPORARILY_UNAVAILABLE = 480; 113 SIP_STATUS_CALL_TRANSACTION_DOES_NOT_EXISTS = 481; 114 SIP_STATUS_LOOP_DETECTED = 482; 115 SIP_STATUS_TOO_MANY_HOPS = 483; 116 SIP_STATUS_ADDRESS_INCOMPLETE = 484; 117 SIP_STATUS_AMBIGUOUS = 485; 118 SIP_STATUS_BUSY_HERE = 486; 119 SIP_STATUS_REQUEST_TERMINATED = 487; 120 SIP_STATUS_NOT_ACCEPTABLE_HERE = 488; 121 122 SIP_STATUS_INTERNAL_SERVER_ERROR = 500; 123 SIP_STATUS_NOT_IMPLEMENTED = 501; 124 SIP_STATUS_BAD_GATEWAY = 502; 125 SIP_STATUS_SERVICE_UNAVAILABLE = 503; 126 SIP_STATUS_GATEWAY_TIMEOUT = 504; 127 SIP_STATUS_VERSION_NOT_SUPPORTED = 505; 128 SIP_STATUS_MESSAGE_TOO_LARGE = 513; 129 130 SIP_STATUS_GLOBAL_BUSY_EVERYWHERE = 600; 131 SIP_STATUS_GLOBAL_DECLINE = 603; 132 SIP_STATUS_GLOBAL_DOES_NOT_EXIST_ANYWHERE = 604; 133 SIP_STATUS_GLOBAL_NOT_ACCEPTABLE = 606; 134 } 135 136 // SIPStatus is returned as an error detail in CreateSIPParticipant. 137 message SIPStatus { 138 SIPStatusCode code = 1; 139 string status = 2; 140 } 141 142 message CreateSIPTrunkRequest { 143 option deprecated = true; 144 // CIDR or IPs that traffic is accepted from 145 // An empty list means all inbound traffic is accepted. 146 repeated string inbound_addresses = 1; 147 148 // IP that SIP INVITE is sent too 149 string outbound_address = 2; 150 151 // Number used to make outbound calls 152 string outbound_number = 3; 153 154 repeated string inbound_numbers_regex = 4 [deprecated=true]; 155 156 // Accepted `To` values. This Trunk will only accept a call made to 157 // these numbers. This allows you to have distinct Trunks for different phone 158 // numbers at the same provider. 159 repeated string inbound_numbers = 9; 160 161 // Username and password used to authenticate inbound and outbound SIP invites 162 // May be empty to have no Authentication 163 string inbound_username = 5; 164 string inbound_password = 6; 165 string outbound_username = 7; 166 string outbound_password = 8; 167 168 // Optional human-readable name for the Trunk. 169 string name = 10; 170 // Optional user-defined metadata for the Trunk. 171 string metadata = 11; 172 } 173 174 enum SIPTransport { 175 SIP_TRANSPORT_AUTO = 0; 176 SIP_TRANSPORT_UDP = 1; 177 SIP_TRANSPORT_TCP = 2; 178 SIP_TRANSPORT_TLS = 3; 179 } 180 181 enum SIPHeaderOptions { 182 SIP_NO_HEADERS = 0; // do not map any headers, except ones mapped explicitly 183 SIP_X_HEADERS = 1; // map all X-* headers to sip.h.x-* attributes 184 SIP_ALL_HEADERS = 2; // map all headers to sip.h.* attributes 185 } 186 187 enum SIPMediaEncryption { 188 SIP_MEDIA_ENCRYPT_DISABLE = 0; // do not enable encryption 189 SIP_MEDIA_ENCRYPT_ALLOW = 1; // use encryption if available 190 SIP_MEDIA_ENCRYPT_REQUIRE = 2; // require encryption 191 } 192 193 message SIPTrunkInfo { 194 option deprecated = true; 195 196 enum TrunkKind { 197 TRUNK_LEGACY = 0; 198 TRUNK_INBOUND = 1; 199 TRUNK_OUTBOUND = 2; 200 } 201 202 string sip_trunk_id = 1; 203 TrunkKind kind = 14; 204 205 // CIDR or IPs that traffic is accepted from 206 // An empty list means all inbound traffic is accepted. 207 repeated string inbound_addresses = 2; 208 209 // IP that SIP INVITE is sent too 210 string outbound_address = 3; 211 212 // Number used to make outbound calls 213 string outbound_number = 4; 214 215 // Transport used for inbound and outbound calls. 216 SIPTransport transport = 13; 217 218 repeated string inbound_numbers_regex = 5 [deprecated=true]; 219 220 // Accepted `To` values. This Trunk will only accept a call made to 221 // these numbers. This allows you to have distinct Trunks for different phone 222 // numbers at the same provider. 223 repeated string inbound_numbers = 10; 224 225 // Username and password used to authenticate inbound and outbound SIP invites 226 // May be empty to have no Authentication 227 string inbound_username = 6; 228 string inbound_password = 7; 229 string outbound_username = 8; 230 string outbound_password = 9; 231 232 // Human-readable name for the Trunk. 233 string name = 11; 234 // User-defined metadata for the Trunk. 235 string metadata = 12; 236 237 // NEXT ID: 15 238 } 239 240 message CreateSIPInboundTrunkRequest { 241 SIPInboundTrunkInfo trunk = 1; // Trunk ID is ignored 242 } 243 244 message UpdateSIPInboundTrunkRequest { 245 string sip_trunk_id = 1; 246 oneof action { 247 SIPInboundTrunkInfo replace = 2; 248 SIPInboundTrunkUpdate update = 3; 249 } 250 } 251 252 message SIPInboundTrunkInfo { 253 string sip_trunk_id = 1; 254 255 // Human-readable name for the Trunk. 256 string name = 2; 257 // User-defined metadata for the Trunk. 258 string metadata = 3; 259 260 // Numbers associated with LiveKit SIP. The Trunk will only accept calls made to these numbers. 261 // Creating multiple Trunks with different phone numbers allows having different rules for a single provider. 262 repeated string numbers = 4; 263 264 // CIDR or IPs that traffic is accepted from. 265 // An empty list means all inbound traffic is accepted. 266 repeated string allowed_addresses = 5; 267 268 // Numbers that are allowed to make calls to this Trunk. 269 // An empty list means calls from any phone number is accepted. 270 repeated string allowed_numbers = 6; 271 272 // Username and password used to authenticate inbound SIP invites. 273 // May be empty to have no authentication. 274 string auth_username = 7; 275 string auth_password = 8; 276 277 // Include these SIP X-* headers in 200 OK responses. 278 map<string, string> headers = 9; 279 // Map SIP X-* headers from INVITE to SIP participant attributes. 280 map<string, string> headers_to_attributes = 10; 281 // Map LiveKit attributes to SIP X-* headers when sending BYE or REFER requests. 282 // Keys are the names of attributes and values are the names of X-* headers they will be mapped to. 283 map<string, string> attributes_to_headers = 14; 284 // Map SIP headers from INVITE to sip.h.* participant attributes automatically. 285 // 286 // When the names of required headers is known, using headers_to_attributes is strongly recommended. 287 // 288 // When mapping INVITE headers to response headers with attributes_to_headers map, 289 // lowercase header names should be used, for example: sip.h.x-custom-header. 290 SIPHeaderOptions include_headers = 15; 291 292 // Max time for the caller to wait for track subscription. 293 google.protobuf.Duration ringing_timeout = 11; 294 // Max call duration. 295 google.protobuf.Duration max_call_duration = 12; 296 297 bool krisp_enabled = 13; 298 SIPMediaEncryption media_encryption = 16; 299 300 // NEXT ID: 17 301 } 302 303 message SIPInboundTrunkUpdate { 304 ListUpdate numbers = 1; 305 ListUpdate allowed_addresses = 2; 306 ListUpdate allowed_numbers = 3; 307 optional string auth_username = 4; 308 optional string auth_password = 5; 309 optional string name = 6; 310 optional string metadata = 7; 311 optional SIPMediaEncryption media_encryption = 8; 312 } 313 314 message CreateSIPOutboundTrunkRequest { 315 SIPOutboundTrunkInfo trunk = 1; // Trunk ID is ignored 316 } 317 318 message UpdateSIPOutboundTrunkRequest { 319 string sip_trunk_id = 1; 320 oneof action { 321 SIPOutboundTrunkInfo replace = 2; 322 SIPOutboundTrunkUpdate update = 3; 323 } 324 } 325 326 message SIPOutboundTrunkInfo { 327 string sip_trunk_id = 1; 328 329 // Human-readable name for the Trunk. 330 string name = 2; 331 // User-defined metadata for the Trunk. 332 string metadata = 3; 333 334 // Hostname or IP that SIP INVITE is sent too. 335 // Note that this is not a SIP URI and should not contain the 'sip:' protocol prefix. 336 string address = 4; 337 338 // country where the call terminates as ISO 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). This will be used by the livekit infrastructure to route calls. 339 string destination_country = 14; 340 341 // SIP Transport used for outbound call. 342 SIPTransport transport = 5; 343 344 // Numbers used to make the calls. Random one from this list will be selected. 345 repeated string numbers = 6; 346 347 // Username and password used to authenticate with SIP server. 348 // May be empty to have no authentication. 349 string auth_username = 7; 350 string auth_password = 8; 351 352 // Include these SIP X-* headers in INVITE request. 353 // These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. 354 map<string, string> headers = 9; 355 // Map SIP X-* headers from 200 OK to SIP participant attributes. 356 // Keys are the names of X-* headers and values are the names of attributes they will be mapped to. 357 map<string, string> headers_to_attributes = 10; 358 // Map LiveKit attributes to SIP X-* headers when sending BYE or REFER requests. 359 // Keys are the names of attributes and values are the names of X-* headers they will be mapped to. 360 map<string, string> attributes_to_headers = 11; 361 // Map SIP headers from 200 OK to sip.h.* participant attributes automatically. 362 // 363 // When the names of required headers is known, using headers_to_attributes is strongly recommended. 364 // 365 // When mapping 200 OK headers to follow-up request headers with attributes_to_headers map, 366 // lowercase header names should be used, for example: sip.h.x-custom-header. 367 SIPHeaderOptions include_headers = 12; 368 369 SIPMediaEncryption media_encryption = 13; 370 371 // NEXT ID: 15 372 } 373 374 message SIPOutboundTrunkUpdate { 375 optional string address = 1; 376 optional SIPTransport transport = 2; 377 optional string destination_country = 9; 378 ListUpdate numbers = 3; 379 optional string auth_username = 4; 380 optional string auth_password = 5; 381 optional string name = 6; 382 optional string metadata = 7; 383 optional SIPMediaEncryption media_encryption = 8; 384 385 // NEXT ID: 10 386 } 387 388 message GetSIPInboundTrunkRequest { 389 string sip_trunk_id = 1; 390 } 391 392 message GetSIPInboundTrunkResponse { 393 SIPInboundTrunkInfo trunk = 1; 394 } 395 396 message GetSIPOutboundTrunkRequest { 397 string sip_trunk_id = 1; 398 } 399 400 message GetSIPOutboundTrunkResponse { 401 SIPOutboundTrunkInfo trunk = 1; 402 } 403 404 message ListSIPTrunkRequest { 405 option deprecated = true; 406 Pagination page = 1; 407 } 408 409 message ListSIPTrunkResponse { 410 option deprecated = true; 411 repeated SIPTrunkInfo items = 1; 412 } 413 414 // ListSIPInboundTrunkRequest lists inbound trunks for given filters. If no filters are set, all trunks are listed. 415 message ListSIPInboundTrunkRequest { 416 Pagination page = 3; 417 // Trunk IDs to list. If this option is set, the response will contains trunks in the same order. 418 // If any of the trunks is missing, a nil item in that position will be sent in the response. 419 repeated string trunk_ids = 1; 420 // Only list trunks that contain one of the numbers, including wildcard trunks. 421 repeated string numbers = 2; 422 } 423 424 message ListSIPInboundTrunkResponse { 425 repeated SIPInboundTrunkInfo items = 1; 426 } 427 428 // ListSIPOutboundTrunkRequest lists outbound trunks for given filters. If no filters are set, all trunks are listed. 429 message ListSIPOutboundTrunkRequest { 430 Pagination page = 3; 431 // Trunk IDs to list. If this option is set, the response will contains trunks in the same order. 432 // If any of the trunks is missing, a nil item in that position will be sent in the response. 433 repeated string trunk_ids = 1; 434 // Only list trunks that contain one of the numbers, including wildcard trunks. 435 repeated string numbers = 2; 436 } 437 438 message ListSIPOutboundTrunkResponse { 439 repeated SIPOutboundTrunkInfo items = 1; 440 } 441 442 message DeleteSIPTrunkRequest { 443 string sip_trunk_id = 1; 444 } 445 446 message SIPDispatchRuleDirect { 447 // What room should call be directed into 448 string room_name = 1; 449 450 // Optional pin required to enter room 451 string pin = 2; 452 } 453 454 message SIPDispatchRuleIndividual { 455 // Prefix used on new room name 456 string room_prefix = 1; 457 458 // Optional pin required to enter room 459 string pin = 2; 460 } 461 462 message SIPDispatchRuleCallee { 463 // Prefix used on new room name 464 string room_prefix = 1; 465 466 // Optional pin required to enter room 467 string pin = 2; 468 469 // Optionally append random suffix 470 bool randomize = 3; 471 } 472 473 message SIPDispatchRule { 474 oneof rule { 475 // SIPDispatchRuleDirect is a `SIP Dispatch Rule` that puts a user directly into a room 476 // This places users into an existing room. Optionally you can require a pin before a user can 477 // enter the room 478 SIPDispatchRuleDirect dispatch_rule_direct = 1; 479 480 // SIPDispatchRuleIndividual is a `SIP Dispatch Rule` that creates a new room for each caller. 481 SIPDispatchRuleIndividual dispatch_rule_individual = 2; 482 483 // SIPDispatchRuleCallee is a `SIP Dispatch Rule` that creates a new room for each callee. 484 SIPDispatchRuleCallee dispatch_rule_callee = 3; 485 } 486 } 487 488 message CreateSIPDispatchRuleRequest { 489 SIPDispatchRuleInfo dispatch_rule = 10; // Rule ID is ignored 490 491 SIPDispatchRule rule = 1 [deprecated=true]; 492 493 // What trunks are accepted for this dispatch rule 494 // If empty all trunks will match this dispatch rule 495 repeated string trunk_ids = 2 [deprecated=true]; 496 497 // By default the From value (Phone number) is used for participant name/identity and added to attributes. 498 // If true, a random value for identity will be used and numbers will be omitted from attributes. 499 bool hide_phone_number = 3 [deprecated=true]; 500 501 // Dispatch Rule will only accept a call made to these numbers (if set). 502 repeated string inbound_numbers = 6 [deprecated=true]; 503 504 // Optional human-readable name for the Dispatch Rule. 505 string name = 4 [deprecated=true]; 506 // User-defined metadata for the Dispatch Rule. 507 // Participants created by this rule will inherit this metadata. 508 string metadata = 5 [deprecated=true]; 509 // User-defined attributes for the Dispatch Rule. 510 // Participants created by this rule will inherit these attributes. 511 map<string, string> attributes = 7 [deprecated=true]; 512 513 // Cloud-only, config preset to use 514 string room_preset = 8 [deprecated=true]; 515 516 // RoomConfiguration to use if the participant initiates the room 517 RoomConfiguration room_config = 9 [deprecated=true]; 518 519 // NEXT ID: 11 520 } 521 522 message UpdateSIPDispatchRuleRequest { 523 string sip_dispatch_rule_id = 1; 524 oneof action { 525 SIPDispatchRuleInfo replace = 2; 526 SIPDispatchRuleUpdate update = 3; 527 } 528 } 529 530 message SIPDispatchRuleInfo { 531 string sip_dispatch_rule_id = 1; 532 SIPDispatchRule rule = 2; 533 repeated string trunk_ids = 3; 534 bool hide_phone_number = 4; 535 // Dispatch Rule will only accept a call made to these numbers (if set). 536 repeated string inbound_numbers = 7; 537 538 // Human-readable name for the Dispatch Rule. 539 string name = 5; 540 // User-defined metadata for the Dispatch Rule. 541 // Participants created by this rule will inherit this metadata. 542 string metadata = 6; 543 // User-defined attributes for the Dispatch Rule. 544 // Participants created by this rule will inherit these attributes. 545 map<string, string> attributes = 8; 546 547 // Cloud-only, config preset to use 548 string room_preset = 9; 549 550 // RoomConfiguration to use if the participant initiates the room 551 RoomConfiguration room_config = 10; 552 553 bool krisp_enabled = 11; 554 SIPMediaEncryption media_encryption = 12; 555 // NEXT ID: 13 556 } 557 558 message SIPDispatchRuleUpdate { 559 ListUpdate trunk_ids = 1; 560 SIPDispatchRule rule = 2; 561 optional string name = 3; 562 optional string metadata = 4; 563 map<string, string> attributes = 5; 564 optional SIPMediaEncryption media_encryption = 6; 565 } 566 567 // ListSIPDispatchRuleRequest lists dispatch rules for given filters. If no filters are set, all rules are listed. 568 message ListSIPDispatchRuleRequest { 569 Pagination page = 3; 570 // Rule IDs to list. If this option is set, the response will contains rules in the same order. 571 // If any of the rules is missing, a nil item in that position will be sent in the response. 572 repeated string dispatch_rule_ids = 1; 573 // Only list rules that contain one of the Trunk IDs, including wildcard rules. 574 repeated string trunk_ids = 2; 575 } 576 577 message ListSIPDispatchRuleResponse { 578 repeated SIPDispatchRuleInfo items = 1; 579 } 580 581 message DeleteSIPDispatchRuleRequest { 582 string sip_dispatch_rule_id = 1; 583 } 584 585 message SIPOutboundConfig { 586 // SIP server address 587 string hostname = 1; 588 589 // country where the call terminates as ISO 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). This will be used by the livekit infrastructure to route calls. 590 string destination_country = 7; 591 592 // SIP Transport used for outbound call. 593 SIPTransport transport = 2; 594 595 // Username and password used to authenticate with SIP server. 596 // May be empty to have no authentication. 597 string auth_username = 3; 598 string auth_password = 4; 599 600 // Map SIP X-* headers from 200 OK to SIP participant attributes. 601 // Keys are the names of X-* headers and values are the names of attributes they will be mapped to. 602 map<string, string> headers_to_attributes = 5; 603 // Map LiveKit attributes to SIP X-* headers when sending BYE or REFER requests. 604 // Keys are the names of attributes and values are the names of X-* headers they will be mapped to. 605 map<string, string> attributes_to_headers = 6; 606 607 // NEXT ID: 7 608 } 609 610 // A SIP Participant is a singular SIP session connected to a LiveKit room via 611 // a SIP Trunk into a SIP DispatchRule 612 message CreateSIPParticipantRequest { 613 // What SIP Trunk should be used to dial the user 614 string sip_trunk_id = 1; 615 SIPOutboundConfig trunk = 20; 616 617 // What number should be dialed via SIP 618 string sip_call_to = 2; 619 620 // Optional SIP From number to use. If empty, trunk number is used. 621 string sip_number = 15; 622 623 // What LiveKit room should this participant be connected too 624 string room_name = 3; 625 626 // Optional identity of the participant in LiveKit room 627 string participant_identity = 4; 628 629 // Optional name of the participant in LiveKit room 630 string participant_name = 7; 631 632 // Optional user-defined metadata. Will be attached to a created Participant in the room. 633 string participant_metadata = 8; 634 // Optional user-defined attributes. Will be attached to a created Participant in the room. 635 map<string, string> participant_attributes = 9; 636 637 // Optionally send following DTMF digits (extension codes) when making a call. 638 // Character 'w' can be used to add a 0.5 sec delay. 639 string dtmf = 5; 640 641 // Optionally play dialtone in the room as an audible indicator for existing participants. The `play_ringtone` option is deprectated but has the same effect. 642 bool play_ringtone = 6 [deprecated = true]; 643 bool play_dialtone = 13; 644 645 // By default the From value (Phone number) is used for participant name/identity (if not set) and added to attributes. 646 // If true, a random value for identity will be used and numbers will be omitted from attributes. 647 bool hide_phone_number = 10; 648 649 // These headers are sent as-is and may help identify this call as coming from LiveKit for the other SIP endpoint. 650 map<string, string> headers = 16; 651 // Map SIP headers from 200 OK to sip.h.* participant attributes automatically. 652 // 653 // When the names of required headers is known, using headers_to_attributes is strongly recommended. 654 // 655 // When mapping 200 OK headers to follow-up request headers with attributes_to_headers map, 656 // lowercase header names should be used, for example: sip.h.x-custom-header. 657 SIPHeaderOptions include_headers = 17; 658 659 // Max time for the callee to answer the call. 660 google.protobuf.Duration ringing_timeout = 11; 661 // Max call duration. 662 google.protobuf.Duration max_call_duration = 12; 663 664 // Enable voice isolation for the callee. 665 bool krisp_enabled = 14; 666 667 SIPMediaEncryption media_encryption = 18; 668 669 // Wait for the answer for the call before returning. 670 bool wait_until_answered = 19; 671 // NEXT ID: 21 672 } 673 674 message SIPParticipantInfo { 675 string participant_id = 1; 676 string participant_identity = 2; 677 string room_name = 3; 678 string sip_call_id = 4; 679 } 680 681 message TransferSIPParticipantRequest { 682 string participant_identity = 1; 683 string room_name = 2; 684 string transfer_to = 3; 685 686 // Optionally play dialtone to the SIP participant as an audible indicator of being transferred 687 bool play_dialtone = 4; 688 689 // Add the following headers to the REFER SIP request. 690 map<string, string> headers = 5; 691 692 // Max time for the transfer destination to answer the call. 693 google.protobuf.Duration ringing_timeout = 6; 694 } 695 696 message SIPCallInfo { 697 string call_id = 1; 698 string trunk_id = 2; 699 string dispatch_rule_id = 16; 700 string region = 17; 701 string room_name = 3; 702 string room_id = 4; // ID of the current/previous room published to 703 string participant_identity = 5; 704 map<string, string> participant_attributes = 18; 705 SIPUri from_uri = 6; 706 SIPUri to_uri = 7; 707 int64 created_at = 9 [ deprecated = true ]; 708 int64 started_at = 10 [ deprecated = true ]; 709 int64 ended_at = 11 [ deprecated = true ]; 710 repeated SIPFeature enabled_features = 14; 711 SIPCallDirection call_direction = 15; 712 SIPCallStatus call_status = 8; 713 int64 created_at_ns = 22; 714 int64 started_at_ns = 23; 715 int64 ended_at_ns = 24; 716 DisconnectReason disconnect_reason = 12; 717 string error = 13; 718 SIPStatus call_status_code = 19; 719 string audio_codec = 20; 720 string media_encryption = 21; 721 722 // NEXT ID: 25 723 } 724 725 message SIPTransferInfo { 726 string transfer_id = 1; 727 string call_id = 2; 728 string transfer_to = 3; 729 int64 transfer_initiated_at_ns = 4; 730 int64 transfer_completed_at_ns = 5; 731 SIPTransferStatus transfer_status = 6; 732 string error = 7; 733 SIPStatus transfer_status_code = 8; 734 735 // NEXT ID: 7 736 } 737 738 message SIPUri { 739 string user = 1; 740 string host = 2; 741 string ip = 3; 742 uint32 port = 4; 743 SIPTransport transport = 5; 744 } 745 746 enum SIPCallStatus { 747 SCS_CALL_INCOMING = 0; // Incoming call is being handled by the SIP service. The SIP participant hasn't joined a LiveKit room yet 748 SCS_PARTICIPANT_JOINED = 1; // SIP participant for outgoing call has been created. The SIP outgoing call is being established 749 SCS_ACTIVE = 2; // Call is ongoing. SIP participant is active in the LiveKit room 750 SCS_DISCONNECTED = 3; // Call has ended 751 SCS_ERROR = 4; // Call has ended or never succeeded because of an error 752 } 753 754 enum SIPTransferStatus { 755 STS_TRANSFER_ONGOING = 0; 756 STS_TRANSFER_FAILED = 1; 757 STS_TRANSFER_SUCCESSFUL = 2; 758 } 759 760 enum SIPFeature { 761 NONE = 0; 762 KRISP_ENABLED = 1; 763 } 764 765 enum SIPCallDirection { 766 SCD_UNKNOWN = 0; 767 SCD_INBOUND = 1; 768 SCD_OUTBOUND = 2; 769 }