# Media Server

Manage your media servers.

## List media servers

> Retrieve a collection of media servers<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers":{"get":{"tags":["Media Server"],"operationId":"listMediaServers","summary":"List media servers","description":"Retrieve a collection of media servers\n","parameters":[{"name":"filter","in":"query","required":false,"schema":{"type":"string"},"description":"Use the `filter` query parameter to retrieve just a subset of a collection.\n"},{"name":"search","in":"query","required":false,"schema":{"type":"string"},"description":"Use the `search` query parameter to restrict the results of a request to match a search criterion.\n"},{"name":"orderby","in":"query","required":false,"schema":{"type":"string"},"description":"Use the `orderby` query parameter to specify the sort order of the items returned from server.  \nThe default order is ascending order.\n"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","format":"int32","minimum":0,"default":0},"description":"Use the `skip` query parameter to set the number of items to skip at the start of a collection.\n"},{"name":"top","in":"query","required":false,"schema":{"type":"integer","format":"int32","minimum":1,"maximum":100,"default":100},"description":"Use the `top` query parameter to specify the page size of the result set.\n"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","format":"int64","minimum":0,"description":"Total number of resource.\n"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of media server.\n"},"type":{"type":"string","enum":["INTERNAL","EXTERNAL"],"readOnly":true,"description":"Every PortSIP PBX has a built-in media server marked as `INTERNAL`;   \nNewly added media servers will be marked as \"EXTERNAL\".\n"},"enabled":{"type":"boolean","default":true,"description":"The activate status or deactivated status.\n"},"private_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"private_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"public_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"public_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"max_concurrency":{"type":"integer","format":"int32","minimum":1,"default":2000,"description":"Max concurrent sessions.\n"},"custom_options":{"type":"string","description":"Some custom configuration options serialized as json string\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## POST /media\_servers

> Create a media server

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers":{"post":{"tags":["Media Server"],"operationId":"createMediaServer","summary":"Create a media server","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of media server.\n"},"enabled":{"type":"boolean","default":true,"description":"The activate status or deactivated status.\n"},"private_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"private_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"public_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"public_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"max_concurrency":{"type":"integer","format":"int32","minimum":1,"default":2000,"description":"Max concurrent sessions.\n"},"custom_options":{"type":"string","description":"Some custom configuration options serialized as json string\n"}},"required":["name"]}}}},"responses":{"200":{"description":"Created media server","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Retrieve a media server

> Retrieve a media server.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers/{id}":{"get":{"tags":["Media Server"],"operationId":"getMediaServer","summary":"Retrieve a media server","description":"Retrieve a media server.\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"description":"The unique ID of the media server."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of media server.\n"},"type":{"type":"string","enum":["INTERNAL","EXTERNAL"],"readOnly":true,"description":"Every PortSIP PBX has a built-in media server marked as `INTERNAL`;   \nNewly added media servers will be marked as \"EXTERNAL\".\n"},"enabled":{"type":"boolean","default":true,"description":"The activate status or deactivated status.\n"},"private_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"private_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"public_ipv4":{"type":"string","description":"Host IPV4 address.\n"},"public_ipv6":{"type":"string","description":"Host IPV6 address.\n"},"max_concurrency":{"type":"integer","format":"int32","minimum":1,"default":2000,"description":"Max concurrent sessions.\n"},"custom_options":{"type":"string","description":"Some custom configuration options serialized as json string\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Update a media server

> Update a media server<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers/{id}":{"post":{"tags":["Media Server"],"operationId":"updateMediaServer","summary":"Update a media server","description":"Update a media server\n","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"description":"The unique ID of the media server."}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean","default":true,"description":"The activate status or deactivated status.\n"},"max_concurrency":{"type":"integer","format":"int32","minimum":1,"default":2000,"description":"Max concurrent sessions.\n"},"custom_options":{"type":"string","description":"Some custom configuration options serialized as json string\n"}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## Query media server Status

> Query media server's status by it's ID

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers/{id}/status":{"get":{"tags":["Media Server"],"operationId":"getMediaServerStatus","summary":"Query media server Status","description":"Query media server's status by it's ID","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"description":"The unique ID of the media server."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"current_concurrency":{"type":"integer","format":"int32","description":"Current concurrent sessions.\n"},"cpu_usage":{"type":"integer","description":"CPU usage.\n"},"memory_usage":{"type":"integer","description":"Memory usage.\n"},"status":{"type":"string","enum":["OFFLINE","ONLINE"],"readOnly":true,"description":"Server status includes:\n- `OFFLINE`:\n- `ONLINE`:\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## POST /media\_servers/{id}/destroy

> Delete a media server

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Media Server","description":"Manage your media servers.\n"}],"servers":[{"url":"{protocol}://{hostname}:{port}/api","variables":{"protocol":{"description":"Self-hosted Enterprise Server protocol.","default":"https"},"hostname":{"description":"Self-hosted Enterprise Server hostname.","default":"HOSTNAME"},"port":{"description":"Self-hosted Enterprise Server port.","default":"8887"}}}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}},"paths":{"/media_servers/{id}/destroy":{"post":{"tags":["Media Server"],"operationId":"deleteMediaServer","summary":"Delete a media server","parameters":[{"name":"id","in":"path","required":true,"schema":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of media server.\n"},"description":"The unique ID of the media server."}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid server ID supplied."}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.portsip.com/development-portsip/rest-apis/version-22.3/media-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
