# Inbound Rules

Manage your inbound rules.

## Export extension users

> Export a collection of extension users to file.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/users/export":{"get":{"tags":["Inbound Rule"],"operationId":"exportExtensions","summary":"Export extension users","description":"Export a collection of extension users to file.\n","responses":{"200":{"description":"OK","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"the format is `attachment; filename=\"example\"`"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"4XX":{"description":"Error"}}}}}}
```

## List inbound rules

> Retrieve a collection of inbound rules<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules":{"get":{"tags":["Inbound Rule"],"operationId":"listInboundRules","summary":"List inbound rules","description":"Retrieve a collection of inbound rules\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 inbound rule.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"Inbound rule name.\n"},"enabled":{"type":"boolean","default":true,"description":"Enabled or not.\n"},"usage":{"type":"string","enum":["BOTH","SIP","MESSAGE"],"default":"BOTH","description":"The inbound rule usage, can be either:  \n- `BOTH`: Applies to both messages and calls.\n- `SIP`: Applies to calls only.\n- `MESSAGE`: Applies to messages only.\n"},"cid_number_mask":{"type":"string","description":"The CID number Mask for inbound rule.  \nYou can add the number in it's entirety, identifying a single caller,   \nor use the * as a wildcard. For example 0044********** will identify a\nUK Caller and 004420******** will identify a caller from London.   \nNote: the * digits must matched number actually digits. If the number is 3 digits, then should use ***\nThe CID number mask also allow set a number range, for example: 00442012345670-00442012345680.\n"},"did_numbers":{"type":"string","minLength":1,"description":"A single DID/DDI number or a hyphen-separated range of DID/DDI numbers.\n"},"office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"non_office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"holiday_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of the holiday.\n"},"every_year":{"type":"boolean","description":"Does the holiday take effect every year.\n"},"consecutive":{"type":"boolean","description":"Whether the holiday consists of consecutive days.\n"},"year_start":{"type":"integer","description":"The start year of holiday.\n"},"year_end":{"type":"integer","description":"The end year of holiday.\n"},"month_start":{"type":"integer","description":"The start month of holiday.\n"},"month_end":{"type":"integer","description":"The end month of holiday.\n"},"day_start":{"type":"integer","description":"The start day of holiday.\n"},"day_end":{"type":"integer","description":"The end day of holiday.\n"},"hour_start":{"type":"integer","description":"The start hour of holiday.\n"},"hour_end":{"type":"integer","description":"The end hour of holiday.\n"},"minute_start":{"type":"integer","description":"The start minute of holiday.\n"},"minute_end":{"type":"integer","description":"The end minute of holiday.\n"}}},"description":"A collection of tenant's holiday.\n"},"provider_id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"},"enable_advanced_routing":{"type":"boolean","default":false,"description":"Whether to enable advanced routing.\n"},"advanced_routing":{"type":"string","description":"Advanced routing rules.\n"},"play_recording_disclaimer":{"type":"boolean","default":false,"description":"Whether to play recording disclaimer to inbound calls.\n"}}}}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Create an inbound rule

> Add a new inbound rule.\
> Please make sure you have at least one provider created before creating a new inbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules":{"post":{"tags":["Inbound Rule"],"operationId":"createInboundRule","summary":"Create an inbound rule","description":"Add a new inbound rule.\nPlease make sure you have at least one provider created before creating a new inbound rule.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"Inbound rule name.\n"},"enabled":{"type":"boolean","default":true,"description":"Enabled or not.\n"},"usage":{"type":"string","enum":["BOTH","SIP","MESSAGE"],"default":"BOTH","description":"The inbound rule usage, can be either:  \n- `BOTH`: Applies to both messages and calls.\n- `SIP`: Applies to calls only.\n- `MESSAGE`: Applies to messages only.\n"},"cid_number_mask":{"type":"string","description":"The CID number Mask for inbound rule.  \nYou can add the number in it's entirety, identifying a single caller,   \nor use the * as a wildcard. For example 0044********** will identify a\nUK Caller and 004420******** will identify a caller from London.   \nNote: the * digits must matched number actually digits. If the number is 3 digits, then should use ***\nThe CID number mask also allow set a number range, for example: 00442012345670-00442012345680.\n"},"did_numbers":{"type":"string","minLength":1,"description":"A single DID/DDI number or a hyphen-separated range of DID/DDI numbers.\n"},"office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"non_office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"holiday_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"description":"A collection of ID of tenant's holiday.\n"},"provider_id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"},"enable_advanced_routing":{"type":"boolean","default":false,"description":"Whether to enable advanced routing.\n"},"advanced_routing":{"type":"string","description":"Advanced routing rules.\n"},"play_recording_disclaimer":{"type":"boolean","default":false,"description":"Whether to play recording disclaimer to inbound calls.\n"}},"required":["name","did_numbers","provider_id"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of inbound rule.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Retrieve an inbound rule

> Retrieve an inbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules/{id}":{"get":{"tags":["Inbound Rule"],"operationId":"retrieveInboundRule","summary":"Retrieve an inbound rule","description":"Retrieve an inbound rule.\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 inbound rule.\n"},"description":"The unique ID of the inbound rule."}],"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 inbound rule.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"Inbound rule name.\n"},"enabled":{"type":"boolean","default":true,"description":"Enabled or not.\n"},"usage":{"type":"string","enum":["BOTH","SIP","MESSAGE"],"default":"BOTH","description":"The inbound rule usage, can be either:  \n- `BOTH`: Applies to both messages and calls.\n- `SIP`: Applies to calls only.\n- `MESSAGE`: Applies to messages only.\n"},"cid_number_mask":{"type":"string","description":"The CID number Mask for inbound rule.  \nYou can add the number in it's entirety, identifying a single caller,   \nor use the * as a wildcard. For example 0044********** will identify a\nUK Caller and 004420******** will identify a caller from London.   \nNote: the * digits must matched number actually digits. If the number is 3 digits, then should use ***\nThe CID number mask also allow set a number range, for example: 00442012345670-00442012345680.\n"},"did_numbers":{"type":"string","minLength":1,"description":"A single DID/DDI number or a hyphen-separated range of DID/DDI numbers.\n"},"office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"non_office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"holiday_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"type":"object","properties":{"id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"name":{"type":"string","minLength":1,"maxLength":64,"description":"The name of the holiday.\n"},"every_year":{"type":"boolean","description":"Does the holiday take effect every year.\n"},"consecutive":{"type":"boolean","description":"Whether the holiday consists of consecutive days.\n"},"year_start":{"type":"integer","description":"The start year of holiday.\n"},"year_end":{"type":"integer","description":"The end year of holiday.\n"},"month_start":{"type":"integer","description":"The start month of holiday.\n"},"month_end":{"type":"integer","description":"The end month of holiday.\n"},"day_start":{"type":"integer","description":"The start day of holiday.\n"},"day_end":{"type":"integer","description":"The end day of holiday.\n"},"hour_start":{"type":"integer","description":"The start hour of holiday.\n"},"hour_end":{"type":"integer","description":"The end hour of holiday.\n"},"minute_start":{"type":"integer","description":"The start minute of holiday.\n"},"minute_end":{"type":"integer","description":"The end minute of holiday.\n"}}},"description":"A collection of tenant's holiday.\n"},"provider_id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"},"enable_advanced_routing":{"type":"boolean","default":false,"description":"Whether to enable advanced routing.\n"},"advanced_routing":{"type":"string","description":"Advanced routing rules.\n"},"play_recording_disclaimer":{"type":"boolean","default":false,"description":"Whether to play recording disclaimer to inbound calls.\n"}}}}}},"4XX":{"description":"Error"}}}}}}
```

## Update an inbound rule

> Update an inbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules/{id}":{"post":{"tags":["Inbound Rule"],"operationId":"updateInboundRule","summary":"Update an inbound rule","description":"Update an inbound rule.\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 inbound rule.\n"},"description":"The unique ID of the inbound rule."}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"description":"Inbound rule name.\n"},"enabled":{"type":"boolean","default":true,"description":"Enabled or not.\n"},"usage":{"type":"string","enum":["BOTH","SIP","MESSAGE"],"default":"BOTH","description":"The inbound rule usage, can be either:  \n- `BOTH`: Applies to both messages and calls.\n- `SIP`: Applies to calls only.\n- `MESSAGE`: Applies to messages only.\n"},"cid_number_mask":{"type":"string","description":"The CID number Mask for inbound rule.  \nYou can add the number in it's entirety, identifying a single caller,   \nor use the * as a wildcard. For example 0044********** will identify a\nUK Caller and 004420******** will identify a caller from London.   \nNote: the * digits must matched number actually digits. If the number is 3 digits, then should use ***\nThe CID number mask also allow set a number range, for example: 00442012345670-00442012345680.\n"},"did_numbers":{"type":"string","minLength":1,"description":"A single DID/DDI number or a hyphen-separated range of DID/DDI numbers.\n"},"office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"non_office_hours_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"holiday_forward_rule":{"type":"object","properties":{"action":{"type":"string","enum":["FORWARD_TO_NUMBER","FORWARD_TO_VOICEMAIL","HANGUP"],"description":"Forward action can be either:  \n- `FORWARD_TO_NUMBER`:\n- `FORWARD_TO_VOICEMAIL`:\n- `HANGUP`: finish call\n"},"number":{"type":"string","description":"Specify the forwarding destination number.  \nCan be either:  \n- Extension number: The extension number of PortSIP PBX.\n- External number: The numeric sequence of numbers, with or without a plus sign at the beginning.\n"}}},"office_hours":{"allOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["GLOBAL","CUSTOM"],"description":"The office hours mode can be either:  \n- `GLOBAL`: Use global office hours.\n- `CUSTOM`: Use specific office hours.\n"}}},{"type":"object","properties":{"monday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"tuesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"wednesday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"thursday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"friday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"saturday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}},"sunday":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, all day is working time, when disabled, all day is vacation time.\n"},"ranges":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"09:00\".  \nMust be earlier than `to`.\n"},"to":{"type":"string","description":"The start time for office hour with format `HH:MM` in 24 hour clock, such as \"17:00\".  \nMust be later than `from`.\n"}}},"description":"Multiple start and end time periods make up the working time.\n"}}}}}]},"holidays":{"type":"array","items":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"readOnly":true,"description":"The unique ID of holiday.\n"},"description":"A collection of ID of tenant's holiday.\n"},"provider_id":{"allOf":[{"type":"string","description":"The unique ID of the resource.\n"}],"description":"The unique ID of trunk.\n"},"enable_advanced_routing":{"type":"boolean","default":false,"description":"Whether to enable advanced routing.\n"},"advanced_routing":{"type":"string","description":"Advanced routing rules.\n"},"play_recording_disclaimer":{"type":"boolean","default":false,"description":"Whether to play recording disclaimer to inbound calls.\n"}}}}}},"responses":{"200":{"description":"OK"},"4XX":{"description":"Error"}}}}}}
```

## Delete an inbound rule

> Destroy an inbound rule.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules/{id}/destroy":{"post":{"tags":["Inbound Rule"],"operationId":"deleteInboundRule","summary":"Delete an inbound rule","description":"Destroy an inbound rule.\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 inbound rule.\n"},"description":"The unique ID of the inbound rule."}],"responses":{"204":{"description":"No Content"},"400":{"description":"Invalid inbound rule ID supplied"}}}}}}
```

## Export inbound rules

> Export a collection of inbound rules to file.<br>

```json
{"openapi":"3.1.0","info":{"title":"PortSIP PBX Rest API","version":"22.3"},"tags":[{"name":"Inbound Rule","description":"Manage your inbound rules.\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":{"/inbound_rules/export":{"get":{"tags":["Inbound Rule"],"operationId":"exportInboundRules","summary":"Export inbound rules","description":"Export a collection of inbound rules to file.\n","responses":{"200":{"description":"OK","headers":{"Content-Disposition":{"schema":{"type":"string"},"description":"the format is `attachment; filename=\"example\"`"}},"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"4XX":{"description":"Error"}}}}}}
```


---

# 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/inbound-rules.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.
