Skip to content

Add SIP endpoints documentation #148

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

Merged
merged 9 commits into from
Apr 25, 2025
1 change: 1 addition & 0 deletions api/signalwire-rest/fabric-api/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "./ai-agent";
import "./ai-agent-addresses";
import "./cxml-application";
import "./cxml-application-addresses";
import "./sip_gateways";


using TypeSpec.Http;
Expand Down
64 changes: 64 additions & 0 deletions api/signalwire-rest/fabric-api/sip_gateways/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import "@typespec/http";
import "./models/core.tsp";
import "./models/requests.tsp";
import "./models/responses.tsp";
import "./models/errors.tsp";
import "../../types";

using TypeSpec.Http;
using Types.StatusCodes;

@route("/resources/sip_gateways")
namespace FabricAPI.SipGateways {
@tag("SIP Gateway")
@friendlyName("SIP Gateway")
interface SipGateways {
@summary("List SIP Gateways")
@doc("Returns a paginated list of SIP Gateways for the authenticated project.")
list():
SipGatewayListResponse |
StatusCode401 |
StatusCode404;

@summary("Get SIP Gateway")
@doc("Returns an SIP Gateway by ID")
read(...SipGatewayID): {
@statusCode statusCode: 200;
@body sip_gateway: SipGatewayResponse;
} |
StatusCode401 |
StatusCode404;

@summary("Create SIP Gateway")
@doc("Creates a Subscriber Guest Token to be used for server-side API calls. The token is authorized using an existing API token.")
@post create(...SipGatewayCreateRequest):
{ @statusCode statusCode: 201; @body sip_gateway: SipGatewayCreateResponse; } |
StatusCode401 |
StatusCode404 |
SipGatewayCreateStatusCode422;

@summary("Update SIP Gateway")
@doc("Updates a SIP Gateway by ID")
@patch update(...SipGatewayID, ...SipGatewayUpdateRequest): {
@statusCode statusCode: 200; @body cxml_application: SipGatewayUpdateResponse;
} |
StatusCode401 |
StatusCode404 |
SipGatewayCreateStatusCode422;

@summary("Delete SIP Gateway")
@doc("Deletes a SIP Gateway} by ID")
@delete delete(...SipGatewayID):
{ @statusCode statusCode: 204; } |
StatusCode401 |
StatusCode404;

@summary("List Fabric Addresses assigned to a SIP Gateway")
@doc("Returns a paginated list of Fabric Addresses associated with the specified SIP Gateway.")
@route("/{resource_id}/addresses")
readAddressesByResourceId(@path resource_id: string):
SipGatewayAddressListResponse |
StatusCode401 |
StatusCode404;
}
}
56 changes: 56 additions & 0 deletions api/signalwire-rest/fabric-api/sip_gateways/models/core.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import "../../../types";

using TypeSpec.Http;

model SipGatewayID {
@doc("Unique ID of a SIP Gateway.")
@path
id: uuid
}

model SipGatewayAddressPaginationResponse {
@doc("Link of the current page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=0&page_size=50")
self: url;

@doc("Link to the first page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=0&page_size=50")
first: url;

@doc("Link to the next page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca")
next: url;
}

model SipGatewayAddress {
@doc("Unique ID of the Fabric Address.")
@example("691af061-cd86-4893-a605-173f47afc4c2")
id: uuid;

@doc("Fabric resource ID that the Fabric Address belongs to.")
@example("691af061-cd86-4893-a605-173f47afc4c2")
resource_id: uuid;

@doc("Name of the Fabric Address.")
@example("justice-league")
name: string;

@doc("Display name of the Fabric Address.")
@example("Justice League")
display_name: string;

@doc("Type of the Fabric Address.")
@example(DisplayTypes.App)
type: DisplayTypes;

@doc("Cover url of the Fabric Address.")
@example("https://coverurl.com")
cover_url: string;

@doc("Preview url of the Fabric Address.")
@example("https://previewurl.com")
preview_url: string;

@doc("Channels of the Fabric Address.")
channel: AddressChannel;
}
15 changes: 15 additions & 0 deletions api/signalwire-rest/fabric-api/sip_gateways/models/errors.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "../../../types/status-codes";

using Types.StatusCodes;

@example(#{
errors: #[#{
type: "validation_error",
code: "missing_required_parameter",
message: "Name can't be blank",
attribute: "name",
url: "https://developer.signalwire.com/rest/signalwire-rest/overview/error-codes/#missing_required_parameter"
}],
})
model SipGatewayCreateStatusCode422 is StatusCode422;

23 changes: 23 additions & 0 deletions api/signalwire-rest/fabric-api/sip_gateways/models/requests.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
model SipGatewayCreateRequest {
@doc("Display name for the SIP Gateway.")
@example("Different SIP Endpoint Name")
name: string;

@doc("SIP URI for the endpoint.")
@example("[email protected]")
uri: string;

@doc("Specifies the encryption requirement for the SIP connection.")
@example("required")
encryption: "optional" | "required" | "disabled";

@doc("List of supported SIP ciphers.")
@example(#[ "AEAD_AES_256_GCM_8", "AES_256_CM_HMAC_SHA1_80" ])
ciphers: string[];

@doc("List of supported codecs for media transmission.")
@example(#["OPUS"])
codecs: string[];
}

alias SipGatewayUpdateRequest = SipGatewayCreateRequest;
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import "../../../types";

using TypeSpec.Http;
using TypeSpec.OpenAPI;

model SipGatewayCreateResponse {
@doc("Unique ID of the resource.")
@example("0823a606-0aff-4c90-9eba-f88ba118fe05")
id: string;

@doc("Project ID associated with the resource.")
@example("bc949800-7b40-43cf-8438-a85facfcbdd1")
project_id: string;

@doc("Display name of the SIP Gateway.")
@example("Different SIP Endpoint Name")
display_name: string;

@doc("Type of the resource.")
@example("sip_gateway")
type: "sip_gateway";

@doc("Timestamp when the resource was created.")
@example(utcDateTime.fromISO("2025-04-01T19:05:42Z"))
created_at: utcDateTime;

@doc("Timestamp when the resource was last updated.")
@example(utcDateTime.fromISO("2025-04-01T19:05:42Z"))
updated_at: utcDateTime;

@doc("SIP Gateway configuration details.")
sip_gateway: SipGateway;
}

model SipGatewayUpdateResponse extends SipGatewayCreateResponse {}
model SipGatewayResponse extends SipGatewayCreateResponse {}

model SipGateway {
@doc("Unique ID of the SIP Gateway.")
@example("cce59cad-104d-4c28-ada4-98cfd102ae09")
id: string;

@doc("SIP URI for the endpoint.")
@example("[email protected]")
uri: string;

@doc("Display name of the SIP Gateway.")
@example("Different SIP Endpoint Name")
name: string;

@doc("List of supported SIP ciphers.")
@example(#["AEAD_AES_256_GCM_8", "AES_256_CM_HMAC_SHA1_80"])
ciphers: string[];

@doc("List of supported codecs.")
@example(#["OPUS"])
codecs: string[];

@doc("Specifies the encryption requirement.")
@example("required")
encryption: "optional" | "required" | "disabled";
}

model SipGatewayListResponse {
@doc("List of SIP Gateways.")
data: SipGatewayCreateResponse[];

@doc("Pagination links for the response.")
links: SipGatewayPaginationResponse;
}

model SipGatewayPaginationResponse {
@doc("Link of the current page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways?page_number=0&page_size=50")
self: url;

@doc("Link to the first page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways?page_number=0&page_size=50")
first: url;

@doc("Link to the next page")
@example("https://{space_name}.signalwire.com/api/fabric/resources/sip_gateways?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca")
next: url;
}

model SipGatewayAddressListResponse {
data: SipGatewayAddress[];
links: SipGatewayAddressPaginationResponse;
}
Loading