diff --git a/.version b/.version new file mode 100644 index 0000000000..b7c73efac8 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +23.0.0-rc1 diff --git a/CHANGES.html b/CHANGES.html new file mode 120000 index 0000000000..10a9546dc2 --- /dev/null +++ b/CHANGES.html @@ -0,0 +1 @@ +ChangeLogs/ChangeLog-23.0.0-rc1.html \ No newline at end of file diff --git a/CHANGES.md b/CHANGES.md new file mode 120000 index 0000000000..9526b33867 --- /dev/null +++ b/CHANGES.md @@ -0,0 +1 @@ +ChangeLogs/ChangeLog-23.0.0-rc1.md \ No newline at end of file diff --git a/ChangeLogs/ChangeLog-23.0.0-rc1.html b/ChangeLogs/ChangeLog-23.0.0-rc1.html new file mode 100644 index 0000000000..1d9bca3a0c --- /dev/null +++ b/ChangeLogs/ChangeLog-23.0.0-rc1.html @@ -0,0 +1,813 @@ +ChangeLog for asterisk-23.0.0-rc1 +

Change Log for Release asterisk-23.0.0-rc1

+

Links:

+ +

Summary:

+ +

User Notes:

+ +

Upgrade Notes:

+ +

Developer Notes:

+ +

Commit Authors:

+ +

Issue and Commit Detail:

+

Closed Issues:

+ +

Commits By Author:

+ +

Commit List:

+ +

Commit Details:

+

Prepare for Asterisk 23

+

Author: Mike Bradeen + Date: 2024-08-14

+

config.c Make ast_variable_update update last match.

+

Author: Naveen Albert + Date: 2024-10-23

+

ast_variable_update currently sets the first match for a variable, as + opposed to the last one. This issue is complementary to that raised + in #244.

+

This is incorrect and results in the wrong (or no) action being taken + in cases where a section inherits from a template section. When the + traversal occurs to update the setting, the existing code erroneously + would use the first of possibly multiple matches in its update logic, + which is wrong. Now, explicitly use the last match in the traversal, + which will ensure that the actual setting is updated properly, and + not skipped or ignored because a template from which the setting's + section inherits was used for comparison.

+

Resolves: #960

+

UpgradeNote: Config variables, when set/updated, such as via AMI, + will now have the corresponding setting updated, even if their + sections inherit from template sections.

+

config.c: Make ast_variable_retrieve return last match.

+

Author: Naveen Albert + Date: 2023-08-09

+

ast_variable_retrieve currently returns the first match + for a variable, as opposed to the last one. This is problematic + because modules that load config settings by explicitly + calling ast_variable_retrieve on a variable name (as opposed + to iterating through all the directives as specified) will + end up taking the first specified value, such as the default + value from the template rather than the actual effective value + in an individual config section, leading to the wrong config.

+

This fixes this by making ast_variable_retrieve return the last + match, or the most recently overridden one, as the effective setting. + This is similar to what the -1 index in the AST_CONFIG function does.

+

There is another function, ast_variable_find_last_in_list, that does + something similar. However, it's a slightly different API, and it + sees virtually no usage in Asterisk. ast_variable_retrieve is what + most things use so this is currently the relevant point of breakage.

+

In practice, this is unlikely to cause any breakage, since there + would be no logical reason to use an inherited value rather than + an explicitly overridden value when loading a config.

+

ASTERISK-30370 #close

+

Resolves: #244

+

UpgradeNote: Config variables retrieved explicitly by name now return + the most recently overriding value as opposed to the base value (e.g. + from a template). This is equivalent to retrieving a config setting + using the -1 index to the AST_CONFIG function. The major implication of + this is that modules processing configs by explicitly retrieving variables + by name will now get the effective value of a variable as overridden in + a config rather than the first-set value (from a template), which is + consistent with how other modules load config settings.

+

utils: Remove libdb and astdb conversion scripts.

+

Author: Sean Bright + Date: 2025-01-29

+

These were included with Asterisk 10 when we switched astdb from libdb + to sqlite3.

+

config.c: Fix inconsistent pointer logic in ast_variable_update.

+

Author: Naveen Albert + Date: 2025-03-06

+

Commit 3cab4e7ab4a3ae483430d5f5e8fa167d02a8128c introduced a + regression by causing the wrong pointers to be used in certain + (more complex) cases. We now take care to ensure the exact + same pointers are used as before that commit, and simplify + by eliminating the unnecessary second for loop.

+

Resolves: #1147

+

channel: Deprecate ast_moh_cleanup(...).

+

Author: Sean Bright + Date: 2025-04-08

+

We don't want anyone calling it but the channel destructor.

+

func_callerid: Always format ANI2 as two digits.

+

Author: Naveen Albert + Date: 2025-04-26

+

ANI II is always supposed to be formatted as two digits, + so zero pad when formatting it if necessary.

+

Resolves: #1222

+

users.conf: Remove deprecated users.conf integration.

+

Author: Naveen Albert + Date: 2025-07-09

+

users.conf was deprecated in Asterisk 21 and is now being removed + for Asterisk 23, in accordance with the Asterisk deprecation policy.

+

This consists of: + * Removing integration with app_directory, app_voicemail, chan_dahdi, + chan_iax2, and AMI. + * users.conf was also partially used for res_phoneprov, and this remaining + functionality is consolidated to a separate phoneprov_users.conf, + used only by res_phoneprov.

+

Resolves: #1292

+

UpgradeNote: users.conf has been removed and all channel drivers must + be configured using their specific configuration files. The functionality + previously in users.conf for res_phoneprov is now in phoneprov_users.conf.

+

res_agi: Remove deprecated DeadAGI application.

+

Author: Naveen Albert + Date: 2023-08-11

+

DeadAGI was deprecated 7 years ago, in Asterisk 15, + as it duplicates functionality in the AGI app. + This removes the application.

+

Resolves: #258

+

UpgradeNote: The DeadAGI application, which was + deprecated in Asterisk 15, has now been removed. + The same functionality is available in the AGI app.

+

res_musiconhold: Remove options that were deprecated in Asterisk 14.

+

Author: Naveen Albert + Date: 2025-07-09

+

Commit 9c1f34c7e904b26bb550f426020635894cb805ac added dedicated options + for random sorting functionality and deprecated older options that + now duplicated these capabilities. Remove these deprecated options.

+

Resolves: #1296

+

UpgradeNote: The deprecated random and application=r options have + been removed; use sort=random instead.

+

app_voicemail: Remove deprecated options.

+

Author: Naveen Albert + Date: 2025-07-10

+

Remove the deprecated maxmessage and minmessage options, + which have been superseded by maxsecs and minsecs since 1.6. + Also remove the deprecated 'cz' language option (deprecated + since 1.8.)

+

Resolves: #1298

+

UpgradeNote: The deprecated maxmessage and minmessage options + have been removed; use maxsecs and minsecs instead. + The deprecated 'cz' language has also been removed; use 'cs' instead.

+

app_queue: Remove redundant/deprecated function.

+

Author: Naveen Albert + Date: 2025-08-07

+

QUEUE_MEMBER_COUNT has been deprecated since at least 1.6, + for fully duplicating functionality available in the + QUEUE_MEMBER function; remove it now.

+

Resolves: #1341

+

UpgradeNote: The deprecated QUEUE_MEMBER_COUNT function + has been removed; use QUEUE_MEMBER(,logged) instead.

+

cli.c: Remove deprecated and redundant CLI command.

+

Author: Naveen Albert + Date: 2025-08-07

+

The "no debug channel" command has been deprecated since + 1.6 (commit 691363656fbdc83edf04b125317aebae6525c9e7), + as it is replaced by "core set debug channel", which also + supports tab-completion on channels. Remove the redundant + command.

+

Resolves: #1343

+

UpgradeNote: The deprecated "no debug channel" command has + now been removed; use "core set debug channel" instead.

+

logger.c: Remove deprecated/redundant configuration option.

+

Author: Naveen Albert + Date: 2025-08-07

+

Remove the deprecated 'rotatetimestamp' config option, as this + was deprecated by 'rotatestrategy' in 1.6 by commit + f5a14167f3ef090f8576da3070ed5c452fa01e44.

+

Resolves: #1345

+

UpgradeNote: The deprecated rotatetimestamp option has been removed. + Use rotatestrategy instead.

+

func_dialplan: Remove deprecated/redundant function.

+

Author: Naveen Albert + Date: 2025-08-07

+

Remove VALID_EXTEN, which was deprecated/superseded by DIALPLAN_EXISTS + in Asterisk 11 (commit 8017b65bb97c4226ca7a3c7c944a9811484e0305), + as DIALPLAN_EXISTS does the same thing and is more flexible.

+

Resolves: #1347

+

UpgradeNote: The deprecated VALID_EXTEN function has been removed. + Use DIALPLAN_EXISTS instead.

+

Update version for Asterisk 23

+

Author: Ben Ford + Date: 2025-08-13

+

chan_websocket.c: Add DTMF messages

+

Author: Joe Garlick + Date: 2025-09-04

+

Added DTMF messages to the chan_websocket feature.

+

When a user presses DTMF during a call over chan_websocket it will send a message like: + "DTMF_END digit:1"

+

Resolves: https://github.com/asterisk/asterisk-feature-requests/issues/70

+

app_queue.c: Add new global 'log_unpause_on_reason_change'

+

Author: Igor Goncharovsky + Date: 2025-09-02

+

In many asterisk-based systems, the pause reason is used to separate + pauses by type,and logically, changing the reason defines two intervals + that should be accounted for separately. The introduction of a new + option allows me to separate the intervals of operator inactivity in + the log by the event of unpausing.

+

UserNote: Add new global option 'log_unpause_on_reason_change' that + is default disabled. When enabled cause addition of UNPAUSE event on + every re-PAUSE with reason changed.

+

app_waitforsilence.c: Use milliseconds to calculate timeout time

+

Author: Igor Goncharovsky + Date: 2025-09-04

+

The functions WaitForNoise() and WaitForSilence() use the time() + functions to calculate elapsed time, which causes the timer to fire on + a whole second boundary, and the actual function execution time to fire + the timer may be 1 second less than expected. This fix replaces time() + with ast_tvnow().

+

Fixes: #1401

+

res_rtp_asterisk: Don't send RTP before DTLS has negotiated.

+

Author: Ben Ford + Date: 2025-08-04

+

There was no check in __rtp_sendto that prevented Asterisk from sending + RTP before DTLS had finished negotiating. This patch adds logic to do + so.

+

Fixes: #1260

+

Fix missing ast_test_flag64 in extconf.c

+

Author: Artem Umerov + Date: 2025-08-29

+

Fix missing ast_test_flag64 after https://github.com/asterisk/asterisk/commit/43bf8a4ded7a65203b766b91eaf8331a600e9d8d

+

pbx_builtins: Allow custom tone for WaitExten.

+

Author: Naveen Albert + Date: 2025-08-25

+

Currently, the 'd' option will play dial tone while waiting + for digits. Allow it to accept an argument for any tone from + indications.conf.

+

Resolves: #1396

+

UserNote: The tone used while waiting for digits in WaitExten + can now be overridden by specifying an argument for the 'd' + option.

+

res_tonedetect: Add option for TONE_DETECT detection to auto stop.

+

Author: Naveen Albert + Date: 2025-08-22

+

One of the problems with TONE_DETECT as it was originally written + is that if a tone is detected multiple times, it can trigger + the redirect logic multiple times as well. For example, if we + do an async goto in the dialplan after detecting a tone, because + the detector is still active until explicitly disabled, if we + detect the tone again, we will branch again and start executing + that dialplan a second time. This is rarely ever desired behavior, + and can happen if the detector is not removed quickly enough.

+

Add a new option, 'e', which automatically disables the detector + once the desired number of matches have been heard. This eliminates + the potential race condition where previously the detector would + need to be disabled immediately, but doing so quickly enough + was not guaranteed. This also allows match criteria to be retained + longer if needed, so the detector does not need to be destroyed + prematurely.

+

Resolves: #1390

+

UserNote: The 'e' option for TONE_DETECT now allows detection to + be disabled automatically once the desired number of matches have + been fulfilled, which can help prevent race conditions in the + dialplan, since TONE_DETECT does not need to be disabled after + a hit.

+

app_queue: fix comparison for announce-position-only-up

+

Author: Stuart Henderson + Date: 2025-08-21

+

Numerically comparing that the current queue position is less than + last_pos_said can only be done after at least one announcement has been + made, otherwise last_pos_said is at the default (0).

+

Fixes: #1386

+

res_pjsip_authenticator_digest: Fix SEGV if get_authorization_hdr returns NULL.

+

Author: George Joseph + Date: 2025-08-28

+

In the highly-unlikely event that get_authorization_hdr() couldn't find an + Authorization header in a request, trying to get the digest algorithm + would cauase a SEGV. We now check that we have an auth header that matches + the realm before trying to get the algorithm from it.

+

Resolves: #GHSA-64qc-9x89-rx5j

+

sorcery: Prevent duplicate objects and ensure missing objects are created on u..

+

Author: Alexei Gradinari + Date: 2025-07-07

+

This patch resolves two issues in Sorcery objectset handling with multiple + backends:

+
    +
  1. +

    Prevent duplicate objects: + When an object exists in more than one backend (e.g., a contact in both + 'astdb' and 'realtime'), the objectset previously returned multiple instances + of the same logical object. This caused logic failures in components like the + PJSIP registrar, where duplicate contact entries led to overcounting and + incorrect deletions, when max_contacts=1 and remove_existing=yes.

    +

    This patch ensures only one instance of an object with a given key is added + to the objectset, avoiding these duplicate-related side effects.

    +
  2. +
  3. +

    Ensure missing objects are created: + When using multiple writable backends, a temporary backend failure can lead + to objects missing permanently from that backend. + Currently, .update() silently fails if the object is not present, + and no .create() is attempted. + This results in inconsistent state across backends (e.g. astdb vs. realtime).

    +

    This patch introduces a new global option in sorcery.conf: + [general] + update_or_create_on_update_miss = yes|no

    +

    Default: no (preserves existing behavior).

    +

    When enabled: if .update() fails with no data found, .create() is attempted + in that backend. This ensures that objects missing due to temporary backend + outages are re-synchronized once the backend is available again.

    +

    Added a new CLI command: + sorcery show settings + Displays global Sorcery settings, including the current value of + update_or_create_on_update_miss.

    +

    Updated tests to validate both flag enabled/disabled behavior.

    +
  4. +
+

Fixes: #1289

+

UserNote: Users relying on Sorcery multiple writable backends configurations + (e.g., astdb + realtime) may now enable update_or_create_on_update_miss = yes + in sorcery.conf to ensure missing objects are recreated after temporary backend + failures. Default behavior remains unchanged unless explicitly enabled.

+

sig_analog: Skip Caller ID spill if usecallerid=no.

+

Author: Naveen Albert + Date: 2025-08-25

+

If Caller ID is disabled for an FXS port, then we should not send any + Caller ID spill on the line, as we have no Caller ID information that + we can/should be sending.

+

Resolves: #1394

+

chan_dahdi: Fix erroneously persistent dialmode.

+

Author: Naveen Albert + Date: 2025-08-18

+

It is possible to modify the dialmode setting in the chan_dahdi/sig_analog + private using the CHANNEL function, to modify it during calls. However, + it was not being reset between calls, meaning that if, for example, tone + dialing was disabled, it would never work again unless explicitly enabled.

+

This fixes the setting by pairing it with a "perm" version of the setting, + as a few other features have, so that it can be reset to the permanent + setting between calls. The documentation is also clarified to explain + the interaction of this setting and the digitdetect setting more clearly.

+

Resolves: #1378

+

chan_websocket: Allow additional URI parameters to be added to the outgoing URI.

+

Author: George Joseph + Date: 2025-08-13

+ +

Resolves: #1352

+

UserNote: A new WebSocket channel driver option v has been added to the + Dial application that allows you to specify additional URI parameters on + outgoing connections. Run core show application Dial from the Asterisk CLI + to see how to use it.

+

chan_websocket: Fix buffer overrun when processing TEXT websocket frames.

+

Author: George Joseph + Date: 2025-08-19

+

ast_websocket_read() receives data into a fixed 64K buffer then continually + reallocates a final buffer that, after all continuation frames have been + received, is the exact length of the data received and returns that to the + caller. process_text_message() in chan_websocket was attempting to set a + NULL terminator on the received payload assuming the payload buffer it + received was the large 64K buffer. The assumption was incorrect so when it + tried to set a NULL terminator on the payload, it could, depending on the + state of the heap at the time, cause heap corruption.

+

process_text_message() now allocates its own payload_len + 1 sized buffer, + copies the payload received from ast_websocket_read() into it then NULL + terminates it prevent the possibility of the overrun and corruption.

+

Resolves: #1384

+

sig_analog: Fix SEGV due to calling strcmp on NULL.

+

Author: Naveen Albert + Date: 2025-08-18

+

Add an additional check to guard against the channel application being + NULL.

+

Resolves: #1380

+

ARI: Add command to indicate progress to a channel

+

Author: Sven Kube + Date: 2025-07-30

+

Adds an ARI command to send a progress indication to a channel.

+

DeveloperNote: A new ARI endpoint is available at /channels/{channelId}/progress to indicate progress to a channel.

+

dsp.c: Improve debug logging in tone_detect().

+

Author: Naveen Albert + Date: 2025-08-15

+

The debug logging during DSP processing has always been kind + of overwhelming and annoying to troubleshoot. Simplify and + improve the logging in a few ways to aid DSP debugging:

+ +

Resolves: #1375

+

res_stasis_device_state: Fix delete ARI Devicestates after asterisk restart.

+

Author: Jose Lopes + Date: 2025-07-30

+

After an asterisk restart, the deletion of ARI Devicestates didn't + return error, but the devicestate was not deleted. + Found a typo on populate_cache function that created wrong cache for + device states. + This bug caused wrong assumption that devicestate didn't exist, + since it was not in cache, so deletion didn't returned error.

+

Fixes: #1327

+

app_chanspy: Add option to not automatically answer channel.

+

Author: Naveen Albert + Date: 2025-08-13

+

Add an option for ChanSpy and ExtenSpy to not answer the channel + automatically. Most applications that auto-answer by default + already have an option to disable this behavior if unwanted.

+

Resolves: #1358

+

UserNote: ChanSpy and ExtenSpy can now be configured to not + automatically answer the channel by using the 'N' option.

+

xmldoc.c: Fix rendering of CLI output.

+

Author: George Joseph + Date: 2025-08-14

+

If you do a core show application Dial, you'll see it's kind of a mess. + Indents are wrong is some places, examples are printed in black which makes + them invisible on most terminals, and the lack of line breaks in some cases + makes it hard to follow.

+ +

Example from Dial before fixes: + ``` + Example: Dial 555-1212 on first available channel in group 1, searching + from highest to lowest

+
  Example: Ringing FXS channel 4 with ring cadence 2
+
+  Example: Dial 555-1212 on channel 3 and require answer confirmation
+
+

...

+
  O([mode]):
+      mode - With <mode> either not specified or set to '1', the originator
+      hanging up will cause the phone to ring back immediately.
+
+ +

After: + ``` + Example: Dial 555-1212 on first available channel in group 1, searching + from highest to lowest

+
   same => n,Dial(DAHDI/g1/5551212)
+
+  Example: Ringing FXS channel 4 with ring cadence 2
+
+   same => n,Dial(DAHDI/4r2)
+
+  Example: Dial 555-1212 on channel 3 and require answer confirmation
+
+   same => n,Dial(DAHDI/3c/5551212)
+
+

...

+
  O([mode]):
+      mode - With <mode> either not specified or set to '1', the originator
+      hanging up will cause the phone to ring back immediately.
+      With <mode> set to '2', when the operator flashes the trunk, it will
+      ring their phone back.
+      Enables *operator services* mode.  This option only works when bridging
+      a DAHDI channel to another DAHDI channel only. If specified on
+      non-DAHDI interfaces, it will be ignored. When the destination answers
+      (presumably an operator services station), the originator no longer has
+      control of their line. They may hang up, but the switch will not
+      release their line until the destination party (the operator) hangs up.
+
+  p:
+      This option enables screening mode. This is basically Privacy mode
+      without memory.
+
+

```

+

There are still things we can do to make this more readable but this is a + start.

+

func_frame_drop: Add debug messages for dropped frames.

+

Author: Naveen Albert + Date: 2025-08-14

+

Add debug messages in scenarios where frames that are usually processed + are dropped or skipped.

+

Resolves: #1371

+

test_res_prometheus: Fix compilation failure on Debian 13.

+

Author: Naveen Albert + Date: 2025-08-14

+

curl_easy_setopt expects long types, so be explicit.

+

Resolves: #1369

+

func_frame_drop: Handle allocation failure properly.

+

Author: Naveen Albert + Date: 2025-08-14

+

Handle allocation failure and simplify the allocation using asprintf.

+

Resolves: #1366

+

pbx_lua.c: segfault when pass null data to term_color function

+

Author: Alexey Khabulyak + Date: 2025-08-14

+

This can be reproduced under certain curcomstences. + For example: call app.playback from lua with invalid data: app.playback({}). + pbx_lua.c will try to get data for this playback using lua_tostring function. + This function returs NULL for everything but strings and numbers. + Then, it calls term_color with NULL data. + term_color function can call(if we don't use vt100 compat term) + ast_copy_string with NULL inbuf which cause segfault. bt example: + ast_copy_string (size=8192, src=0x0, dst=0x7fe44b4be8b0) + at /usr/src/asterisk/asterisk-20.11.0/include/asterisk/strings.h:412

+

Resolves: https://github.com/asterisk/asterisk/issues/1363

+

bridge.c: Obey BRIDGE_NOANSWER variable to skip answering channel.

+

Author: Naveen Albert + Date: 2025-08-14

+

If the BRIDGE_NOANSWER variable is set on a channel, it is not supposed + to answer when another channel bridges to it using Bridge(), and this is + checked when ast_bridge_call* is called. However, another path exists + (bridge_exec -> ast_bridge_add_channel) where this variable was not + checked and channels would be answered. We now check the variable there.

+

Resolves: #401 + Resolves: #1364

+ diff --git a/ChangeLogs/ChangeLog-23.0.0-rc1.md b/ChangeLogs/ChangeLog-23.0.0-rc1.md new file mode 100644 index 0000000000..1bf15ff79c --- /dev/null +++ b/ChangeLogs/ChangeLog-23.0.0-rc1.md @@ -0,0 +1,918 @@ + +## Change Log for Release asterisk-23.0.0-rc1 + +### Links: + + - [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-23.0.0-rc1.html) + - [GitHub Diff](https://github.com/asterisk/asterisk/compare/23.0.0-pre1...23.0.0-rc1) + - [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-23.0.0-rc1.tar.gz) + - [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk) + +### Summary: + +- Commits: 41 +- Commit Authors: 13 +- Issues Resolved: 32 +- Security Advisories Resolved: 1 + - [GHSA-64qc-9x89-rx5j](https://github.com/asterisk/asterisk/security/advisories/GHSA-64qc-9x89-rx5j): A specifically malformed Authorization header in an incoming SIP request can cause Asterisk to crash + +### User Notes: + +- #### app_queue.c: Add new global 'log_unpause_on_reason_change' + Add new global option 'log_unpause_on_reason_change' that + is default disabled. When enabled cause addition of UNPAUSE event on + every re-PAUSE with reason changed. + +- #### pbx_builtins: Allow custom tone for WaitExten. + The tone used while waiting for digits in WaitExten + can now be overridden by specifying an argument for the 'd' + option. + +- #### res_tonedetect: Add option for TONE_DETECT detection to auto stop. + The 'e' option for TONE_DETECT now allows detection to + be disabled automatically once the desired number of matches have + been fulfilled, which can help prevent race conditions in the + dialplan, since TONE_DETECT does not need to be disabled after + a hit. + +- #### sorcery: Prevent duplicate objects and ensure missing objects are created on u.. + Users relying on Sorcery multiple writable backends configurations + (e.g., astdb + realtime) may now enable update_or_create_on_update_miss = yes + in sorcery.conf to ensure missing objects are recreated after temporary backend + failures. Default behavior remains unchanged unless explicitly enabled. + +- #### chan_websocket: Allow additional URI parameters to be added to the outgoing URI. + A new WebSocket channel driver option `v` has been added to the + Dial application that allows you to specify additional URI parameters on + outgoing connections. Run `core show application Dial` from the Asterisk CLI + to see how to use it. + +- #### app_chanspy: Add option to not automatically answer channel. + ChanSpy and ExtenSpy can now be configured to not + automatically answer the channel by using the 'N' option. + + +### Upgrade Notes: + +- #### config.c Make ast_variable_update update last match. + Config variables, when set/updated, such as via AMI, + will now have the corresponding setting updated, even if their + sections inherit from template sections. + +- #### config.c: Make ast_variable_retrieve return last match. + Config variables retrieved explicitly by name now return + the most recently overriding value as opposed to the base value (e.g. + from a template). This is equivalent to retrieving a config setting + using the -1 index to the AST_CONFIG function. The major implication of + this is that modules processing configs by explicitly retrieving variables + by name will now get the effective value of a variable as overridden in + a config rather than the first-set value (from a template), which is + consistent with how other modules load config settings. + +- #### users.conf: Remove deprecated users.conf integration. + users.conf has been removed and all channel drivers must + be configured using their specific configuration files. The functionality + previously in users.conf for res_phoneprov is now in phoneprov_users.conf. + +- #### res_agi: Remove deprecated DeadAGI application. + The DeadAGI application, which was + deprecated in Asterisk 15, has now been removed. + The same functionality is available in the AGI app. + +- #### res_musiconhold: Remove options that were deprecated in Asterisk 14. + The deprecated random and application=r options have + been removed; use sort=random instead. + +- #### app_voicemail: Remove deprecated options. + The deprecated maxmessage and minmessage options + have been removed; use maxsecs and minsecs instead. + The deprecated 'cz' language has also been removed; use 'cs' instead. + +- #### app_queue: Remove redundant/deprecated function. + The deprecated QUEUE_MEMBER_COUNT function + has been removed; use QUEUE_MEMBER(,logged) instead. + +- #### cli.c: Remove deprecated and redundant CLI command. + The deprecated "no debug channel" command has + now been removed; use "core set debug channel" instead. + +- #### logger.c: Remove deprecated/redundant configuration option. + The deprecated rotatetimestamp option has been removed. + Use rotatestrategy instead. + +- #### func_dialplan: Remove deprecated/redundant function. + The deprecated VALID_EXTEN function has been removed. + Use DIALPLAN_EXISTS instead. + + +### Developer Notes: + +- #### ARI: Add command to indicate progress to a channel + A new ARI endpoint is available at `/channels/{channelId}/progress` to indicate progress to a channel. + + +### Commit Authors: + +- Alexei Gradinari: (1) +- Alexey Khabulyak: (1) +- Artem Umerov: (1) +- Ben Ford: (2) +- George Joseph: (4) +- Igor Goncharovsky: (2) +- Joe Garlick: (1) +- Jose Lopes: (1) +- Mike Bradeen: (1) +- Naveen Albert: (23) +- Sean Bright: (2) +- Stuart Henderson: (1) +- Sven Kube: (1) + +## Issue and Commit Detail: + +### Closed Issues: + + - !GHSA-64qc-9x89-rx5j: A specifically malformed Authorization header in an incoming SIP request can cause Asterisk to crash + - 244: [bug]: config.c: Template inheritance is incorrect for ast_variable_retrieve + - 258: [deprecation]: Remove deprecated DeadAGI application. + - 401: [bug]: app_dial: Answer Gosub option passthrough regression + - 960: [bug]: config.c: Template inheritance is not respected by ast_variable_update + - 1147: [bug]: Commit 3cab4e7a to config.c causes segfaults and spinloops in UpdateConfig mgr action + - 1222: [bug]: func_callerid: ANI2 is not always formatted as two digits + - 1260: [bug]: Asterisk sends RTP audio stream before ICE/DTLS completes + - 1289: [bug]: sorcery - duplicate objects from multiple backends and backend divergence on update + - 1292: [improvement]: Remove deprecated users.conf + - 1296: [improvement]: res_musiconhold: Remove deprecated options + - 1298: [improvement]: app_voicemail: Remove deprecated options + - 1327: [bug]: res_stasis_device_state: can't delete ARI Devicestate after asterisk restart + - 1341: [improvement]: app_queue: Remove deprecated QUEUE_MEMBER_COUNT function + - 1343: [improvement]: cli.c: Remove deprecated/redundant CLI command. + - 1345: [improvement]: logger.c: Remove deprecated/redundant config option + - 1347: [improvement]: func_dialplan: Remove deprecated/redundant function + - 1352: [improvement]: Websocket channel with custom URI + - 1358: [new-feature]: app_chanspy: Add option to not automatically answer channel + - 1364: [bug]: bridge.c: BRIDGE_NOANSWER not always obeyed + - 1366: [improvement]: func_frame_drop: Handle allocation failure properly + - 1369: [bug]: test_res_prometheus: Compilation failure in devmode due to curlopts not using long type + - 1371: [improvement]: func_frame_drop: Add debug messages for frames that can be dropped + - 1375: [improvement]: dsp.c: Improve logging in tone_detect(). + - 1378: [bug]: chan_dahdi: dialmode feature is not properly reset between calls + - 1380: [bug]: sig_analog: Segfault due to calling strcmp on NULL + - 1384: [bug]: chan_websocket: asterisk crashes on hangup after STOP_MEDIA_BUFFERING command with id + - 1386: [bug]: enabling announceposition_only_up prevents any queue position announcements + - 1390: [improvement]: res_tonedetect: Add option to automatically end detection in TONE_DETECT + - 1394: [improvement]: sig_analog: Skip Caller ID spill if Caller ID is disabled + - 1396: [new-feature]: pbx_builtins: Make tone option for WaitExten configurable + - 1401: [bug]: app_waitfornoise timeout is always less then configured because of time() usage + - ASTERISK-30370: config: Template inheritance is incorrect for ast_variable_retrieve + +### Commits By Author: + +- #### Alexei Gradinari (1): + - sorcery: Prevent duplicate objects and ensure missing objects are created on u.. + +- #### Alexey Khabulyak (1): + - pbx_lua.c: segfault when pass null data to term_color function + +- #### Artem Umerov (1): + - Fix missing ast_test_flag64 in extconf.c + +- #### Ben Ford (1): + - res_rtp_asterisk: Don't send RTP before DTLS has negotiated. + +- #### George Joseph (4): + - xmldoc.c: Fix rendering of CLI output. + - chan_websocket: Fix buffer overrun when processing TEXT websocket frames. + - chan_websocket: Allow additional URI parameters to be added to the outgoing URI. + - res_pjsip_authenticator_digest: Fix SEGV if get_authorization_hdr returns NULL. + +- #### Igor Goncharovsky (2): + - app_waitforsilence.c: Use milliseconds to calculate timeout time + - app_queue.c: Add new global 'log_unpause_on_reason_change' + +- #### Joe Garlick (1): + - chan_websocket.c: Add DTMF messages + +- #### Jose Lopes (1): + - res_stasis_device_state: Fix delete ARI Devicestates after asterisk restart. + +- #### Naveen Albert (11): + - bridge.c: Obey BRIDGE_NOANSWER variable to skip answering channel. + - func_frame_drop: Handle allocation failure properly. + - test_res_prometheus: Fix compilation failure on Debian 13. + - func_frame_drop: Add debug messages for dropped frames. + - app_chanspy: Add option to not automatically answer channel. + - dsp.c: Improve debug logging in tone_detect(). + - sig_analog: Fix SEGV due to calling strcmp on NULL. + - chan_dahdi: Fix erroneously persistent dialmode. + - sig_analog: Skip Caller ID spill if usecallerid=no. + - res_tonedetect: Add option for TONE_DETECT detection to auto stop. + - pbx_builtins: Allow custom tone for WaitExten. + +- #### Stuart Henderson (1): + - app_queue: fix comparison for announce-position-only-up + +- #### Sven Kube (1): + - ARI: Add command to indicate progress to a channel + + +### Commit List: + +- Prepare for Asterisk 23 +- config.c Make ast_variable_update update last match. +- config.c: Make ast_variable_retrieve return last match. +- utils: Remove libdb and astdb conversion scripts. +- config.c: Fix inconsistent pointer logic in ast_variable_update. +- channel: Deprecate `ast_moh_cleanup(...)`. +- func_callerid: Always format ANI2 as two digits. +- users.conf: Remove deprecated users.conf integration. +- res_agi: Remove deprecated DeadAGI application. +- res_musiconhold: Remove options that were deprecated in Asterisk 14. +- app_voicemail: Remove deprecated options. +- app_queue: Remove redundant/deprecated function. +- cli.c: Remove deprecated and redundant CLI command. +- logger.c: Remove deprecated/redundant configuration option. +- func_dialplan: Remove deprecated/redundant function. +- Update version for Asterisk 23 +- chan_websocket.c: Add DTMF messages +- app_queue.c: Add new global 'log_unpause_on_reason_change' +- app_waitforsilence.c: Use milliseconds to calculate timeout time +- res_rtp_asterisk: Don't send RTP before DTLS has negotiated. +- Fix missing ast_test_flag64 in extconf.c +- pbx_builtins: Allow custom tone for WaitExten. +- res_tonedetect: Add option for TONE_DETECT detection to auto stop. +- app_queue: fix comparison for announce-position-only-up +- res_pjsip_authenticator_digest: Fix SEGV if get_authorization_hdr returns NULL. +- sig_analog: Skip Caller ID spill if usecallerid=no. +- chan_dahdi: Fix erroneously persistent dialmode. +- chan_websocket: Fix buffer overrun when processing TEXT websocket frames. +- sig_analog: Fix SEGV due to calling strcmp on NULL. +- ARI: Add command to indicate progress to a channel +- dsp.c: Improve debug logging in tone_detect(). +- res_stasis_device_state: Fix delete ARI Devicestates after asterisk restart. +- app_chanspy: Add option to not automatically answer channel. +- xmldoc.c: Fix rendering of CLI output. +- func_frame_drop: Add debug messages for dropped frames. +- test_res_prometheus: Fix compilation failure on Debian 13. +- func_frame_drop: Handle allocation failure properly. +- pbx_lua.c: segfault when pass null data to term_color function +- bridge.c: Obey BRIDGE_NOANSWER variable to skip answering channel. + +### Commit Details: + +#### Prepare for Asterisk 23 + Author: Mike Bradeen + Date: 2024-08-14 + + +#### config.c Make ast_variable_update update last match. + Author: Naveen Albert + Date: 2024-10-23 + + ast_variable_update currently sets the first match for a variable, as + opposed to the last one. This issue is complementary to that raised + in #244. + + This is incorrect and results in the wrong (or no) action being taken + in cases where a section inherits from a template section. When the + traversal occurs to update the setting, the existing code erroneously + would use the first of possibly multiple matches in its update logic, + which is wrong. Now, explicitly use the last match in the traversal, + which will ensure that the actual setting is updated properly, and + not skipped or ignored because a template from which the setting's + section inherits was used for comparison. + + Resolves: #960 + + UpgradeNote: Config variables, when set/updated, such as via AMI, + will now have the corresponding setting updated, even if their + sections inherit from template sections. + +#### config.c: Make ast_variable_retrieve return last match. + Author: Naveen Albert + Date: 2023-08-09 + + ast_variable_retrieve currently returns the first match + for a variable, as opposed to the last one. This is problematic + because modules that load config settings by explicitly + calling ast_variable_retrieve on a variable name (as opposed + to iterating through all the directives as specified) will + end up taking the first specified value, such as the default + value from the template rather than the actual effective value + in an individual config section, leading to the wrong config. + + This fixes this by making ast_variable_retrieve return the last + match, or the most recently overridden one, as the effective setting. + This is similar to what the -1 index in the AST_CONFIG function does. + + There is another function, ast_variable_find_last_in_list, that does + something similar. However, it's a slightly different API, and it + sees virtually no usage in Asterisk. ast_variable_retrieve is what + most things use so this is currently the relevant point of breakage. + + In practice, this is unlikely to cause any breakage, since there + would be no logical reason to use an inherited value rather than + an explicitly overridden value when loading a config. + + ASTERISK-30370 #close + + Resolves: #244 + + UpgradeNote: Config variables retrieved explicitly by name now return + the most recently overriding value as opposed to the base value (e.g. + from a template). This is equivalent to retrieving a config setting + using the -1 index to the AST_CONFIG function. The major implication of + this is that modules processing configs by explicitly retrieving variables + by name will now get the effective value of a variable as overridden in + a config rather than the first-set value (from a template), which is + consistent with how other modules load config settings. + +#### utils: Remove libdb and astdb conversion scripts. + Author: Sean Bright + Date: 2025-01-29 + + These were included with Asterisk 10 when we switched astdb from libdb + to sqlite3. + +#### config.c: Fix inconsistent pointer logic in ast_variable_update. + Author: Naveen Albert + Date: 2025-03-06 + + Commit 3cab4e7ab4a3ae483430d5f5e8fa167d02a8128c introduced a + regression by causing the wrong pointers to be used in certain + (more complex) cases. We now take care to ensure the exact + same pointers are used as before that commit, and simplify + by eliminating the unnecessary second for loop. + + Resolves: #1147 + +#### channel: Deprecate `ast_moh_cleanup(...)`. + Author: Sean Bright + Date: 2025-04-08 + + We don't want anyone calling it but the channel destructor. + +#### func_callerid: Always format ANI2 as two digits. + Author: Naveen Albert + Date: 2025-04-26 + + ANI II is always supposed to be formatted as two digits, + so zero pad when formatting it if necessary. + + Resolves: #1222 + +#### users.conf: Remove deprecated users.conf integration. + Author: Naveen Albert + Date: 2025-07-09 + + users.conf was deprecated in Asterisk 21 and is now being removed + for Asterisk 23, in accordance with the Asterisk deprecation policy. + + This consists of: + * Removing integration with app_directory, app_voicemail, chan_dahdi, + chan_iax2, and AMI. + * users.conf was also partially used for res_phoneprov, and this remaining + functionality is consolidated to a separate phoneprov_users.conf, + used only by res_phoneprov. + + Resolves: #1292 + + UpgradeNote: users.conf has been removed and all channel drivers must + be configured using their specific configuration files. The functionality + previously in users.conf for res_phoneprov is now in phoneprov_users.conf. + +#### res_agi: Remove deprecated DeadAGI application. + Author: Naveen Albert + Date: 2023-08-11 + + DeadAGI was deprecated 7 years ago, in Asterisk 15, + as it duplicates functionality in the AGI app. + This removes the application. + + Resolves: #258 + + UpgradeNote: The DeadAGI application, which was + deprecated in Asterisk 15, has now been removed. + The same functionality is available in the AGI app. + +#### res_musiconhold: Remove options that were deprecated in Asterisk 14. + Author: Naveen Albert + Date: 2025-07-09 + + Commit 9c1f34c7e904b26bb550f426020635894cb805ac added dedicated options + for random sorting functionality and deprecated older options that + now duplicated these capabilities. Remove these deprecated options. + + Resolves: #1296 + + UpgradeNote: The deprecated random and application=r options have + been removed; use sort=random instead. + +#### app_voicemail: Remove deprecated options. + Author: Naveen Albert + Date: 2025-07-10 + + Remove the deprecated maxmessage and minmessage options, + which have been superseded by maxsecs and minsecs since 1.6. + Also remove the deprecated 'cz' language option (deprecated + since 1.8.) + + Resolves: #1298 + + UpgradeNote: The deprecated maxmessage and minmessage options + have been removed; use maxsecs and minsecs instead. + The deprecated 'cz' language has also been removed; use 'cs' instead. + +#### app_queue: Remove redundant/deprecated function. + Author: Naveen Albert + Date: 2025-08-07 + + QUEUE_MEMBER_COUNT has been deprecated since at least 1.6, + for fully duplicating functionality available in the + QUEUE_MEMBER function; remove it now. + + Resolves: #1341 + + UpgradeNote: The deprecated QUEUE_MEMBER_COUNT function + has been removed; use QUEUE_MEMBER(,logged) instead. + +#### cli.c: Remove deprecated and redundant CLI command. + Author: Naveen Albert + Date: 2025-08-07 + + The "no debug channel" command has been deprecated since + 1.6 (commit 691363656fbdc83edf04b125317aebae6525c9e7), + as it is replaced by "core set debug channel", which also + supports tab-completion on channels. Remove the redundant + command. + + Resolves: #1343 + + UpgradeNote: The deprecated "no debug channel" command has + now been removed; use "core set debug channel" instead. + +#### logger.c: Remove deprecated/redundant configuration option. + Author: Naveen Albert + Date: 2025-08-07 + + Remove the deprecated 'rotatetimestamp' config option, as this + was deprecated by 'rotatestrategy' in 1.6 by commit + f5a14167f3ef090f8576da3070ed5c452fa01e44. + + Resolves: #1345 + + UpgradeNote: The deprecated rotatetimestamp option has been removed. + Use rotatestrategy instead. + +#### func_dialplan: Remove deprecated/redundant function. + Author: Naveen Albert + Date: 2025-08-07 + + Remove VALID_EXTEN, which was deprecated/superseded by DIALPLAN_EXISTS + in Asterisk 11 (commit 8017b65bb97c4226ca7a3c7c944a9811484e0305), + as DIALPLAN_EXISTS does the same thing and is more flexible. + + Resolves: #1347 + + UpgradeNote: The deprecated VALID_EXTEN function has been removed. + Use DIALPLAN_EXISTS instead. + +#### Update version for Asterisk 23 + Author: Ben Ford + Date: 2025-08-13 + + +#### chan_websocket.c: Add DTMF messages + Author: Joe Garlick + Date: 2025-09-04 + + Added DTMF messages to the chan_websocket feature. + + When a user presses DTMF during a call over chan_websocket it will send a message like: + "DTMF_END digit:1" + + Resolves: https://github.com/asterisk/asterisk-feature-requests/issues/70 + +#### app_queue.c: Add new global 'log_unpause_on_reason_change' + Author: Igor Goncharovsky + Date: 2025-09-02 + + In many asterisk-based systems, the pause reason is used to separate + pauses by type,and logically, changing the reason defines two intervals + that should be accounted for separately. The introduction of a new + option allows me to separate the intervals of operator inactivity in + the log by the event of unpausing. + + UserNote: Add new global option 'log_unpause_on_reason_change' that + is default disabled. When enabled cause addition of UNPAUSE event on + every re-PAUSE with reason changed. + + +#### app_waitforsilence.c: Use milliseconds to calculate timeout time + Author: Igor Goncharovsky + Date: 2025-09-04 + + The functions WaitForNoise() and WaitForSilence() use the time() + functions to calculate elapsed time, which causes the timer to fire on + a whole second boundary, and the actual function execution time to fire + the timer may be 1 second less than expected. This fix replaces time() + with ast_tvnow(). + + Fixes: #1401 + +#### res_rtp_asterisk: Don't send RTP before DTLS has negotiated. + Author: Ben Ford + Date: 2025-08-04 + + There was no check in __rtp_sendto that prevented Asterisk from sending + RTP before DTLS had finished negotiating. This patch adds logic to do + so. + + Fixes: #1260 + +#### Fix missing ast_test_flag64 in extconf.c + Author: Artem Umerov + Date: 2025-08-29 + + Fix missing ast_test_flag64 after https://github.com/asterisk/asterisk/commit/43bf8a4ded7a65203b766b91eaf8331a600e9d8d + + +#### pbx_builtins: Allow custom tone for WaitExten. + Author: Naveen Albert + Date: 2025-08-25 + + Currently, the 'd' option will play dial tone while waiting + for digits. Allow it to accept an argument for any tone from + indications.conf. + + Resolves: #1396 + + UserNote: The tone used while waiting for digits in WaitExten + can now be overridden by specifying an argument for the 'd' + option. + + +#### res_tonedetect: Add option for TONE_DETECT detection to auto stop. + Author: Naveen Albert + Date: 2025-08-22 + + One of the problems with TONE_DETECT as it was originally written + is that if a tone is detected multiple times, it can trigger + the redirect logic multiple times as well. For example, if we + do an async goto in the dialplan after detecting a tone, because + the detector is still active until explicitly disabled, if we + detect the tone again, we will branch again and start executing + that dialplan a second time. This is rarely ever desired behavior, + and can happen if the detector is not removed quickly enough. + + Add a new option, 'e', which automatically disables the detector + once the desired number of matches have been heard. This eliminates + the potential race condition where previously the detector would + need to be disabled immediately, but doing so quickly enough + was not guaranteed. This also allows match criteria to be retained + longer if needed, so the detector does not need to be destroyed + prematurely. + + Resolves: #1390 + + UserNote: The 'e' option for TONE_DETECT now allows detection to + be disabled automatically once the desired number of matches have + been fulfilled, which can help prevent race conditions in the + dialplan, since TONE_DETECT does not need to be disabled after + a hit. + + +#### app_queue: fix comparison for announce-position-only-up + Author: Stuart Henderson + Date: 2025-08-21 + + Numerically comparing that the current queue position is less than + last_pos_said can only be done after at least one announcement has been + made, otherwise last_pos_said is at the default (0). + + Fixes: #1386 + +#### res_pjsip_authenticator_digest: Fix SEGV if get_authorization_hdr returns NULL. + Author: George Joseph + Date: 2025-08-28 + + In the highly-unlikely event that get_authorization_hdr() couldn't find an + Authorization header in a request, trying to get the digest algorithm + would cauase a SEGV. We now check that we have an auth header that matches + the realm before trying to get the algorithm from it. + + Resolves: #GHSA-64qc-9x89-rx5j + +#### sorcery: Prevent duplicate objects and ensure missing objects are created on u.. + Author: Alexei Gradinari + Date: 2025-07-07 + + This patch resolves two issues in Sorcery objectset handling with multiple + backends: + + 1. Prevent duplicate objects: + When an object exists in more than one backend (e.g., a contact in both + 'astdb' and 'realtime'), the objectset previously returned multiple instances + of the same logical object. This caused logic failures in components like the + PJSIP registrar, where duplicate contact entries led to overcounting and + incorrect deletions, when max_contacts=1 and remove_existing=yes. + + This patch ensures only one instance of an object with a given key is added + to the objectset, avoiding these duplicate-related side effects. + + 2. Ensure missing objects are created: + When using multiple writable backends, a temporary backend failure can lead + to objects missing permanently from that backend. + Currently, .update() silently fails if the object is not present, + and no .create() is attempted. + This results in inconsistent state across backends (e.g. astdb vs. realtime). + + This patch introduces a new global option in sorcery.conf: + [general] + update_or_create_on_update_miss = yes|no + + Default: no (preserves existing behavior). + + When enabled: if .update() fails with no data found, .create() is attempted + in that backend. This ensures that objects missing due to temporary backend + outages are re-synchronized once the backend is available again. + + Added a new CLI command: + sorcery show settings + Displays global Sorcery settings, including the current value of + update_or_create_on_update_miss. + + Updated tests to validate both flag enabled/disabled behavior. + + Fixes: #1289 + + UserNote: Users relying on Sorcery multiple writable backends configurations + (e.g., astdb + realtime) may now enable update_or_create_on_update_miss = yes + in sorcery.conf to ensure missing objects are recreated after temporary backend + failures. Default behavior remains unchanged unless explicitly enabled. + + +#### sig_analog: Skip Caller ID spill if usecallerid=no. + Author: Naveen Albert + Date: 2025-08-25 + + If Caller ID is disabled for an FXS port, then we should not send any + Caller ID spill on the line, as we have no Caller ID information that + we can/should be sending. + + Resolves: #1394 + +#### chan_dahdi: Fix erroneously persistent dialmode. + Author: Naveen Albert + Date: 2025-08-18 + + It is possible to modify the dialmode setting in the chan_dahdi/sig_analog + private using the CHANNEL function, to modify it during calls. However, + it was not being reset between calls, meaning that if, for example, tone + dialing was disabled, it would never work again unless explicitly enabled. + + This fixes the setting by pairing it with a "perm" version of the setting, + as a few other features have, so that it can be reset to the permanent + setting between calls. The documentation is also clarified to explain + the interaction of this setting and the digitdetect setting more clearly. + + Resolves: #1378 + +#### chan_websocket: Allow additional URI parameters to be added to the outgoing URI. + Author: George Joseph + Date: 2025-08-13 + + * Added a new option to the WebSocket dial string to capture the additional + URI parameters. + * Added a new API ast_uri_verify_encoded() that verifies that a string + either doesn't need URI encoding or that it has already been encoded. + * Added a new API ast_websocket_client_add_uri_params() to add the params + to the client websocket session. + * Added XML documentation that will show up with `core show application Dial` + that shows how to use it. + + Resolves: #1352 + + UserNote: A new WebSocket channel driver option `v` has been added to the + Dial application that allows you to specify additional URI parameters on + outgoing connections. Run `core show application Dial` from the Asterisk CLI + to see how to use it. + + +#### chan_websocket: Fix buffer overrun when processing TEXT websocket frames. + Author: George Joseph + Date: 2025-08-19 + + ast_websocket_read() receives data into a fixed 64K buffer then continually + reallocates a final buffer that, after all continuation frames have been + received, is the exact length of the data received and returns that to the + caller. process_text_message() in chan_websocket was attempting to set a + NULL terminator on the received payload assuming the payload buffer it + received was the large 64K buffer. The assumption was incorrect so when it + tried to set a NULL terminator on the payload, it could, depending on the + state of the heap at the time, cause heap corruption. + + process_text_message() now allocates its own payload_len + 1 sized buffer, + copies the payload received from ast_websocket_read() into it then NULL + terminates it prevent the possibility of the overrun and corruption. + + Resolves: #1384 + +#### sig_analog: Fix SEGV due to calling strcmp on NULL. + Author: Naveen Albert + Date: 2025-08-18 + + Add an additional check to guard against the channel application being + NULL. + + Resolves: #1380 + +#### ARI: Add command to indicate progress to a channel + Author: Sven Kube + Date: 2025-07-30 + + Adds an ARI command to send a progress indication to a channel. + + DeveloperNote: A new ARI endpoint is available at `/channels/{channelId}/progress` to indicate progress to a channel. + +#### dsp.c: Improve debug logging in tone_detect(). + Author: Naveen Albert + Date: 2025-08-15 + + The debug logging during DSP processing has always been kind + of overwhelming and annoying to troubleshoot. Simplify and + improve the logging in a few ways to aid DSP debugging: + + * If we had a DSP hit, don't also emit the previous debug message that + was always logged. It is duplicated by the hit message, so this can + reduce the number of debug messages during detection by 50%. + * Include the hit count and required number of hits in the message so + on partial detections can be more easily troubleshot. + * Use debug level 9 for hits instead of 10, so we can focus on hits + without all the noise from the per-frame debug message. + * 1-index the hit count in the debug messages. On the first hit, it + currently logs '0', just as when we are not detecting anything, + which can be confusing. + + Resolves: #1375 + +#### res_stasis_device_state: Fix delete ARI Devicestates after asterisk restart. + Author: Jose Lopes + Date: 2025-07-30 + + After an asterisk restart, the deletion of ARI Devicestates didn't + return error, but the devicestate was not deleted. + Found a typo on populate_cache function that created wrong cache for + device states. + This bug caused wrong assumption that devicestate didn't exist, + since it was not in cache, so deletion didn't returned error. + + Fixes: #1327 + +#### app_chanspy: Add option to not automatically answer channel. + Author: Naveen Albert + Date: 2025-08-13 + + Add an option for ChanSpy and ExtenSpy to not answer the channel + automatically. Most applications that auto-answer by default + already have an option to disable this behavior if unwanted. + + Resolves: #1358 + + UserNote: ChanSpy and ExtenSpy can now be configured to not + automatically answer the channel by using the 'N' option. + + +#### xmldoc.c: Fix rendering of CLI output. + Author: George Joseph + Date: 2025-08-14 + + If you do a `core show application Dial`, you'll see it's kind of a mess. + Indents are wrong is some places, examples are printed in black which makes + them invisible on most terminals, and the lack of line breaks in some cases + makes it hard to follow. + + * Fixed the rendering of examples so they are indented properly and changed + the color so they can be seen. + * There is now a line break before each option. + * Options are now printed on their own line with all option content indented + below them. + + Example from Dial before fixes: + ``` + Example: Dial 555-1212 on first available channel in group 1, searching + from highest to lowest + + Example: Ringing FXS channel 4 with ring cadence 2 + + Example: Dial 555-1212 on channel 3 and require answer confirmation + + ... + + O([mode]): + mode - With either not specified or set to '1', the originator + hanging up will cause the phone to ring back immediately. + - With set to '2', when the operator flashes the trunk, it will ring + their phone back. + Enables *operator services* mode. This option only works when bridging a DAHDI + channel to another DAHDI channel only. If specified on non-DAHDI interfaces, it + will be ignored. When the destination answers (presumably an operator services + station), the originator no longer has control of their line. They may hang up, + but the switch will not release their line until the destination party (the + operator) hangs up. + + p: This option enables screening mode. This is basically Privacy mode + without memory. + ``` + + After: + ``` + Example: Dial 555-1212 on first available channel in group 1, searching + from highest to lowest + + same => n,Dial(DAHDI/g1/5551212) + + Example: Ringing FXS channel 4 with ring cadence 2 + + same => n,Dial(DAHDI/4r2) + + Example: Dial 555-1212 on channel 3 and require answer confirmation + + same => n,Dial(DAHDI/3c/5551212) + + ... + + O([mode]): + mode - With either not specified or set to '1', the originator + hanging up will cause the phone to ring back immediately. + With set to '2', when the operator flashes the trunk, it will + ring their phone back. + Enables *operator services* mode. This option only works when bridging + a DAHDI channel to another DAHDI channel only. If specified on + non-DAHDI interfaces, it will be ignored. When the destination answers + (presumably an operator services station), the originator no longer has + control of their line. They may hang up, but the switch will not + release their line until the destination party (the operator) hangs up. + + p: + This option enables screening mode. This is basically Privacy mode + without memory. + ``` + + There are still things we can do to make this more readable but this is a + start. + + +#### func_frame_drop: Add debug messages for dropped frames. + Author: Naveen Albert + Date: 2025-08-14 + + Add debug messages in scenarios where frames that are usually processed + are dropped or skipped. + + Resolves: #1371 + +#### test_res_prometheus: Fix compilation failure on Debian 13. + Author: Naveen Albert + Date: 2025-08-14 + + curl_easy_setopt expects long types, so be explicit. + + Resolves: #1369 + +#### func_frame_drop: Handle allocation failure properly. + Author: Naveen Albert + Date: 2025-08-14 + + Handle allocation failure and simplify the allocation using asprintf. + + Resolves: #1366 + +#### pbx_lua.c: segfault when pass null data to term_color function + Author: Alexey Khabulyak + Date: 2025-08-14 + + This can be reproduced under certain curcomstences. + For example: call app.playback from lua with invalid data: app.playback({}). + pbx_lua.c will try to get data for this playback using lua_tostring function. + This function returs NULL for everything but strings and numbers. + Then, it calls term_color with NULL data. + term_color function can call(if we don't use vt100 compat term) + ast_copy_string with NULL inbuf which cause segfault. bt example: + ast_copy_string (size=8192, src=0x0, dst=0x7fe44b4be8b0) + at /usr/src/asterisk/asterisk-20.11.0/include/asterisk/strings.h:412 + + Resolves: https://github.com/asterisk/asterisk/issues/1363 + +#### bridge.c: Obey BRIDGE_NOANSWER variable to skip answering channel. + Author: Naveen Albert + Date: 2025-08-14 + + If the BRIDGE_NOANSWER variable is set on a channel, it is not supposed + to answer when another channel bridges to it using Bridge(), and this is + checked when ast_bridge_call* is called. However, another path exists + (bridge_exec -> ast_bridge_add_channel) where this variable was not + checked and channels would be answered. We now check the variable there. + + Resolves: #401 + Resolves: #1364 + diff --git a/README.html b/README.html new file mode 100644 index 0000000000..48dbe2cb60 --- /dev/null +++ b/README.html @@ -0,0 +1,174 @@ +Readme for asterisk-23.0.0-rc1 +

The Asterisk(R) Open Source PBX

+
By Mark Spencer <markster@digium.com> and the Asterisk.org developer community.
+Copyright (C) 2001-2025 Sangoma Technologies Corporation and other copyright holders.
+
+

SECURITY

+

It is imperative that you read and fully understand the contents of +the security information document before you attempt to configure and run +an Asterisk server.

+

See Important Security Considerations for more information.

+

WHAT IS ASTERISK ?

+

Asterisk is an Open Source PBX and telephony toolkit. It is, in a +sense, middleware between Internet and telephony channels on the bottom, +and Internet and telephony applications at the top. However, Asterisk supports +more telephony interfaces than just Internet telephony. Asterisk also has a +vast amount of support for traditional PSTN telephony, as well.

+

For more information on the project itself, please visit the Asterisk +Home Page and the official +Asterisk Documentation.

+

SUPPORTED OPERATING SYSTEMS

+

Linux

+

The Asterisk Open Source PBX is developed and tested primarily on the +GNU/Linux operating system, and is supported on every major GNU/Linux +distribution.

+

Others

+

Asterisk has also been 'ported' and reportedly runs properly on other +operating systems as well, Apple's Mac OS X, and the BSD variants.

+

GETTING STARTED

+

Most users are using VoIP/SIP exclusively these days but if you need to +interface to TDM or analog services or devices, be sure you've got supported +hardware.

+

Supported telephony hardware includes: +* All Analog and Digital Interface cards from Sangoma +* Any full duplex sound card supported by PortAudio +* The Xorcom Astribank channel bank

+

UPGRADING FROM AN EARLIER VERSION

+

If you are updating from a previous version of Asterisk, make sure you +read the Change Logs.

+ +

Change Logs

+ + +

NEW INSTALLATIONS

+

Ensure that your system contains a compatible compiler and development +libraries. Asterisk requires either the GNU Compiler Collection (GCC) version +4.1 or higher, or a compiler that supports the C99 specification and some of +the gcc language extensions. In addition, your system needs to have the C +library headers available, and the headers and libraries for ncurses.

+

There are many modules that have additional dependencies. To see what +libraries are being looked for, see ./configure --help, or run +make menuselect to view the dependencies for specific modules.

+

On many distributions, these dependencies are installed by packages with names +like 'glibc-devel', 'ncurses-devel', 'openssl-devel' and 'zlib-devel' +or similar. The contrib/scripts/install_prereq script can be used to install +the dependencies for most Debian and Redhat based Linux distributions. +The script also handles SUSE, Arch, Gentoo, FreeBSD, NetBSD and OpenBSD but +those distributions mightnoit have complete support or they might be out of date.

+

So, let's proceed:

+
    +
  1. +

    Read the documentation.
    +The Asterisk Documentation website has full +information for building, installing, configuring and running Asterisk.

    +
  2. +
  3. +

    Run ./configure
    +Execute the configure script to guess values for system-dependent +variables used during compilation. If the script indicates that some required +components are missing, you can run ./contrib/scripts/install_prereq install +to install the necessary components. Note that this will install all dependencies +for every functionality of Asterisk. After running the script, you will need +to rerun ./configure.

    +
  4. +
  5. +

    Run make menuselect
    +This is needed if you want to select the modules that will be compiled and to +check dependencies for various optional modules.

    +
  6. +
  7. +

    Run make
    +Assuming the build completes successfully:

    +
  8. +
  9. +

    Run make install
    +If this is your first time working with Asterisk, you may wish to install +the sample PBX, with demonstration extensions, etc. If so, run:

    +
  10. +
  11. +

    Run make samples
    +Doing so will overwrite any existing configuration files you have installed.

    +
  12. +
  13. +

    Finally, you can launch Asterisk in the foreground mode (not a daemon) with +asterisk -vvvc
    +You'll see a bunch of verbose messages fly by your screen as Asterisk +initializes (that's the "very very verbose" mode). When it's ready, if +you specified the "c" then you'll get a command line console, that looks +like this:
    +*CLI>
    +You can type core show help at any time to get help with the system. For help +with a specific command, type core show help <command>.

    +
  14. +
+

man asterisk at the Unix/Linux command prompt will give you detailed +information on how to start and stop Asterisk, as well as all the command +line options for starting Asterisk.

+

ABOUT CONFIGURATION FILES

+

All Asterisk configuration files share a common format. Comments are +delimited by ; (since # of course, being a DTMF digit, may occur in +many places). A configuration file is divided into sections whose names +appear in []'s. Each section typically contains statements in the form +variable = value although you may see variable => value in older samples.

+

SPECIAL NOTE ON TIME

+

Those using SIP phones should be aware that Asterisk is sensitive to +large jumps in time. Manually changing the system time using date(1) +(or other similar commands) may cause SIP registrations and other +internal processes to fail. For this reason, you should always use +a time synchronization package to keep your system time accurate. +All OS/distributions make one or more of the following packages +available:

+
    +
  • ntpd/ntpsec
  • +
  • chronyd
  • +
  • systemd-timesyncd
  • +
+

Be sure to install and configure one (and only one) of them.

+

FILE DESCRIPTORS

+

Depending on the size of your system and your configuration, +Asterisk can consume a large number of file descriptors. In UNIX, +file descriptors are used for more than just files on disk. File +descriptors are also used for handling network communication +(e.g. SIP, IAX2, or H.323 calls) and hardware access (e.g. analog and +digital trunk hardware). Asterisk accesses many on-disk files for +everything from configuration information to voicemail storage.

+

Most systems limit the number of file descriptors that Asterisk can +have open at one time. This can limit the number of simultaneous +calls that your system can handle. For example, if the limit is set +at 1024 (a common default value) Asterisk can handle approximately 150 +SIP calls simultaneously. To change the number of file descriptors +follow the instructions for your system below:

+

PAM-BASED LINUX SYSTEM

+

If your system uses PAM (Pluggable Authentication Modules) edit +/etc/security/limits.conf. Add these lines to the bottom of the file:

+
root            soft    nofile          4096
+root            hard    nofile          8196
+asterisk        soft    nofile          4096
+asterisk        hard    nofile          8196
+
+

(adjust the numbers to taste). You may need to reboot the system for +these changes to take effect.

+

GENERIC UNIX SYSTEM

+

If there are no instructions specifically adapted to your system +above you can try adding the command ulimit -n 8192 to the script +that starts Asterisk.

+

MORE INFORMATION

+

Visit the Asterisk Documentation website +for more documentation on various features and please read all the +configuration samples that include documentation on the configuration options.

+

Finally, you may wish to join the +Asterisk Community Forums

+

Welcome to the growing worldwide community of Asterisk users!

+
        Mark Spencer, and the Asterisk.org development community
+
+
+

Asterisk is a trademark of Sangoma Technologies Corporation

+

[Sangoma] +[Home Page] +[Support] +[Documentation] +[Community Forums] +[Release Notes] +[Security] +[Mailing List Archive]

+ diff --git a/README.md b/README.md index 063db527e9..eefe89c9d8 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ If you are updating from a previous version of Asterisk, make sure you read the Change Logs. -[Change Logs](https://downloads.asterisk.org/pub/telephony/asterisk) +[Change Logs](ChangeLogs/ChangeLog-23.0.0-rc1.html) ### NEW INSTALLATIONS diff --git a/contrib/realtime/mysql/mysql_cdr.sql b/contrib/realtime/mysql/mysql_cdr.sql new file mode 100644 index 0000000000..0d48377e85 --- /dev/null +++ b/contrib/realtime/mysql/mysql_cdr.sql @@ -0,0 +1,41 @@ +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 210693f3123d + +CREATE TABLE cdr ( + accountcode VARCHAR(20), + src VARCHAR(80), + dst VARCHAR(80), + dcontext VARCHAR(80), + clid VARCHAR(80), + channel VARCHAR(80), + dstchannel VARCHAR(80), + lastapp VARCHAR(80), + lastdata VARCHAR(80), + start DATETIME, + answer DATETIME, + end DATETIME, + duration INTEGER, + billsec INTEGER, + disposition VARCHAR(45), + amaflags VARCHAR(45), + userfield VARCHAR(256), + uniqueid VARCHAR(150), + linkedid VARCHAR(150), + peeraccount VARCHAR(20), + sequence INTEGER +); + +INSERT INTO alembic_version (version_num) VALUES ('210693f3123d'); + +-- Running upgrade 210693f3123d -> 54cde9847798 + +ALTER TABLE cdr MODIFY accountcode VARCHAR(80) NULL; + +ALTER TABLE cdr MODIFY peeraccount VARCHAR(80) NULL; + +UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d'; + diff --git a/contrib/realtime/mysql/mysql_config.sql b/contrib/realtime/mysql/mysql_config.sql new file mode 100644 index 0000000000..b813b61d10 --- /dev/null +++ b/contrib/realtime/mysql/mysql_config.sql @@ -0,0 +1,1737 @@ +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 4da0c5f79a9c + +CREATE TABLE sippeers ( + id INTEGER NOT NULL AUTO_INCREMENT, + name VARCHAR(40) NOT NULL, + ipaddr VARCHAR(45), + port INTEGER, + regseconds INTEGER, + defaultuser VARCHAR(40), + fullcontact VARCHAR(80), + regserver VARCHAR(20), + useragent VARCHAR(20), + lastms INTEGER, + host VARCHAR(40), + type ENUM('friend','user','peer'), + context VARCHAR(40), + permit VARCHAR(95), + deny VARCHAR(95), + secret VARCHAR(40), + md5secret VARCHAR(40), + remotesecret VARCHAR(40), + transport ENUM('udp','tcp','tls','ws','wss','udp,tcp','tcp,udp'), + dtmfmode ENUM('rfc2833','info','shortinfo','inband','auto'), + directmedia ENUM('yes','no','nonat','update'), + nat VARCHAR(29), + callgroup VARCHAR(40), + pickupgroup VARCHAR(40), + language VARCHAR(40), + disallow VARCHAR(200), + allow VARCHAR(200), + insecure VARCHAR(40), + trustrpid ENUM('yes','no'), + progressinband ENUM('yes','no','never'), + promiscredir ENUM('yes','no'), + useclientcode ENUM('yes','no'), + accountcode VARCHAR(40), + setvar VARCHAR(200), + callerid VARCHAR(40), + amaflags VARCHAR(40), + callcounter ENUM('yes','no'), + busylevel INTEGER, + allowoverlap ENUM('yes','no'), + allowsubscribe ENUM('yes','no'), + videosupport ENUM('yes','no'), + maxcallbitrate INTEGER, + rfc2833compensate ENUM('yes','no'), + mailbox VARCHAR(40), + `session-timers` ENUM('accept','refuse','originate'), + `session-expires` INTEGER, + `session-minse` INTEGER, + `session-refresher` ENUM('uac','uas'), + t38pt_usertpsource VARCHAR(40), + regexten VARCHAR(40), + fromdomain VARCHAR(40), + fromuser VARCHAR(40), + `qualify` VARCHAR(40), + defaultip VARCHAR(45), + rtptimeout INTEGER, + rtpholdtimeout INTEGER, + sendrpid ENUM('yes','no'), + outboundproxy VARCHAR(40), + callbackextension VARCHAR(40), + timert1 INTEGER, + timerb INTEGER, + qualifyfreq INTEGER, + constantssrc ENUM('yes','no'), + contactpermit VARCHAR(95), + contactdeny VARCHAR(95), + usereqphone ENUM('yes','no'), + textsupport ENUM('yes','no'), + faxdetect ENUM('yes','no'), + buggymwi ENUM('yes','no'), + auth VARCHAR(40), + fullname VARCHAR(40), + trunkname VARCHAR(40), + cid_number VARCHAR(40), + callingpres ENUM('allowed_not_screened','allowed_passed_screen','allowed_failed_screen','allowed','prohib_not_screened','prohib_passed_screen','prohib_failed_screen','prohib'), + mohinterpret VARCHAR(40), + mohsuggest VARCHAR(40), + parkinglot VARCHAR(40), + hasvoicemail ENUM('yes','no'), + subscribemwi ENUM('yes','no'), + vmexten VARCHAR(40), + autoframing ENUM('yes','no'), + rtpkeepalive INTEGER, + `call-limit` INTEGER, + g726nonstandard ENUM('yes','no'), + ignoresdpversion ENUM('yes','no'), + allowtransfer ENUM('yes','no'), + dynamic ENUM('yes','no'), + path VARCHAR(256), + supportpath ENUM('yes','no'), + PRIMARY KEY (id), + UNIQUE (name) +); + +CREATE INDEX sippeers_name ON sippeers (name); + +CREATE INDEX sippeers_name_host ON sippeers (name, host); + +CREATE INDEX sippeers_ipaddr_port ON sippeers (ipaddr, port); + +CREATE INDEX sippeers_host_port ON sippeers (host, port); + +CREATE TABLE iaxfriends ( + id INTEGER NOT NULL AUTO_INCREMENT, + name VARCHAR(40) NOT NULL, + type ENUM('friend','user','peer'), + username VARCHAR(40), + mailbox VARCHAR(40), + secret VARCHAR(40), + dbsecret VARCHAR(40), + context VARCHAR(40), + regcontext VARCHAR(40), + host VARCHAR(40), + ipaddr VARCHAR(40), + port INTEGER, + defaultip VARCHAR(20), + sourceaddress VARCHAR(20), + mask VARCHAR(20), + regexten VARCHAR(40), + regseconds INTEGER, + accountcode VARCHAR(20), + mohinterpret VARCHAR(20), + mohsuggest VARCHAR(20), + inkeys VARCHAR(40), + outkeys VARCHAR(40), + language VARCHAR(10), + callerid VARCHAR(100), + cid_number VARCHAR(40), + sendani ENUM('yes','no'), + fullname VARCHAR(40), + trunk ENUM('yes','no'), + auth VARCHAR(20), + maxauthreq INTEGER, + requirecalltoken ENUM('yes','no','auto'), + encryption ENUM('yes','no','aes128'), + transfer ENUM('yes','no','mediaonly'), + jitterbuffer ENUM('yes','no'), + forcejitterbuffer ENUM('yes','no'), + disallow VARCHAR(200), + allow VARCHAR(200), + codecpriority VARCHAR(40), + `qualify` VARCHAR(10), + qualifysmoothing ENUM('yes','no'), + qualifyfreqok VARCHAR(10), + qualifyfreqnotok VARCHAR(10), + timezone VARCHAR(20), + adsi ENUM('yes','no'), + amaflags VARCHAR(20), + setvar VARCHAR(200), + PRIMARY KEY (id), + UNIQUE (name) +); + +CREATE INDEX iaxfriends_name ON iaxfriends (name); + +CREATE INDEX iaxfriends_name_host ON iaxfriends (name, host); + +CREATE INDEX iaxfriends_name_ipaddr_port ON iaxfriends (name, ipaddr, port); + +CREATE INDEX iaxfriends_ipaddr_port ON iaxfriends (ipaddr, port); + +CREATE INDEX iaxfriends_host_port ON iaxfriends (host, port); + +CREATE TABLE voicemail ( + uniqueid INTEGER NOT NULL AUTO_INCREMENT, + context VARCHAR(80) NOT NULL, + mailbox VARCHAR(80) NOT NULL, + password VARCHAR(80) NOT NULL, + fullname VARCHAR(80), + alias VARCHAR(80), + email VARCHAR(80), + pager VARCHAR(80), + attach ENUM('yes','no'), + attachfmt VARCHAR(10), + serveremail VARCHAR(80), + language VARCHAR(20), + tz VARCHAR(30), + deletevoicemail ENUM('yes','no'), + saycid ENUM('yes','no'), + sendvoicemail ENUM('yes','no'), + review ENUM('yes','no'), + tempgreetwarn ENUM('yes','no'), + operator ENUM('yes','no'), + envelope ENUM('yes','no'), + sayduration INTEGER, + forcename ENUM('yes','no'), + forcegreetings ENUM('yes','no'), + callback VARCHAR(80), + dialout VARCHAR(80), + exitcontext VARCHAR(80), + maxmsg INTEGER, + volgain NUMERIC(5, 2), + imapuser VARCHAR(80), + imappassword VARCHAR(80), + imapserver VARCHAR(80), + imapport VARCHAR(8), + imapflags VARCHAR(80), + stamp DATETIME, + PRIMARY KEY (uniqueid) +); + +CREATE INDEX voicemail_mailbox ON voicemail (mailbox); + +CREATE INDEX voicemail_context ON voicemail (context); + +CREATE INDEX voicemail_mailbox_context ON voicemail (mailbox, context); + +CREATE INDEX voicemail_imapuser ON voicemail (imapuser); + +CREATE TABLE meetme ( + bookid INTEGER NOT NULL AUTO_INCREMENT, + confno VARCHAR(80) NOT NULL, + starttime DATETIME, + endtime DATETIME, + pin VARCHAR(20), + adminpin VARCHAR(20), + opts VARCHAR(20), + adminopts VARCHAR(20), + recordingfilename VARCHAR(80), + recordingformat VARCHAR(10), + maxusers INTEGER, + members INTEGER NOT NULL, + PRIMARY KEY (bookid) +); + +CREATE INDEX meetme_confno_start_end ON meetme (confno, starttime, endtime); + +CREATE TABLE musiconhold ( + name VARCHAR(80) NOT NULL, + mode ENUM('custom','files','mp3nb','quietmp3nb','quietmp3'), + directory VARCHAR(255), + application VARCHAR(255), + digit VARCHAR(1), + sort VARCHAR(10), + format VARCHAR(10), + stamp DATETIME, + PRIMARY KEY (name) +); + +INSERT INTO alembic_version (version_num) VALUES ('4da0c5f79a9c'); + +-- Running upgrade 4da0c5f79a9c -> 43956d550a44 + +CREATE TABLE ps_endpoints ( + id VARCHAR(40) NOT NULL, + transport VARCHAR(40), + aors VARCHAR(200), + auth VARCHAR(40), + context VARCHAR(40), + disallow VARCHAR(200), + allow VARCHAR(200), + direct_media ENUM('yes','no'), + connected_line_method ENUM('invite','reinvite','update'), + direct_media_method ENUM('invite','reinvite','update'), + direct_media_glare_mitigation ENUM('none','outgoing','incoming'), + disable_direct_media_on_nat ENUM('yes','no'), + dtmf_mode ENUM('rfc4733','inband','info'), + external_media_address VARCHAR(40), + force_rport ENUM('yes','no'), + ice_support ENUM('yes','no'), + identify_by ENUM('username'), + mailboxes VARCHAR(40), + moh_suggest VARCHAR(40), + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(40), + rewrite_contact ENUM('yes','no'), + rtp_ipv6 ENUM('yes','no'), + rtp_symmetric ENUM('yes','no'), + send_diversion ENUM('yes','no'), + send_pai ENUM('yes','no'), + send_rpid ENUM('yes','no'), + timers_min_se INTEGER, + timers ENUM('forced','no','required','yes'), + timers_sess_expires INTEGER, + callerid VARCHAR(40), + callerid_privacy ENUM('allowed_not_screened','allowed_passed_screened','allowed_failed_screened','allowed','prohib_not_screened','prohib_passed_screened','prohib_failed_screened','prohib','unavailable'), + callerid_tag VARCHAR(40), + `100rel` ENUM('no','required','yes'), + aggregate_mwi ENUM('yes','no'), + trust_id_inbound ENUM('yes','no'), + trust_id_outbound ENUM('yes','no'), + use_ptime ENUM('yes','no'), + use_avpf ENUM('yes','no'), + media_encryption ENUM('no','sdes','dtls'), + inband_progress ENUM('yes','no'), + call_group VARCHAR(40), + pickup_group VARCHAR(40), + named_call_group VARCHAR(40), + named_pickup_group VARCHAR(40), + device_state_busy_at INTEGER, + fax_detect ENUM('yes','no'), + t38_udptl ENUM('yes','no'), + t38_udptl_ec ENUM('none','fec','redundancy'), + t38_udptl_maxdatagram INTEGER, + t38_udptl_nat ENUM('yes','no'), + t38_udptl_ipv6 ENUM('yes','no'), + tone_zone VARCHAR(40), + language VARCHAR(40), + one_touch_recording ENUM('yes','no'), + record_on_feature VARCHAR(40), + record_off_feature VARCHAR(40), + rtp_engine VARCHAR(40), + allow_transfer ENUM('yes','no'), + allow_subscribe ENUM('yes','no'), + sdp_owner VARCHAR(40), + sdp_session VARCHAR(40), + tos_audio INTEGER, + tos_video INTEGER, + cos_audio INTEGER, + cos_video INTEGER, + sub_min_expiry INTEGER, + from_domain VARCHAR(40), + from_user VARCHAR(40), + mwi_fromuser VARCHAR(40), + dtls_verify VARCHAR(40), + dtls_rekey VARCHAR(40), + dtls_cert_file VARCHAR(200), + dtls_private_key VARCHAR(200), + dtls_cipher VARCHAR(200), + dtls_ca_file VARCHAR(200), + dtls_ca_path VARCHAR(200), + dtls_setup ENUM('active','passive','actpass'), + srtp_tag_32 ENUM('yes','no'), + UNIQUE (id) +); + +CREATE INDEX ps_endpoints_id ON ps_endpoints (id); + +CREATE TABLE ps_auths ( + id VARCHAR(40) NOT NULL, + auth_type ENUM('md5','userpass'), + nonce_lifetime INTEGER, + md5_cred VARCHAR(40), + password VARCHAR(80), + realm VARCHAR(40), + username VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_auths_id ON ps_auths (id); + +CREATE TABLE ps_aors ( + id VARCHAR(40) NOT NULL, + contact VARCHAR(40), + default_expiration INTEGER, + mailboxes VARCHAR(80), + max_contacts INTEGER, + minimum_expiration INTEGER, + remove_existing ENUM('yes','no'), + qualify_frequency INTEGER, + authenticate_qualify ENUM('yes','no'), + UNIQUE (id) +); + +CREATE INDEX ps_aors_id ON ps_aors (id); + +CREATE TABLE ps_contacts ( + id VARCHAR(40) NOT NULL, + uri VARCHAR(40), + expiration_time VARCHAR(40), + qualify_frequency INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_contacts_id ON ps_contacts (id); + +CREATE TABLE ps_domain_aliases ( + id VARCHAR(40) NOT NULL, + domain VARCHAR(80), + UNIQUE (id) +); + +CREATE INDEX ps_domain_aliases_id ON ps_domain_aliases (id); + +CREATE TABLE ps_endpoint_id_ips ( + id VARCHAR(40) NOT NULL, + endpoint VARCHAR(40), + `match` VARCHAR(80), + UNIQUE (id) +); + +CREATE INDEX ps_endpoint_id_ips_id ON ps_endpoint_id_ips (id); + +UPDATE alembic_version SET version_num='43956d550a44' WHERE alembic_version.version_num = '4da0c5f79a9c'; + +-- Running upgrade 43956d550a44 -> 581a4264e537 + +CREATE TABLE extensions ( + id BIGINT NOT NULL AUTO_INCREMENT, + context VARCHAR(40) NOT NULL, + exten VARCHAR(40) NOT NULL, + priority INTEGER NOT NULL, + app VARCHAR(40) NOT NULL, + appdata VARCHAR(256) NOT NULL, + PRIMARY KEY (id), + UNIQUE (context, exten, priority), + UNIQUE (id) +); + +UPDATE alembic_version SET version_num='581a4264e537' WHERE alembic_version.version_num = '43956d550a44'; + +-- Running upgrade 581a4264e537 -> 2fc7930b41b3 + +CREATE TABLE ps_systems ( + id VARCHAR(40) NOT NULL, + timer_t1 INTEGER, + timer_b INTEGER, + compact_headers ENUM('yes','no'), + threadpool_initial_size INTEGER, + threadpool_auto_increment INTEGER, + threadpool_idle_timeout INTEGER, + threadpool_max_size INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_systems_id ON ps_systems (id); + +CREATE TABLE ps_globals ( + id VARCHAR(40) NOT NULL, + max_forwards INTEGER, + user_agent VARCHAR(40), + default_outbound_endpoint VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_globals_id ON ps_globals (id); + +CREATE TABLE ps_transports ( + id VARCHAR(40) NOT NULL, + async_operations INTEGER, + bind VARCHAR(40), + ca_list_file VARCHAR(200), + cert_file VARCHAR(200), + cipher VARCHAR(200), + domain VARCHAR(40), + external_media_address VARCHAR(40), + external_signaling_address VARCHAR(40), + external_signaling_port INTEGER, + method ENUM('default','unspecified','tlsv1','sslv2','sslv3','sslv23'), + local_net VARCHAR(40), + password VARCHAR(40), + priv_key_file VARCHAR(200), + protocol ENUM('udp','tcp','tls','ws','wss'), + require_client_cert ENUM('yes','no'), + verify_client ENUM('yes','no'), + verifiy_server ENUM('yes','no'), + tos ENUM('yes','no'), + cos ENUM('yes','no'), + UNIQUE (id) +); + +CREATE INDEX ps_transports_id ON ps_transports (id); + +CREATE TABLE ps_registrations ( + id VARCHAR(40) NOT NULL, + auth_rejection_permanent ENUM('yes','no'), + client_uri VARCHAR(40), + contact_user VARCHAR(40), + expiration INTEGER, + max_retries INTEGER, + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(40), + retry_interval INTEGER, + forbidden_retry_interval INTEGER, + server_uri VARCHAR(40), + transport VARCHAR(40), + support_path ENUM('yes','no'), + UNIQUE (id) +); + +CREATE INDEX ps_registrations_id ON ps_registrations (id); + +ALTER TABLE ps_endpoints ADD COLUMN media_address VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN redirect_method ENUM('user','uri_core','uri_pjsip'); + +ALTER TABLE ps_endpoints ADD COLUMN set_var TEXT; + +ALTER TABLE ps_endpoints CHANGE mwi_fromuser mwi_from_user VARCHAR(40) NULL; + +ALTER TABLE ps_contacts ADD COLUMN outbound_proxy VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN path TEXT; + +ALTER TABLE ps_aors ADD COLUMN maximum_expiration INTEGER; + +ALTER TABLE ps_aors ADD COLUMN outbound_proxy VARCHAR(40); + +ALTER TABLE ps_aors ADD COLUMN support_path ENUM('yes','no'); + +UPDATE alembic_version SET version_num='2fc7930b41b3' WHERE alembic_version.version_num = '581a4264e537'; + +-- Running upgrade 2fc7930b41b3 -> 21e526ad3040 + +ALTER TABLE ps_globals ADD COLUMN debug VARCHAR(40); + +UPDATE alembic_version SET version_num='21e526ad3040' WHERE alembic_version.version_num = '2fc7930b41b3'; + +-- Running upgrade 21e526ad3040 -> 28887f25a46f + +CREATE TABLE queues ( + name VARCHAR(128) NOT NULL, + musiconhold VARCHAR(128), + announce VARCHAR(128), + context VARCHAR(128), + timeout INTEGER, + ringinuse ENUM('yes','no'), + setinterfacevar ENUM('yes','no'), + setqueuevar ENUM('yes','no'), + setqueueentryvar ENUM('yes','no'), + monitor_format VARCHAR(8), + membermacro VARCHAR(512), + membergosub VARCHAR(512), + queue_youarenext VARCHAR(128), + queue_thereare VARCHAR(128), + queue_callswaiting VARCHAR(128), + queue_quantity1 VARCHAR(128), + queue_quantity2 VARCHAR(128), + queue_holdtime VARCHAR(128), + queue_minutes VARCHAR(128), + queue_minute VARCHAR(128), + queue_seconds VARCHAR(128), + queue_thankyou VARCHAR(128), + queue_callerannounce VARCHAR(128), + queue_reporthold VARCHAR(128), + announce_frequency INTEGER, + announce_to_first_user ENUM('yes','no'), + min_announce_frequency INTEGER, + announce_round_seconds INTEGER, + announce_holdtime VARCHAR(128), + announce_position VARCHAR(128), + announce_position_limit INTEGER, + periodic_announce VARCHAR(50), + periodic_announce_frequency INTEGER, + relative_periodic_announce ENUM('yes','no'), + random_periodic_announce ENUM('yes','no'), + retry INTEGER, + wrapuptime INTEGER, + penaltymemberslimit INTEGER, + autofill ENUM('yes','no'), + monitor_type VARCHAR(128), + autopause ENUM('yes','no','all'), + autopausedelay INTEGER, + autopausebusy ENUM('yes','no'), + autopauseunavail ENUM('yes','no'), + maxlen INTEGER, + servicelevel INTEGER, + strategy ENUM('ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered'), + joinempty VARCHAR(128), + leavewhenempty VARCHAR(128), + reportholdtime ENUM('yes','no'), + memberdelay INTEGER, + weight INTEGER, + timeoutrestart ENUM('yes','no'), + defaultrule VARCHAR(128), + timeoutpriority VARCHAR(128), + PRIMARY KEY (name) +); + +CREATE TABLE queue_members ( + queue_name VARCHAR(80) NOT NULL, + interface VARCHAR(80) NOT NULL, + uniqueid VARCHAR(80) NOT NULL, + membername VARCHAR(80), + state_interface VARCHAR(80), + penalty INTEGER, + paused INTEGER, + PRIMARY KEY (queue_name, interface) +); + +UPDATE alembic_version SET version_num='28887f25a46f' WHERE alembic_version.version_num = '21e526ad3040'; + +-- Running upgrade 28887f25a46f -> 4c573e7135bd + +ALTER TABLE ps_endpoints MODIFY tos_audio VARCHAR(10) NULL; + +ALTER TABLE ps_endpoints MODIFY tos_video VARCHAR(10) NULL; + +ALTER TABLE ps_endpoints DROP COLUMN cos_audio; + +ALTER TABLE ps_endpoints DROP COLUMN cos_video; + +ALTER TABLE ps_endpoints ADD COLUMN cos_audio INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN cos_video INTEGER; + +ALTER TABLE ps_transports MODIFY tos VARCHAR(10) NULL; + +ALTER TABLE ps_transports DROP COLUMN cos; + +ALTER TABLE ps_transports ADD COLUMN cos INTEGER; + +UPDATE alembic_version SET version_num='4c573e7135bd' WHERE alembic_version.version_num = '28887f25a46f'; + +-- Running upgrade 4c573e7135bd -> 3855ee4e5f85 + +ALTER TABLE ps_endpoints ADD COLUMN message_context VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN user_agent VARCHAR(40); + +UPDATE alembic_version SET version_num='3855ee4e5f85' WHERE alembic_version.version_num = '4c573e7135bd'; + +-- Running upgrade 3855ee4e5f85 -> e96a0b8071c + +ALTER TABLE ps_globals MODIFY user_agent VARCHAR(255) NULL; + +ALTER TABLE ps_contacts MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_contacts MODIFY uri VARCHAR(255) NULL; + +ALTER TABLE ps_contacts MODIFY user_agent VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY client_uri VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY server_uri VARCHAR(255) NULL; + +UPDATE alembic_version SET version_num='e96a0b8071c' WHERE alembic_version.version_num = '3855ee4e5f85'; + +-- Running upgrade e96a0b8071c -> c6d929b23a8 + +CREATE TABLE ps_subscription_persistence ( + id VARCHAR(40) NOT NULL, + packet VARCHAR(2048), + src_name VARCHAR(128), + src_port INTEGER, + transport_key VARCHAR(64), + local_name VARCHAR(128), + local_port INTEGER, + cseq INTEGER, + tag VARCHAR(128), + endpoint VARCHAR(40), + expires INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_subscription_persistence_id ON ps_subscription_persistence (id); + +UPDATE alembic_version SET version_num='c6d929b23a8' WHERE alembic_version.version_num = 'e96a0b8071c'; + +-- Running upgrade c6d929b23a8 -> 51f8cb66540e + +ALTER TABLE ps_endpoints ADD COLUMN force_avp ENUM('yes','no'); + +ALTER TABLE ps_endpoints ADD COLUMN media_use_received_transport ENUM('yes','no'); + +UPDATE alembic_version SET version_num='51f8cb66540e' WHERE alembic_version.version_num = 'c6d929b23a8'; + +-- Running upgrade 51f8cb66540e -> 1d50859ed02e + +ALTER TABLE ps_endpoints ADD COLUMN accountcode VARCHAR(20); + +UPDATE alembic_version SET version_num='1d50859ed02e' WHERE alembic_version.version_num = '51f8cb66540e'; + +-- Running upgrade 1d50859ed02e -> 1758e8bbf6b + +ALTER TABLE sippeers MODIFY useragent VARCHAR(255) NULL; + +UPDATE alembic_version SET version_num='1758e8bbf6b' WHERE alembic_version.version_num = '1d50859ed02e'; + +-- Running upgrade 1758e8bbf6b -> 5139253c0423 + +ALTER TABLE queue_members DROP COLUMN uniqueid; + +ALTER TABLE queue_members ADD COLUMN uniqueid INTEGER NOT NULL; + +ALTER TABLE queue_members ADD UNIQUE (uniqueid); + +ALTER TABLE queue_members MODIFY uniqueid INTEGER NOT NULL AUTO_INCREMENT; + +UPDATE alembic_version SET version_num='5139253c0423' WHERE alembic_version.version_num = '1758e8bbf6b'; + +-- Running upgrade 5139253c0423 -> d39508cb8d8 + +CREATE TABLE queue_rules ( + rule_name VARCHAR(80) NOT NULL, + time VARCHAR(32) NOT NULL, + min_penalty VARCHAR(32) NOT NULL, + max_penalty VARCHAR(32) NOT NULL +); + +UPDATE alembic_version SET version_num='d39508cb8d8' WHERE alembic_version.version_num = '5139253c0423'; + +-- Running upgrade d39508cb8d8 -> 5950038a6ead + +ALTER TABLE ps_transports CHANGE verifiy_server verify_server ENUM('yes','no') NULL; + +UPDATE alembic_version SET version_num='5950038a6ead' WHERE alembic_version.version_num = 'd39508cb8d8'; + +-- Running upgrade 5950038a6ead -> 10aedae86a32 + +ALTER TABLE sippeers MODIFY directmedia ENUM('yes','no','nonat','update','outgoing') NULL; + +UPDATE alembic_version SET version_num='10aedae86a32' WHERE alembic_version.version_num = '5950038a6ead'; + +-- Running upgrade 10aedae86a32 -> 371a3bf4143e + +ALTER TABLE ps_endpoints ADD COLUMN user_eq_phone ENUM('yes','no'); + +UPDATE alembic_version SET version_num='371a3bf4143e' WHERE alembic_version.version_num = '10aedae86a32'; + +-- Running upgrade 371a3bf4143e -> 15b1430ad6f1 + +ALTER TABLE ps_endpoints ADD COLUMN moh_passthrough ENUM('yes','no'); + +UPDATE alembic_version SET version_num='15b1430ad6f1' WHERE alembic_version.version_num = '371a3bf4143e'; + +-- Running upgrade 15b1430ad6f1 -> 945b1098bdd + +ALTER TABLE ps_endpoints ADD COLUMN media_encryption_optimistic ENUM('yes','no'); + +UPDATE alembic_version SET version_num='945b1098bdd' WHERE alembic_version.version_num = '15b1430ad6f1'; + +-- Running upgrade 945b1098bdd -> 45e3f47c6c44 + +ALTER TABLE ps_globals ADD COLUMN endpoint_identifier_order VARCHAR(40); + +UPDATE alembic_version SET version_num='45e3f47c6c44' WHERE alembic_version.version_num = '945b1098bdd'; + +-- Running upgrade 45e3f47c6c44 -> 23530d604b96 + +ALTER TABLE ps_endpoints ADD COLUMN rpid_immediate ENUM('yes','no'); + +UPDATE alembic_version SET version_num='23530d604b96' WHERE alembic_version.version_num = '45e3f47c6c44'; + +-- Running upgrade 23530d604b96 -> 31cd4f4891ec + +ALTER TABLE ps_endpoints MODIFY dtmf_mode ENUM('rfc4733','inband','info','auto') NULL; + +UPDATE alembic_version SET version_num='31cd4f4891ec' WHERE alembic_version.version_num = '23530d604b96'; + +-- Running upgrade 31cd4f4891ec -> 461d7d691209 + +ALTER TABLE ps_aors ADD COLUMN qualify_timeout INTEGER; + +ALTER TABLE ps_contacts ADD COLUMN qualify_timeout INTEGER; + +UPDATE alembic_version SET version_num='461d7d691209' WHERE alembic_version.version_num = '31cd4f4891ec'; + +-- Running upgrade 461d7d691209 -> a541e0b5e89 + +ALTER TABLE ps_globals ADD COLUMN max_initial_qualify_time INTEGER; + +UPDATE alembic_version SET version_num='a541e0b5e89' WHERE alembic_version.version_num = '461d7d691209'; + +-- Running upgrade a541e0b5e89 -> 28b8e71e541f + +ALTER TABLE ps_endpoints ADD COLUMN g726_non_standard ENUM('yes','no'); + +UPDATE alembic_version SET version_num='28b8e71e541f' WHERE alembic_version.version_num = 'a541e0b5e89'; + +-- Running upgrade 28b8e71e541f -> 498357a710ae + +ALTER TABLE ps_endpoints ADD COLUMN rtp_keepalive INTEGER; + +UPDATE alembic_version SET version_num='498357a710ae' WHERE alembic_version.version_num = '28b8e71e541f'; + +-- Running upgrade 498357a710ae -> 26f10cadc157 + +ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout_hold INTEGER; + +UPDATE alembic_version SET version_num='26f10cadc157' WHERE alembic_version.version_num = '498357a710ae'; + +-- Running upgrade 26f10cadc157 -> 154177371065 + +ALTER TABLE ps_globals ADD COLUMN default_from_user VARCHAR(80); + +UPDATE alembic_version SET version_num='154177371065' WHERE alembic_version.version_num = '26f10cadc157'; + +-- Running upgrade 154177371065 -> 28ce1e718f05 + +ALTER TABLE ps_registrations ADD COLUMN fatal_retry_interval INTEGER; + +UPDATE alembic_version SET version_num='28ce1e718f05' WHERE alembic_version.version_num = '154177371065'; + +-- Running upgrade 28ce1e718f05 -> 339a3bdf53fc + +ALTER TABLE ps_endpoints MODIFY accountcode VARCHAR(80) NULL; + +ALTER TABLE sippeers MODIFY accountcode VARCHAR(80) NULL; + +ALTER TABLE iaxfriends MODIFY accountcode VARCHAR(80) NULL; + +UPDATE alembic_version SET version_num='339a3bdf53fc' WHERE alembic_version.version_num = '28ce1e718f05'; + +-- Running upgrade 339a3bdf53fc -> 189a235b3fd7 + +ALTER TABLE ps_globals ADD COLUMN keep_alive_interval INTEGER; + +UPDATE alembic_version SET version_num='189a235b3fd7' WHERE alembic_version.version_num = '339a3bdf53fc'; + +-- Running upgrade 189a235b3fd7 -> 2d078ec071b7 + +ALTER TABLE ps_aors MODIFY contact VARCHAR(255) NULL; + +UPDATE alembic_version SET version_num='2d078ec071b7' WHERE alembic_version.version_num = '189a235b3fd7'; + +-- Running upgrade 2d078ec071b7 -> 26d7f3bf0fa5 + +ALTER TABLE ps_endpoints ADD COLUMN bind_rtp_to_media_address ENUM('yes','no'); + +UPDATE alembic_version SET version_num='26d7f3bf0fa5' WHERE alembic_version.version_num = '2d078ec071b7'; + +-- Running upgrade 26d7f3bf0fa5 -> 136885b81223 + +ALTER TABLE ps_globals ADD COLUMN regcontext VARCHAR(80); + +UPDATE alembic_version SET version_num='136885b81223' WHERE alembic_version.version_num = '26d7f3bf0fa5'; + +-- Running upgrade 136885b81223 -> 423f34ad36e2 + +ALTER TABLE ps_aors MODIFY qualify_timeout FLOAT NULL; + +ALTER TABLE ps_contacts MODIFY qualify_timeout FLOAT NULL; + +UPDATE alembic_version SET version_num='423f34ad36e2' WHERE alembic_version.version_num = '136885b81223'; + +-- Running upgrade 423f34ad36e2 -> dbc44d5a908 + +ALTER TABLE ps_systems ADD COLUMN disable_tcp_switch ENUM('yes','no'); + +ALTER TABLE ps_registrations ADD COLUMN line ENUM('yes','no'); + +ALTER TABLE ps_registrations ADD COLUMN endpoint VARCHAR(40); + +UPDATE alembic_version SET version_num='dbc44d5a908' WHERE alembic_version.version_num = '423f34ad36e2'; + +-- Running upgrade dbc44d5a908 -> 3bcc0b5bc2c9 + +ALTER TABLE ps_transports ADD COLUMN allow_reload ENUM('yes','no'); + +UPDATE alembic_version SET version_num='3bcc0b5bc2c9' WHERE alembic_version.version_num = 'dbc44d5a908'; + +-- Running upgrade 3bcc0b5bc2c9 -> 5813202e92be + +ALTER TABLE ps_globals ADD COLUMN contact_expiration_check_interval INTEGER; + +UPDATE alembic_version SET version_num='5813202e92be' WHERE alembic_version.version_num = '3bcc0b5bc2c9'; + +-- Running upgrade 5813202e92be -> 1c688d9a003c + +ALTER TABLE ps_globals ADD COLUMN default_voicemail_extension VARCHAR(40); + +ALTER TABLE ps_aors ADD COLUMN voicemail_extension VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN voicemail_extension VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN mwi_subscribe_replaces_unsolicited INTEGER; + +UPDATE alembic_version SET version_num='1c688d9a003c' WHERE alembic_version.version_num = '5813202e92be'; + +-- Running upgrade 1c688d9a003c -> 8d478ab86e29 + +ALTER TABLE ps_globals ADD COLUMN disable_multi_domain ENUM('yes','no'); + +UPDATE alembic_version SET version_num='8d478ab86e29' WHERE alembic_version.version_num = '1c688d9a003c'; + +-- Running upgrade 8d478ab86e29 -> 65eb22eb195 + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_count INTEGER; + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_period INTEGER; + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_prune_interval INTEGER; + +ALTER TABLE ps_globals ADD COLUMN default_realm VARCHAR(40); + +UPDATE alembic_version SET version_num='65eb22eb195' WHERE alembic_version.version_num = '8d478ab86e29'; + +-- Running upgrade 65eb22eb195 -> 81b01a191a46 + +ALTER TABLE ps_contacts ADD COLUMN reg_server VARCHAR(20); + +ALTER TABLE ps_contacts ADD CONSTRAINT ps_contacts_uq UNIQUE (id, reg_server); + +UPDATE alembic_version SET version_num='81b01a191a46' WHERE alembic_version.version_num = '65eb22eb195'; + +-- Running upgrade 81b01a191a46 -> 6be31516058d + +ALTER TABLE ps_contacts ADD COLUMN authenticate_qualify ENUM('yes','no'); + +UPDATE alembic_version SET version_num='6be31516058d' WHERE alembic_version.version_num = '81b01a191a46'; + +-- Running upgrade 6be31516058d -> d7e3c73eb2bf + +ALTER TABLE ps_endpoints ADD COLUMN deny VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN permit VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN acl VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN contact_deny VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN contact_permit VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN contact_acl VARCHAR(40); + +UPDATE alembic_version SET version_num='d7e3c73eb2bf' WHERE alembic_version.version_num = '6be31516058d'; + +-- Running upgrade d7e3c73eb2bf -> a845e4d8ade8 + +ALTER TABLE ps_contacts ADD COLUMN via_addr VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN via_port INTEGER; + +ALTER TABLE ps_contacts ADD COLUMN call_id VARCHAR(255); + +UPDATE alembic_version SET version_num='a845e4d8ade8' WHERE alembic_version.version_num = 'd7e3c73eb2bf'; + +-- Running upgrade a845e4d8ade8 -> ef7efc2d3964 + +ALTER TABLE ps_contacts ADD COLUMN endpoint VARCHAR(40); + +ALTER TABLE ps_contacts MODIFY expiration_time BIGINT NULL; + +CREATE INDEX ps_contacts_qualifyfreq_exp ON ps_contacts (qualify_frequency, expiration_time); + +CREATE INDEX ps_aors_qualifyfreq_contact ON ps_aors (qualify_frequency, contact); + +UPDATE alembic_version SET version_num='ef7efc2d3964' WHERE alembic_version.version_num = 'a845e4d8ade8'; + +-- Running upgrade ef7efc2d3964 -> 9deac0ae4717 + +ALTER TABLE ps_endpoints ADD COLUMN subscribe_context VARCHAR(40); + +UPDATE alembic_version SET version_num='9deac0ae4717' WHERE alembic_version.version_num = 'ef7efc2d3964'; + +-- Running upgrade 9deac0ae4717 -> 4a6c67fa9b7a + +ALTER TABLE ps_endpoints ADD COLUMN fax_detect_timeout INTEGER; + +UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.version_num = '9deac0ae4717'; + +-- Running upgrade 4a6c67fa9b7a -> c7a44a5a0851 + +ALTER TABLE ps_globals ADD COLUMN mwi_tps_queue_high INTEGER; + +ALTER TABLE ps_globals ADD COLUMN mwi_tps_queue_low INTEGER; + +ALTER TABLE ps_globals ADD COLUMN mwi_disable_initial_unsolicited ENUM('yes','no'); + +UPDATE alembic_version SET version_num='c7a44a5a0851' WHERE alembic_version.version_num = '4a6c67fa9b7a'; + +-- Running upgrade c7a44a5a0851 -> 3772f8f828da + +ALTER TABLE ps_endpoints MODIFY identify_by ENUM('username','auth_username') NULL; + +UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = 'c7a44a5a0851'; + +-- Running upgrade 3772f8f828da -> 4e2493ef32e6 + +ALTER TABLE ps_endpoints ADD COLUMN contact_user VARCHAR(80); + +UPDATE alembic_version SET version_num='4e2493ef32e6' WHERE alembic_version.version_num = '3772f8f828da'; + +-- Running upgrade 4e2493ef32e6 -> 7f3e21abe318 + +ALTER TABLE ps_endpoints ADD COLUMN preferred_codec_only ENUM('yes','no'); + +UPDATE alembic_version SET version_num='7f3e21abe318' WHERE alembic_version.version_num = '4e2493ef32e6'; + +-- Running upgrade 7f3e21abe318 -> a6ef36f1309 + +ALTER TABLE ps_globals ADD COLUMN ignore_uri_user_options ENUM('yes','no'); + +UPDATE alembic_version SET version_num='a6ef36f1309' WHERE alembic_version.version_num = '7f3e21abe318'; + +-- Running upgrade a6ef36f1309 -> 4468b4a91372 + +ALTER TABLE ps_endpoints ADD COLUMN asymmetric_rtp_codec ENUM('yes','no'); + +UPDATE alembic_version SET version_num='4468b4a91372' WHERE alembic_version.version_num = 'a6ef36f1309'; + +-- Running upgrade 4468b4a91372 -> 28ab27a7826d + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN srv_lookups ENUM('yes','no'); + +UPDATE alembic_version SET version_num='28ab27a7826d' WHERE alembic_version.version_num = '4468b4a91372'; + +-- Running upgrade 28ab27a7826d -> 465e70e8c337 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN match_header VARCHAR(255); + +UPDATE alembic_version SET version_num='465e70e8c337' WHERE alembic_version.version_num = '28ab27a7826d'; + +-- Running upgrade 465e70e8c337 -> 15db7b91a97a + +ALTER TABLE ps_endpoints ADD COLUMN rtcp_mux ENUM('yes','no'); + +UPDATE alembic_version SET version_num='15db7b91a97a' WHERE alembic_version.version_num = '465e70e8c337'; + +-- Running upgrade 15db7b91a97a -> f638dbe2eb23 + +ALTER TABLE ps_transports ADD COLUMN symmetric_transport ENUM('yes','no'); + +ALTER TABLE ps_subscription_persistence ADD COLUMN contact_uri VARCHAR(256); + +UPDATE alembic_version SET version_num='f638dbe2eb23' WHERE alembic_version.version_num = '15db7b91a97a'; + +-- Running upgrade f638dbe2eb23 -> 8fce4c573e15 + +ALTER TABLE ps_endpoints ADD COLUMN allow_overlap ENUM('yes','no'); + +UPDATE alembic_version SET version_num='8fce4c573e15' WHERE alembic_version.version_num = 'f638dbe2eb23'; + +-- Running upgrade 8fce4c573e15 -> 2da192dbbc65 + +CREATE TABLE ps_outbound_publishes ( + id VARCHAR(40) NOT NULL, + expiration INTEGER, + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(256), + server_uri VARCHAR(256), + from_uri VARCHAR(256), + to_uri VARCHAR(256), + event VARCHAR(40), + max_auth_attempts INTEGER, + transport VARCHAR(40), + multi_user ENUM('yes','no'), + `@body` VARCHAR(40), + `@context` VARCHAR(256), + `@exten` VARCHAR(256), + UNIQUE (id) +); + +CREATE INDEX ps_outbound_publishes_id ON ps_outbound_publishes (id); + +CREATE TABLE ps_inbound_publications ( + id VARCHAR(40) NOT NULL, + endpoint VARCHAR(40), + `event_asterisk-devicestate` VARCHAR(40), + `event_asterisk-mwi` VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_inbound_publications_id ON ps_inbound_publications (id); + +CREATE TABLE ps_asterisk_publications ( + id VARCHAR(40) NOT NULL, + devicestate_publish VARCHAR(40), + mailboxstate_publish VARCHAR(40), + device_state ENUM('yes','no'), + device_state_filter VARCHAR(256), + mailbox_state ENUM('yes','no'), + mailbox_state_filter VARCHAR(256), + UNIQUE (id) +); + +CREATE INDEX ps_asterisk_publications_id ON ps_asterisk_publications (id); + +UPDATE alembic_version SET version_num='2da192dbbc65' WHERE alembic_version.version_num = '8fce4c573e15'; + +-- Running upgrade 2da192dbbc65 -> 1d0e332c32af + +CREATE TABLE ps_resource_list ( + id VARCHAR(40) NOT NULL, + list_item VARCHAR(2048), + event VARCHAR(40), + full_state ENUM('yes','no'), + notification_batch_interval INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_resource_list_id ON ps_resource_list (id); + +UPDATE alembic_version SET version_num='1d0e332c32af' WHERE alembic_version.version_num = '2da192dbbc65'; + +-- Running upgrade 1d0e332c32af -> 86bb1efa278d + +ALTER TABLE ps_endpoints ADD COLUMN refer_blind_progress ENUM('yes','no'); + +UPDATE alembic_version SET version_num='86bb1efa278d' WHERE alembic_version.version_num = '1d0e332c32af'; + +-- Running upgrade 86bb1efa278d -> d7983954dd96 + +ALTER TABLE ps_endpoints ADD COLUMN notify_early_inuse_ringing ENUM('yes','no'); + +UPDATE alembic_version SET version_num='d7983954dd96' WHERE alembic_version.version_num = '86bb1efa278d'; + +-- Running upgrade d7983954dd96 -> 39959b9c2566 + +ALTER TABLE ps_endpoints ADD COLUMN max_audio_streams INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN max_video_streams INTEGER; + +UPDATE alembic_version SET version_num='39959b9c2566' WHERE alembic_version.version_num = 'd7983954dd96'; + +-- Running upgrade 39959b9c2566 -> 164abbd708c + +ALTER TABLE ps_endpoints MODIFY dtmf_mode ENUM('rfc4733','inband','info','auto','auto_info') NULL; + +UPDATE alembic_version SET version_num='164abbd708c' WHERE alembic_version.version_num = '39959b9c2566'; + +-- Running upgrade 164abbd708c -> 44ccced114ce + +ALTER TABLE ps_endpoints ADD COLUMN webrtc ENUM('yes','no'); + +UPDATE alembic_version SET version_num='44ccced114ce' WHERE alembic_version.version_num = '164abbd708c'; + +-- Running upgrade 44ccced114ce -> f3d1c5d38b56 + +ALTER TABLE ps_contacts ADD COLUMN prune_on_boot ENUM('yes','no'); + +UPDATE alembic_version SET version_num='f3d1c5d38b56' WHERE alembic_version.version_num = '44ccced114ce'; + +-- Running upgrade f3d1c5d38b56 -> b83645976fdd + +ALTER TABLE ps_endpoints ADD COLUMN dtls_fingerprint ENUM('SHA-1','SHA-256'); + +UPDATE alembic_version SET version_num='b83645976fdd' WHERE alembic_version.version_num = 'f3d1c5d38b56'; + +-- Running upgrade b83645976fdd -> a1698e8bb9c5 + +ALTER TABLE ps_endpoints ADD COLUMN incoming_mwi_mailbox VARCHAR(40); + +UPDATE alembic_version SET version_num='a1698e8bb9c5' WHERE alembic_version.version_num = 'b83645976fdd'; + +-- Running upgrade a1698e8bb9c5 -> 20abce6d1e3c + +ALTER TABLE ps_endpoints MODIFY identify_by ENUM('username','auth_username','ip') NULL; + +UPDATE alembic_version SET version_num='20abce6d1e3c' WHERE alembic_version.version_num = 'a1698e8bb9c5'; + +-- Running upgrade 20abce6d1e3c -> de83fac997e2 + +ALTER TABLE ps_endpoints ADD COLUMN bundle ENUM('yes','no'); + +UPDATE alembic_version SET version_num='de83fac997e2' WHERE alembic_version.version_num = '20abce6d1e3c'; + +-- Running upgrade de83fac997e2 -> 041c0d3d1857 + +ALTER TABLE ps_endpoints ADD COLUMN dtls_auto_generate_cert ENUM('yes','no'); + +UPDATE alembic_version SET version_num='041c0d3d1857' WHERE alembic_version.version_num = 'de83fac997e2'; + +-- Running upgrade 041c0d3d1857 -> e2f04d309071 + +ALTER TABLE queue_members ADD COLUMN wrapuptime INTEGER; + +UPDATE alembic_version SET version_num='e2f04d309071' WHERE alembic_version.version_num = '041c0d3d1857'; + +-- Running upgrade e2f04d309071 -> 52798ad97bdf + +ALTER TABLE ps_endpoints MODIFY identify_by VARCHAR(80) NULL; + +UPDATE alembic_version SET version_num='52798ad97bdf' WHERE alembic_version.version_num = 'e2f04d309071'; + +-- Running upgrade 52798ad97bdf -> d3e4284f8707 + +ALTER TABLE ps_subscription_persistence ADD COLUMN prune_on_boot ENUM('yes','no'); + +UPDATE alembic_version SET version_num='d3e4284f8707' WHERE alembic_version.version_num = '52798ad97bdf'; + +-- Running upgrade d3e4284f8707 -> 0be05c3a8225 + +ALTER TABLE ps_systems ADD COLUMN follow_early_media_fork ENUM('yes','no'); + +ALTER TABLE ps_systems ADD COLUMN accept_multiple_sdp_answers ENUM('yes','no'); + +ALTER TABLE ps_endpoints ADD COLUMN follow_early_media_fork ENUM('yes','no'); + +ALTER TABLE ps_endpoints ADD COLUMN accept_multiple_sdp_answers ENUM('yes','no'); + +UPDATE alembic_version SET version_num='0be05c3a8225' WHERE alembic_version.version_num = 'd3e4284f8707'; + +-- Running upgrade 0be05c3a8225 -> 19b00bc19b7b + +ALTER TABLE ps_endpoints ADD COLUMN suppress_q850_reason_header ENUM('yes','no'); + +UPDATE alembic_version SET version_num='19b00bc19b7b' WHERE alembic_version.version_num = '0be05c3a8225'; + +-- Running upgrade 19b00bc19b7b -> 1d3ed26d9978 + +ALTER TABLE ps_contacts MODIFY uri VARCHAR(511) NULL; + +UPDATE alembic_version SET version_num='1d3ed26d9978' WHERE alembic_version.version_num = '19b00bc19b7b'; + +-- Running upgrade 1d3ed26d9978 -> fe6592859b85 + +ALTER TABLE ps_endpoints MODIFY mwi_subscribe_replaces_unsolicited VARCHAR(5) NULL; + +ALTER TABLE ps_endpoints MODIFY mwi_subscribe_replaces_unsolicited ENUM('0','1','off','on','false','true','no','yes') NULL; + +UPDATE alembic_version SET version_num='fe6592859b85' WHERE alembic_version.version_num = '1d3ed26d9978'; + +-- Running upgrade fe6592859b85 -> 7f85dd44c775 + +ALTER TABLE ps_endpoints CHANGE suppress_q850_reason_header suppress_q850_reason_headers ENUM('yes','no') NULL; + +UPDATE alembic_version SET version_num='7f85dd44c775' WHERE alembic_version.version_num = 'fe6592859b85'; + +-- Running upgrade 7f85dd44c775 -> 465f47f880be + +ALTER TABLE ps_transports MODIFY protocol ENUM('udp','tcp','tls','ws','wss','flow') NULL; + +ALTER TABLE ps_auths MODIFY auth_type ENUM('md5','userpass','google_oauth') NULL; + +ALTER TABLE ps_registrations ADD COLUMN support_outbound ENUM('0','1','off','on','false','true','no','yes'); + +ALTER TABLE ps_registrations ADD COLUMN contact_header_params VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN refresh_token VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN oauth_clientid VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN oauth_secret VARCHAR(255); + +UPDATE alembic_version SET version_num='465f47f880be' WHERE alembic_version.version_num = '7f85dd44c775'; + +-- Running upgrade 465f47f880be -> 2bb1a85135ad + +ALTER TABLE ps_globals ADD COLUMN use_callerid_contact ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='2bb1a85135ad' WHERE alembic_version.version_num = '465f47f880be'; + +-- Running upgrade 2bb1a85135ad -> 1ac563b350a8 + +ALTER TABLE ps_endpoints ADD COLUMN trust_connected_line ENUM('0','1','off','on','false','true','no','yes'); + +ALTER TABLE ps_endpoints ADD COLUMN send_connected_line ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='1ac563b350a8' WHERE alembic_version.version_num = '2bb1a85135ad'; + +-- Running upgrade 1ac563b350a8 -> 0838f8db6a61 + +ALTER TABLE ps_globals ADD COLUMN send_contact_status_on_update_registration ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='0838f8db6a61' WHERE alembic_version.version_num = '1ac563b350a8'; + +-- Running upgrade 0838f8db6a61 -> f3c0b8695b66 + +ALTER TABLE ps_globals ADD COLUMN taskprocessor_overload_trigger ENUM('none','global','pjsip_only'); + +UPDATE alembic_version SET version_num='f3c0b8695b66' WHERE alembic_version.version_num = '0838f8db6a61'; + +-- Running upgrade f3c0b8695b66 -> 80473bad3c16 + +ALTER TABLE ps_endpoints ADD COLUMN ignore_183_without_sdp ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='80473bad3c16' WHERE alembic_version.version_num = 'f3c0b8695b66'; + +-- Running upgrade 80473bad3c16 -> 3a094a18e75b + +ALTER TABLE ps_globals ADD COLUMN norefersub ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='3a094a18e75b' WHERE alembic_version.version_num = '80473bad3c16'; + +-- Running upgrade 3a094a18e75b -> fbb7766f17bc + +CREATE TABLE musiconhold_entry ( + name VARCHAR(80) NOT NULL, + position INTEGER NOT NULL, + entry VARCHAR(1024) NOT NULL, + PRIMARY KEY (name, position) +); + +ALTER TABLE musiconhold_entry ADD CONSTRAINT fk_musiconhold_entry_name_musiconhold FOREIGN KEY(name) REFERENCES musiconhold (name); + +ALTER TABLE musiconhold MODIFY mode ENUM('custom','files','mp3nb','quietmp3nb','quietmp3','playlist') NULL; + +UPDATE alembic_version SET version_num='fbb7766f17bc' WHERE alembic_version.version_num = '3a094a18e75b'; + +-- Running upgrade fbb7766f17bc -> 79290b511e4b + +ALTER TABLE ps_systems ADD COLUMN disable_rport ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='79290b511e4b' WHERE alembic_version.version_num = 'fbb7766f17bc'; + +-- Running upgrade 79290b511e4b -> b80485ff4dd0 + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_incoming_offer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_outgoing_offer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_incoming_answer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_outgoing_answer VARCHAR(128); + +UPDATE alembic_version SET version_num='b80485ff4dd0' WHERE alembic_version.version_num = '79290b511e4b'; + +-- Running upgrade b80485ff4dd0 -> 61797b9fced6 + +ALTER TABLE ps_endpoints ADD COLUMN stir_shaken ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='61797b9fced6' WHERE alembic_version.version_num = 'b80485ff4dd0'; + +-- Running upgrade 61797b9fced6 -> 1ae0609b6646 + +ALTER TABLE ps_contacts MODIFY reg_server VARCHAR(255) NULL; + +UPDATE alembic_version SET version_num='1ae0609b6646' WHERE alembic_version.version_num = '61797b9fced6'; + +-- Running upgrade 1ae0609b6646 -> e658c26033ca + +ALTER TABLE ps_endpoints ADD COLUMN send_history_info ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='e658c26033ca' WHERE alembic_version.version_num = '1ae0609b6646'; + +-- Running upgrade e658c26033ca -> 8915fcc5766f + +ALTER TABLE queue_members ADD COLUMN ringinuse ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='8915fcc5766f' WHERE alembic_version.version_num = 'e658c26033ca'; + +-- Running upgrade 8915fcc5766f -> c20d6e3992f4 + +ALTER TABLE ps_endpoints ADD COLUMN allow_unauthenticated_options ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='c20d6e3992f4' WHERE alembic_version.version_num = '8915fcc5766f'; + +-- Running upgrade c20d6e3992f4 -> f56d79a9f337 + +ALTER TABLE ps_aors ADD COLUMN remove_unavailable ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='f56d79a9f337' WHERE alembic_version.version_num = 'c20d6e3992f4'; + +-- Running upgrade f56d79a9f337 -> a06d8f8462d9 + +ALTER TABLE ps_endpoints ADD COLUMN t38_bind_udptl_to_media_address ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='a06d8f8462d9' WHERE alembic_version.version_num = 'f56d79a9f337'; + +-- Running upgrade a06d8f8462d9 -> 8f72185e437f + +ALTER TABLE ps_resource_list ADD COLUMN resource_display_name ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='8f72185e437f' WHERE alembic_version.version_num = 'a06d8f8462d9'; + +-- Running upgrade 8f72185e437f -> 0bee61aa9425 + +ALTER TABLE ps_globals ADD COLUMN allow_sending_180_after_183 ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='0bee61aa9425' WHERE alembic_version.version_num = '8f72185e437f'; + +-- Running upgrade 0bee61aa9425 -> 18e0805d367f + +ALTER TABLE ps_registrations ADD COLUMN max_random_initial_delay INTEGER; + +UPDATE alembic_version SET version_num='18e0805d367f' WHERE alembic_version.version_num = '0bee61aa9425'; + +-- Running upgrade 18e0805d367f -> 58e440314c2a + +ALTER TABLE ps_transports ADD COLUMN allow_wildcard_certs ENUM('yes','no'); + +UPDATE alembic_version SET version_num='58e440314c2a' WHERE alembic_version.version_num = '18e0805d367f'; + +-- Running upgrade 58e440314c2a -> 7197536bb68d + +ALTER TABLE ps_endpoints ADD COLUMN geoloc_incoming_call_profile VARCHAR(80); + +ALTER TABLE ps_endpoints ADD COLUMN geoloc_outgoing_call_profile VARCHAR(80); + +UPDATE alembic_version SET version_num='7197536bb68d' WHERE alembic_version.version_num = '58e440314c2a'; + +-- Running upgrade 7197536bb68d -> 9f3692b1654b + +ALTER TABLE ps_endpoints ADD COLUMN incoming_call_offer_pref ENUM('local','local_first','remote','remote_first'); + +ALTER TABLE ps_endpoints ADD COLUMN outgoing_call_offer_pref ENUM('local','local_merge','local_first','remote','remote_merge','remote_first'); + +ALTER TABLE ps_endpoints ADD COLUMN stir_shaken_profile VARCHAR(80); + +UPDATE alembic_version SET version_num='9f3692b1654b' WHERE alembic_version.version_num = '7197536bb68d'; + +-- Running upgrade 9f3692b1654b -> 539f68bede2c + +ALTER TABLE ps_endpoints MODIFY `100rel` ENUM('no','required','peer_supported','yes') NULL; + +UPDATE alembic_version SET version_num='539f68bede2c' WHERE alembic_version.version_num = '9f3692b1654b'; + +-- Running upgrade 539f68bede2c -> 417c0247fd7e + +ALTER TABLE ps_endpoints ADD COLUMN security_negotiation ENUM('no','mediasec'); + +ALTER TABLE ps_endpoints ADD COLUMN security_mechanisms VARCHAR(512); + +ALTER TABLE ps_registrations ADD COLUMN security_negotiation ENUM('no','mediasec'); + +ALTER TABLE ps_registrations ADD COLUMN security_mechanisms VARCHAR(512); + +UPDATE alembic_version SET version_num='417c0247fd7e' WHERE alembic_version.version_num = '539f68bede2c'; + +-- Running upgrade 417c0247fd7e -> ccf795ee535f + +ALTER TABLE ps_globals ADD COLUMN all_codecs_on_empty_reinvite ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='ccf795ee535f' WHERE alembic_version.version_num = '417c0247fd7e'; + +-- Running upgrade ccf795ee535f -> 5a2247c957d2 + +ALTER TABLE ps_endpoints ADD COLUMN send_aoc ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='5a2247c957d2' WHERE alembic_version.version_num = 'ccf795ee535f'; + +-- Running upgrade 5a2247c957d2 -> f261363a857f + +ALTER TABLE ps_endpoints ADD COLUMN overlap_context VARCHAR(80); + +UPDATE alembic_version SET version_num='f261363a857f' WHERE alembic_version.version_num = '5a2247c957d2'; + +-- Running upgrade f261363a857f -> 4042a0ff4d9f + +ALTER TABLE queue_members ADD COLUMN reason_paused VARCHAR(80); + +UPDATE alembic_version SET version_num='4042a0ff4d9f' WHERE alembic_version.version_num = 'f261363a857f'; + +-- Running upgrade 4042a0ff4d9f -> f5b0e7427449 + +ALTER TABLE musiconhold ADD COLUMN loop_last ENUM('yes','no'); + +UPDATE alembic_version SET version_num='f5b0e7427449' WHERE alembic_version.version_num = '4042a0ff4d9f'; + +-- Running upgrade f5b0e7427449 -> dac2b4c328b8 + +ALTER TABLE ps_aors MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_aors MODIFY outbound_proxy VARCHAR(255) NULL; + +ALTER TABLE ps_auths MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_auths MODIFY realm VARCHAR(255) NULL; + +ALTER TABLE ps_contacts MODIFY outbound_proxy VARCHAR(255) NULL; + +ALTER TABLE ps_contacts MODIFY endpoint VARCHAR(255) NULL; + +ALTER TABLE ps_domain_aliases MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_domain_aliases MODIFY domain VARCHAR(255) NULL; + +ALTER TABLE ps_endpoint_id_ips MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_endpoint_id_ips MODIFY endpoint VARCHAR(255) NULL; + +ALTER TABLE ps_endpoints MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_endpoints MODIFY aors VARCHAR(2048) NULL; + +ALTER TABLE ps_endpoints MODIFY auth VARCHAR(255) NULL; + +ALTER TABLE ps_endpoints MODIFY outbound_auth VARCHAR(255) NULL; + +ALTER TABLE ps_endpoints MODIFY outbound_proxy VARCHAR(255) NULL; + +ALTER TABLE ps_inbound_publications MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_inbound_publications MODIFY endpoint VARCHAR(255) NULL; + +ALTER TABLE ps_outbound_publishes MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_outbound_publishes MODIFY outbound_auth VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY id VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY outbound_auth VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY outbound_proxy VARCHAR(255) NULL; + +ALTER TABLE ps_registrations MODIFY endpoint VARCHAR(255) NULL; + +UPDATE alembic_version SET version_num='dac2b4c328b8' WHERE alembic_version.version_num = 'f5b0e7427449'; + +-- Running upgrade dac2b4c328b8 -> 37a5332640e2 + +ALTER TABLE ps_transports MODIFY method ENUM('default','unspecified','tlsv1','tlsv1_1','tlsv1_2','tlsv1_3','sslv2','sslv23','sslv3') NULL; + +UPDATE alembic_version SET version_num='37a5332640e2' WHERE alembic_version.version_num = 'dac2b4c328b8'; + +-- Running upgrade 37a5332640e2 -> 24c12d8e9014 + +ALTER TABLE ps_registrations ADD COLUMN user_agent VARCHAR(255); + +UPDATE alembic_version SET version_num='24c12d8e9014' WHERE alembic_version.version_num = '37a5332640e2'; + +-- Running upgrade 24c12d8e9014 -> bd335bae5d33 + +CREATE TABLE stir_tn ( + id VARCHAR(80) NOT NULL, + private_key_file VARCHAR(1024), + public_cert_url VARCHAR(1024), + attest_level VARCHAR(1), + send_mky ENUM('0','1','off','on','false','true','no','yes'), + PRIMARY KEY (id) +); + +UPDATE alembic_version SET version_num='bd335bae5d33' WHERE alembic_version.version_num = '24c12d8e9014'; + +-- Running upgrade bd335bae5d33 -> 74dc751dfe8e + +ALTER TABLE ps_aors MODIFY authenticate_qualify ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_aors MODIFY remove_existing ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_aors MODIFY support_path ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_asterisk_publications MODIFY device_state ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_asterisk_publications MODIFY mailbox_state ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_contacts MODIFY authenticate_qualify ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_contacts MODIFY prune_on_boot ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoint_id_ips MODIFY srv_lookups ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY accept_multiple_sdp_answers ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY aggregate_mwi ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY allow_overlap ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY allow_subscribe ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY allow_transfer ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY asymmetric_rtp_codec ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY bind_rtp_to_media_address ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY bundle ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY direct_media ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY disable_direct_media_on_nat ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY dtls_auto_generate_cert ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY fax_detect ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY follow_early_media_fork ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY force_avp ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY force_rport ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY g726_non_standard ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY ice_support ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY inband_progress ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY media_encryption_optimistic ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY media_use_received_transport ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY moh_passthrough ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY notify_early_inuse_ringing ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY one_touch_recording ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY preferred_codec_only ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY refer_blind_progress ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY rewrite_contact ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY rpid_immediate ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY rtcp_mux ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY rtp_ipv6 ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY rtp_symmetric ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY send_diversion ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY send_pai ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY send_rpid ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY srtp_tag_32 ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY suppress_q850_reason_headers ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY t38_udptl ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY t38_udptl_ipv6 ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY t38_udptl_nat ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY trust_id_inbound ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY trust_id_outbound ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY use_avpf ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY use_ptime ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY user_eq_phone ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_endpoints MODIFY webrtc ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_globals MODIFY disable_multi_domain ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_globals MODIFY ignore_uri_user_options ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_globals MODIFY mwi_disable_initial_unsolicited ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_outbound_publishes MODIFY multi_user ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_registrations MODIFY auth_rejection_permanent ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_registrations MODIFY line ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_registrations MODIFY support_path ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_resource_list MODIFY full_state ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_subscription_persistence MODIFY prune_on_boot ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_systems MODIFY accept_multiple_sdp_answers ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_systems MODIFY compact_headers ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_systems MODIFY disable_tcp_switch ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_systems MODIFY follow_early_media_fork ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY allow_reload ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY allow_wildcard_certs ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY require_client_cert ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY symmetric_transport ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY verify_client ENUM('0','1','off','on','false','true','no','yes') NULL; + +ALTER TABLE ps_transports MODIFY verify_server ENUM('0','1','off','on','false','true','no','yes') NULL; + +UPDATE alembic_version SET version_num='74dc751dfe8e' WHERE alembic_version.version_num = 'bd335bae5d33'; + +-- Running upgrade 74dc751dfe8e -> 8fce8496f03e + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_enable BOOL; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_idle_time INTEGER; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_interval_time INTEGER; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_probe_count INTEGER; + +UPDATE alembic_version SET version_num='8fce8496f03e' WHERE alembic_version.version_num = '74dc751dfe8e'; + +-- Running upgrade 8fce8496f03e -> cf150a175fd3 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN match_request_uri VARCHAR(255); + +UPDATE alembic_version SET version_num='cf150a175fd3' WHERE alembic_version.version_num = '8fce8496f03e'; + +-- Running upgrade cf150a175fd3 -> d5122576cca8 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN transport VARCHAR(128); + +UPDATE alembic_version SET version_num='d5122576cca8' WHERE alembic_version.version_num = 'cf150a175fd3'; + +-- Running upgrade d5122576cca8 -> 6c475a93f48a + +ALTER TABLE ps_aors MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_auths MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_domain_aliases MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_endpoint_id_ips MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_endpoints MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_inbound_publications MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_outbound_publishes MODIFY id VARCHAR(255) NOT NULL; + +ALTER TABLE ps_registrations MODIFY id VARCHAR(255) NOT NULL; + +UPDATE alembic_version SET version_num='6c475a93f48a' WHERE alembic_version.version_num = 'd5122576cca8'; + +-- Running upgrade 6c475a93f48a -> bd9c5159c7ea + +ALTER TABLE ps_endpoint_id_ips DROP COLUMN transport; + +UPDATE alembic_version SET version_num='bd9c5159c7ea' WHERE alembic_version.version_num = '6c475a93f48a'; + +-- Running upgrade bd9c5159c7ea -> 2b7c507d7d12 + +ALTER TABLE queues ADD COLUMN log_restricted_caller_id ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='2b7c507d7d12' WHERE alembic_version.version_num = 'bd9c5159c7ea'; + +-- Running upgrade 2b7c507d7d12 -> 655054a68ad5 + +ALTER TABLE ps_endpoints ADD COLUMN tenantid VARCHAR(80); + +UPDATE alembic_version SET version_num='655054a68ad5' WHERE alembic_version.version_num = '2b7c507d7d12'; + +-- Running upgrade 655054a68ad5 -> 801b9fced8b7 + +ALTER TABLE ps_subscription_persistence ADD COLUMN generator_data TEXT; + +UPDATE alembic_version SET version_num='801b9fced8b7' WHERE alembic_version.version_num = '655054a68ad5'; + +-- Running upgrade 801b9fced8b7 -> 4f91fc18c979 + +ALTER TABLE ps_endpoints ADD COLUMN suppress_moh_on_sendonly ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='4f91fc18c979' WHERE alembic_version.version_num = '801b9fced8b7'; + +-- Running upgrade 4f91fc18c979 -> 44bd6dd914fa + +ALTER TABLE ps_aors ADD COLUMN qualify_2xx_only ENUM('0','1','off','on','false','true','no','yes'); + +ALTER TABLE ps_contacts ADD COLUMN qualify_2xx_only ENUM('0','1','off','on','false','true','no','yes'); + +UPDATE alembic_version SET version_num='44bd6dd914fa' WHERE alembic_version.version_num = '4f91fc18c979'; + +-- Running upgrade 44bd6dd914fa -> abdc9ede147d + +ALTER TABLE ps_auths ADD COLUMN password_digest VARCHAR(1024); + +ALTER TABLE ps_auths ADD COLUMN supported_algorithms_uas VARCHAR(1024); + +ALTER TABLE ps_auths ADD COLUMN supported_algorithms_uac VARCHAR(1024); + +ALTER TABLE ps_globals ADD COLUMN default_auth_algorithms_uas VARCHAR(1024); + +ALTER TABLE ps_globals ADD COLUMN default_auth_algorithms_uac VARCHAR(1024); + +UPDATE alembic_version SET version_num='abdc9ede147d' WHERE alembic_version.version_num = '44bd6dd914fa'; + diff --git a/contrib/realtime/mysql/mysql_queue_log.sql b/contrib/realtime/mysql/mysql_queue_log.sql new file mode 100644 index 0000000000..24d664336f --- /dev/null +++ b/contrib/realtime/mysql/mysql_queue_log.sql @@ -0,0 +1,25 @@ +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 4105ee839f58 + +CREATE TABLE queue_log ( + id BIGINT NOT NULL AUTO_INCREMENT, + time DATETIME, + callid VARCHAR(80), + queuename VARCHAR(256), + agent VARCHAR(80), + event VARCHAR(32), + data1 VARCHAR(100), + data2 VARCHAR(100), + data3 VARCHAR(100), + data4 VARCHAR(100), + data5 VARCHAR(100), + PRIMARY KEY (id), + UNIQUE (id) +); + +INSERT INTO alembic_version (version_num) VALUES ('4105ee839f58'); + diff --git a/contrib/realtime/mysql/mysql_voicemail.sql b/contrib/realtime/mysql/mysql_voicemail.sql new file mode 100644 index 0000000000..a75247944a --- /dev/null +++ b/contrib/realtime/mysql/mysql_voicemail.sql @@ -0,0 +1,47 @@ +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> a2e9769475e + +CREATE TABLE voicemail_messages ( + dir VARCHAR(255) NOT NULL, + msgnum INTEGER NOT NULL, + context VARCHAR(80), + macrocontext VARCHAR(80), + callerid VARCHAR(80), + origtime INTEGER, + duration INTEGER, + recording BLOB, + flag VARCHAR(30), + category VARCHAR(30), + mailboxuser VARCHAR(30), + mailboxcontext VARCHAR(30), + msg_id VARCHAR(40) +); + +ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum); + +CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir); + +INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e'); + +-- Running upgrade a2e9769475e -> 39428242f7f5 + +ALTER TABLE voicemail_messages MODIFY recording BLOB(4294967295) NULL; + +UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e'; + +-- Running upgrade 39428242f7f5 -> 1c55c341360f + +ALTER TABLE voicemail_messages DROP COLUMN macrocontext; + +UPDATE alembic_version SET version_num='1c55c341360f' WHERE alembic_version.version_num = '39428242f7f5'; + +-- Running upgrade 1c55c341360f -> 64fae6bbe7fb + +DROP INDEX voicemail_messages_dir ON voicemail_messages; + +UPDATE alembic_version SET version_num='64fae6bbe7fb' WHERE alembic_version.version_num = '1c55c341360f'; + diff --git a/contrib/realtime/postgresql/postgresql_cdr.sql b/contrib/realtime/postgresql/postgresql_cdr.sql new file mode 100644 index 0000000000..409b90ef73 --- /dev/null +++ b/contrib/realtime/postgresql/postgresql_cdr.sql @@ -0,0 +1,45 @@ +BEGIN; + +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 210693f3123d + +CREATE TABLE cdr ( + accountcode VARCHAR(20), + src VARCHAR(80), + dst VARCHAR(80), + dcontext VARCHAR(80), + clid VARCHAR(80), + channel VARCHAR(80), + dstchannel VARCHAR(80), + lastapp VARCHAR(80), + lastdata VARCHAR(80), + start TIMESTAMP WITHOUT TIME ZONE, + answer TIMESTAMP WITHOUT TIME ZONE, + "end" TIMESTAMP WITHOUT TIME ZONE, + duration INTEGER, + billsec INTEGER, + disposition VARCHAR(45), + amaflags VARCHAR(45), + userfield VARCHAR(256), + uniqueid VARCHAR(150), + linkedid VARCHAR(150), + peeraccount VARCHAR(20), + sequence INTEGER +); + +INSERT INTO alembic_version (version_num) VALUES ('210693f3123d') RETURNING alembic_version.version_num; + +-- Running upgrade 210693f3123d -> 54cde9847798 + +ALTER TABLE cdr ALTER COLUMN accountcode TYPE VARCHAR(80); + +ALTER TABLE cdr ALTER COLUMN peeraccount TYPE VARCHAR(80); + +UPDATE alembic_version SET version_num='54cde9847798' WHERE alembic_version.version_num = '210693f3123d'; + +COMMIT; + diff --git a/contrib/realtime/postgresql/postgresql_config.sql b/contrib/realtime/postgresql/postgresql_config.sql new file mode 100644 index 0000000000..4f93200b18 --- /dev/null +++ b/contrib/realtime/postgresql/postgresql_config.sql @@ -0,0 +1,1863 @@ +BEGIN; + +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 4da0c5f79a9c + +CREATE TYPE type_values AS ENUM ('friend', 'user', 'peer'); + +CREATE TYPE sip_transport_values AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss', 'udp,tcp', 'tcp,udp'); + +CREATE TYPE sip_dtmfmode_values AS ENUM ('rfc2833', 'info', 'shortinfo', 'inband', 'auto'); + +CREATE TYPE sip_directmedia_values AS ENUM ('yes', 'no', 'nonat', 'update'); + +CREATE TYPE yes_no_values AS ENUM ('yes', 'no'); + +CREATE TYPE sip_progressinband_values AS ENUM ('yes', 'no', 'never'); + +CREATE TYPE sip_session_timers_values AS ENUM ('accept', 'refuse', 'originate'); + +CREATE TYPE sip_session_refresher_values AS ENUM ('uac', 'uas'); + +CREATE TYPE sip_callingpres_values AS ENUM ('allowed_not_screened', 'allowed_passed_screen', 'allowed_failed_screen', 'allowed', 'prohib_not_screened', 'prohib_passed_screen', 'prohib_failed_screen', 'prohib'); + +CREATE TABLE sippeers ( + id SERIAL NOT NULL, + name VARCHAR(40) NOT NULL, + ipaddr VARCHAR(45), + port INTEGER, + regseconds INTEGER, + defaultuser VARCHAR(40), + fullcontact VARCHAR(80), + regserver VARCHAR(20), + useragent VARCHAR(20), + lastms INTEGER, + host VARCHAR(40), + type type_values, + context VARCHAR(40), + permit VARCHAR(95), + deny VARCHAR(95), + secret VARCHAR(40), + md5secret VARCHAR(40), + remotesecret VARCHAR(40), + transport sip_transport_values, + dtmfmode sip_dtmfmode_values, + directmedia sip_directmedia_values, + nat VARCHAR(29), + callgroup VARCHAR(40), + pickupgroup VARCHAR(40), + language VARCHAR(40), + disallow VARCHAR(200), + allow VARCHAR(200), + insecure VARCHAR(40), + trustrpid yes_no_values, + progressinband sip_progressinband_values, + promiscredir yes_no_values, + useclientcode yes_no_values, + accountcode VARCHAR(40), + setvar VARCHAR(200), + callerid VARCHAR(40), + amaflags VARCHAR(40), + callcounter yes_no_values, + busylevel INTEGER, + allowoverlap yes_no_values, + allowsubscribe yes_no_values, + videosupport yes_no_values, + maxcallbitrate INTEGER, + rfc2833compensate yes_no_values, + mailbox VARCHAR(40), + "session-timers" sip_session_timers_values, + "session-expires" INTEGER, + "session-minse" INTEGER, + "session-refresher" sip_session_refresher_values, + t38pt_usertpsource VARCHAR(40), + regexten VARCHAR(40), + fromdomain VARCHAR(40), + fromuser VARCHAR(40), + "qualify" VARCHAR(40), + defaultip VARCHAR(45), + rtptimeout INTEGER, + rtpholdtimeout INTEGER, + sendrpid yes_no_values, + outboundproxy VARCHAR(40), + callbackextension VARCHAR(40), + timert1 INTEGER, + timerb INTEGER, + qualifyfreq INTEGER, + constantssrc yes_no_values, + contactpermit VARCHAR(95), + contactdeny VARCHAR(95), + usereqphone yes_no_values, + textsupport yes_no_values, + faxdetect yes_no_values, + buggymwi yes_no_values, + auth VARCHAR(40), + fullname VARCHAR(40), + trunkname VARCHAR(40), + cid_number VARCHAR(40), + callingpres sip_callingpres_values, + mohinterpret VARCHAR(40), + mohsuggest VARCHAR(40), + parkinglot VARCHAR(40), + hasvoicemail yes_no_values, + subscribemwi yes_no_values, + vmexten VARCHAR(40), + autoframing yes_no_values, + rtpkeepalive INTEGER, + "call-limit" INTEGER, + g726nonstandard yes_no_values, + ignoresdpversion yes_no_values, + allowtransfer yes_no_values, + dynamic yes_no_values, + path VARCHAR(256), + supportpath yes_no_values, + PRIMARY KEY (id), + UNIQUE (name) +); + +CREATE INDEX sippeers_name ON sippeers (name); + +CREATE INDEX sippeers_name_host ON sippeers (name, host); + +CREATE INDEX sippeers_ipaddr_port ON sippeers (ipaddr, port); + +CREATE INDEX sippeers_host_port ON sippeers (host, port); + +CREATE TYPE iax_requirecalltoken_values AS ENUM ('yes', 'no', 'auto'); + +CREATE TYPE iax_encryption_values AS ENUM ('yes', 'no', 'aes128'); + +CREATE TYPE iax_transfer_values AS ENUM ('yes', 'no', 'mediaonly'); + +CREATE TABLE iaxfriends ( + id SERIAL NOT NULL, + name VARCHAR(40) NOT NULL, + type type_values, + username VARCHAR(40), + mailbox VARCHAR(40), + secret VARCHAR(40), + dbsecret VARCHAR(40), + context VARCHAR(40), + regcontext VARCHAR(40), + host VARCHAR(40), + ipaddr VARCHAR(40), + port INTEGER, + defaultip VARCHAR(20), + sourceaddress VARCHAR(20), + mask VARCHAR(20), + regexten VARCHAR(40), + regseconds INTEGER, + accountcode VARCHAR(20), + mohinterpret VARCHAR(20), + mohsuggest VARCHAR(20), + inkeys VARCHAR(40), + outkeys VARCHAR(40), + language VARCHAR(10), + callerid VARCHAR(100), + cid_number VARCHAR(40), + sendani yes_no_values, + fullname VARCHAR(40), + trunk yes_no_values, + auth VARCHAR(20), + maxauthreq INTEGER, + requirecalltoken iax_requirecalltoken_values, + encryption iax_encryption_values, + transfer iax_transfer_values, + jitterbuffer yes_no_values, + forcejitterbuffer yes_no_values, + disallow VARCHAR(200), + allow VARCHAR(200), + codecpriority VARCHAR(40), + "qualify" VARCHAR(10), + qualifysmoothing yes_no_values, + qualifyfreqok VARCHAR(10), + qualifyfreqnotok VARCHAR(10), + timezone VARCHAR(20), + adsi yes_no_values, + amaflags VARCHAR(20), + setvar VARCHAR(200), + PRIMARY KEY (id), + UNIQUE (name) +); + +CREATE INDEX iaxfriends_name ON iaxfriends (name); + +CREATE INDEX iaxfriends_name_host ON iaxfriends (name, host); + +CREATE INDEX iaxfriends_name_ipaddr_port ON iaxfriends (name, ipaddr, port); + +CREATE INDEX iaxfriends_ipaddr_port ON iaxfriends (ipaddr, port); + +CREATE INDEX iaxfriends_host_port ON iaxfriends (host, port); + +CREATE TABLE voicemail ( + uniqueid SERIAL NOT NULL, + context VARCHAR(80) NOT NULL, + mailbox VARCHAR(80) NOT NULL, + password VARCHAR(80) NOT NULL, + fullname VARCHAR(80), + alias VARCHAR(80), + email VARCHAR(80), + pager VARCHAR(80), + attach yes_no_values, + attachfmt VARCHAR(10), + serveremail VARCHAR(80), + language VARCHAR(20), + tz VARCHAR(30), + deletevoicemail yes_no_values, + saycid yes_no_values, + sendvoicemail yes_no_values, + review yes_no_values, + tempgreetwarn yes_no_values, + operator yes_no_values, + envelope yes_no_values, + sayduration INTEGER, + forcename yes_no_values, + forcegreetings yes_no_values, + callback VARCHAR(80), + dialout VARCHAR(80), + exitcontext VARCHAR(80), + maxmsg INTEGER, + volgain NUMERIC(5, 2), + imapuser VARCHAR(80), + imappassword VARCHAR(80), + imapserver VARCHAR(80), + imapport VARCHAR(8), + imapflags VARCHAR(80), + stamp TIMESTAMP WITHOUT TIME ZONE, + PRIMARY KEY (uniqueid) +); + +CREATE INDEX voicemail_mailbox ON voicemail (mailbox); + +CREATE INDEX voicemail_context ON voicemail (context); + +CREATE INDEX voicemail_mailbox_context ON voicemail (mailbox, context); + +CREATE INDEX voicemail_imapuser ON voicemail (imapuser); + +CREATE TABLE meetme ( + bookid SERIAL NOT NULL, + confno VARCHAR(80) NOT NULL, + starttime TIMESTAMP WITHOUT TIME ZONE, + endtime TIMESTAMP WITHOUT TIME ZONE, + pin VARCHAR(20), + adminpin VARCHAR(20), + opts VARCHAR(20), + adminopts VARCHAR(20), + recordingfilename VARCHAR(80), + recordingformat VARCHAR(10), + maxusers INTEGER, + members INTEGER NOT NULL, + PRIMARY KEY (bookid) +); + +CREATE INDEX meetme_confno_start_end ON meetme (confno, starttime, endtime); + +CREATE TYPE moh_mode_values AS ENUM ('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3'); + +CREATE TABLE musiconhold ( + name VARCHAR(80) NOT NULL, + mode moh_mode_values, + directory VARCHAR(255), + application VARCHAR(255), + digit VARCHAR(1), + sort VARCHAR(10), + format VARCHAR(10), + stamp TIMESTAMP WITHOUT TIME ZONE, + PRIMARY KEY (name) +); + +INSERT INTO alembic_version (version_num) VALUES ('4da0c5f79a9c') RETURNING alembic_version.version_num; + +-- Running upgrade 4da0c5f79a9c -> 43956d550a44 + +CREATE TYPE yesno_values AS ENUM ('yes', 'no'); + +CREATE TYPE pjsip_connected_line_method_values AS ENUM ('invite', 'reinvite', 'update'); + +CREATE TYPE pjsip_direct_media_glare_mitigation_values AS ENUM ('none', 'outgoing', 'incoming'); + +CREATE TYPE pjsip_dtmf_mode_values AS ENUM ('rfc4733', 'inband', 'info'); + +CREATE TYPE pjsip_identify_by_values AS ENUM ('username'); + +CREATE TYPE pjsip_timer_values AS ENUM ('forced', 'no', 'required', 'yes'); + +CREATE TYPE pjsip_cid_privacy_values AS ENUM ('allowed_not_screened', 'allowed_passed_screened', 'allowed_failed_screened', 'allowed', 'prohib_not_screened', 'prohib_passed_screened', 'prohib_failed_screened', 'prohib', 'unavailable'); + +CREATE TYPE pjsip_100rel_values AS ENUM ('no', 'required', 'yes'); + +CREATE TYPE pjsip_media_encryption_values AS ENUM ('no', 'sdes', 'dtls'); + +CREATE TYPE pjsip_t38udptl_ec_values AS ENUM ('none', 'fec', 'redundancy'); + +CREATE TYPE pjsip_dtls_setup_values AS ENUM ('active', 'passive', 'actpass'); + +CREATE TABLE ps_endpoints ( + id VARCHAR(40) NOT NULL, + transport VARCHAR(40), + aors VARCHAR(200), + auth VARCHAR(40), + context VARCHAR(40), + disallow VARCHAR(200), + allow VARCHAR(200), + direct_media yesno_values, + connected_line_method pjsip_connected_line_method_values, + direct_media_method pjsip_connected_line_method_values, + direct_media_glare_mitigation pjsip_direct_media_glare_mitigation_values, + disable_direct_media_on_nat yesno_values, + dtmf_mode pjsip_dtmf_mode_values, + external_media_address VARCHAR(40), + force_rport yesno_values, + ice_support yesno_values, + identify_by pjsip_identify_by_values, + mailboxes VARCHAR(40), + moh_suggest VARCHAR(40), + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(40), + rewrite_contact yesno_values, + rtp_ipv6 yesno_values, + rtp_symmetric yesno_values, + send_diversion yesno_values, + send_pai yesno_values, + send_rpid yesno_values, + timers_min_se INTEGER, + timers pjsip_timer_values, + timers_sess_expires INTEGER, + callerid VARCHAR(40), + callerid_privacy pjsip_cid_privacy_values, + callerid_tag VARCHAR(40), + "100rel" pjsip_100rel_values, + aggregate_mwi yesno_values, + trust_id_inbound yesno_values, + trust_id_outbound yesno_values, + use_ptime yesno_values, + use_avpf yesno_values, + media_encryption pjsip_media_encryption_values, + inband_progress yesno_values, + call_group VARCHAR(40), + pickup_group VARCHAR(40), + named_call_group VARCHAR(40), + named_pickup_group VARCHAR(40), + device_state_busy_at INTEGER, + fax_detect yesno_values, + t38_udptl yesno_values, + t38_udptl_ec pjsip_t38udptl_ec_values, + t38_udptl_maxdatagram INTEGER, + t38_udptl_nat yesno_values, + t38_udptl_ipv6 yesno_values, + tone_zone VARCHAR(40), + language VARCHAR(40), + one_touch_recording yesno_values, + record_on_feature VARCHAR(40), + record_off_feature VARCHAR(40), + rtp_engine VARCHAR(40), + allow_transfer yesno_values, + allow_subscribe yesno_values, + sdp_owner VARCHAR(40), + sdp_session VARCHAR(40), + tos_audio INTEGER, + tos_video INTEGER, + cos_audio INTEGER, + cos_video INTEGER, + sub_min_expiry INTEGER, + from_domain VARCHAR(40), + from_user VARCHAR(40), + mwi_fromuser VARCHAR(40), + dtls_verify VARCHAR(40), + dtls_rekey VARCHAR(40), + dtls_cert_file VARCHAR(200), + dtls_private_key VARCHAR(200), + dtls_cipher VARCHAR(200), + dtls_ca_file VARCHAR(200), + dtls_ca_path VARCHAR(200), + dtls_setup pjsip_dtls_setup_values, + srtp_tag_32 yesno_values, + UNIQUE (id) +); + +CREATE INDEX ps_endpoints_id ON ps_endpoints (id); + +CREATE TYPE pjsip_auth_type_values AS ENUM ('md5', 'userpass'); + +CREATE TABLE ps_auths ( + id VARCHAR(40) NOT NULL, + auth_type pjsip_auth_type_values, + nonce_lifetime INTEGER, + md5_cred VARCHAR(40), + password VARCHAR(80), + realm VARCHAR(40), + username VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_auths_id ON ps_auths (id); + +CREATE TABLE ps_aors ( + id VARCHAR(40) NOT NULL, + contact VARCHAR(40), + default_expiration INTEGER, + mailboxes VARCHAR(80), + max_contacts INTEGER, + minimum_expiration INTEGER, + remove_existing yesno_values, + qualify_frequency INTEGER, + authenticate_qualify yesno_values, + UNIQUE (id) +); + +CREATE INDEX ps_aors_id ON ps_aors (id); + +CREATE TABLE ps_contacts ( + id VARCHAR(40) NOT NULL, + uri VARCHAR(40), + expiration_time VARCHAR(40), + qualify_frequency INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_contacts_id ON ps_contacts (id); + +CREATE TABLE ps_domain_aliases ( + id VARCHAR(40) NOT NULL, + domain VARCHAR(80), + UNIQUE (id) +); + +CREATE INDEX ps_domain_aliases_id ON ps_domain_aliases (id); + +CREATE TABLE ps_endpoint_id_ips ( + id VARCHAR(40) NOT NULL, + endpoint VARCHAR(40), + match VARCHAR(80), + UNIQUE (id) +); + +CREATE INDEX ps_endpoint_id_ips_id ON ps_endpoint_id_ips (id); + +UPDATE alembic_version SET version_num='43956d550a44' WHERE alembic_version.version_num = '4da0c5f79a9c'; + +-- Running upgrade 43956d550a44 -> 581a4264e537 + +CREATE TABLE extensions ( + id BIGSERIAL NOT NULL, + context VARCHAR(40) NOT NULL, + exten VARCHAR(40) NOT NULL, + priority INTEGER NOT NULL, + app VARCHAR(40) NOT NULL, + appdata VARCHAR(256) NOT NULL, + PRIMARY KEY (id), + UNIQUE (context, exten, priority), + UNIQUE (id) +); + +UPDATE alembic_version SET version_num='581a4264e537' WHERE alembic_version.version_num = '43956d550a44'; + +-- Running upgrade 581a4264e537 -> 2fc7930b41b3 + +CREATE TYPE pjsip_redirect_method_values AS ENUM ('user', 'uri_core', 'uri_pjsip'); + +CREATE TABLE ps_systems ( + id VARCHAR(40) NOT NULL, + timer_t1 INTEGER, + timer_b INTEGER, + compact_headers yesno_values, + threadpool_initial_size INTEGER, + threadpool_auto_increment INTEGER, + threadpool_idle_timeout INTEGER, + threadpool_max_size INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_systems_id ON ps_systems (id); + +CREATE TABLE ps_globals ( + id VARCHAR(40) NOT NULL, + max_forwards INTEGER, + user_agent VARCHAR(40), + default_outbound_endpoint VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_globals_id ON ps_globals (id); + +CREATE TYPE pjsip_transport_method_values AS ENUM ('default', 'unspecified', 'tlsv1', 'sslv2', 'sslv3', 'sslv23'); + +CREATE TYPE pjsip_transport_protocol_values AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss'); + +CREATE TABLE ps_transports ( + id VARCHAR(40) NOT NULL, + async_operations INTEGER, + bind VARCHAR(40), + ca_list_file VARCHAR(200), + cert_file VARCHAR(200), + cipher VARCHAR(200), + domain VARCHAR(40), + external_media_address VARCHAR(40), + external_signaling_address VARCHAR(40), + external_signaling_port INTEGER, + method pjsip_transport_method_values, + local_net VARCHAR(40), + password VARCHAR(40), + priv_key_file VARCHAR(200), + protocol pjsip_transport_protocol_values, + require_client_cert yesno_values, + verify_client yesno_values, + verifiy_server yesno_values, + tos yesno_values, + cos yesno_values, + UNIQUE (id) +); + +CREATE INDEX ps_transports_id ON ps_transports (id); + +CREATE TABLE ps_registrations ( + id VARCHAR(40) NOT NULL, + auth_rejection_permanent yesno_values, + client_uri VARCHAR(40), + contact_user VARCHAR(40), + expiration INTEGER, + max_retries INTEGER, + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(40), + retry_interval INTEGER, + forbidden_retry_interval INTEGER, + server_uri VARCHAR(40), + transport VARCHAR(40), + support_path yesno_values, + UNIQUE (id) +); + +CREATE INDEX ps_registrations_id ON ps_registrations (id); + +ALTER TABLE ps_endpoints ADD COLUMN media_address VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN redirect_method pjsip_redirect_method_values; + +ALTER TABLE ps_endpoints ADD COLUMN set_var TEXT; + +ALTER TABLE ps_endpoints RENAME mwi_fromuser TO mwi_from_user; + +ALTER TABLE ps_contacts ADD COLUMN outbound_proxy VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN path TEXT; + +ALTER TABLE ps_aors ADD COLUMN maximum_expiration INTEGER; + +ALTER TABLE ps_aors ADD COLUMN outbound_proxy VARCHAR(40); + +ALTER TABLE ps_aors ADD COLUMN support_path yesno_values; + +UPDATE alembic_version SET version_num='2fc7930b41b3' WHERE alembic_version.version_num = '581a4264e537'; + +-- Running upgrade 2fc7930b41b3 -> 21e526ad3040 + +ALTER TABLE ps_globals ADD COLUMN debug VARCHAR(40); + +UPDATE alembic_version SET version_num='21e526ad3040' WHERE alembic_version.version_num = '2fc7930b41b3'; + +-- Running upgrade 21e526ad3040 -> 28887f25a46f + +CREATE TYPE queue_autopause_values AS ENUM ('yes', 'no', 'all'); + +CREATE TYPE queue_strategy_values AS ENUM ('ringall', 'leastrecent', 'fewestcalls', 'random', 'rrmemory', 'linear', 'wrandom', 'rrordered'); + +CREATE TABLE queues ( + name VARCHAR(128) NOT NULL, + musiconhold VARCHAR(128), + announce VARCHAR(128), + context VARCHAR(128), + timeout INTEGER, + ringinuse yesno_values, + setinterfacevar yesno_values, + setqueuevar yesno_values, + setqueueentryvar yesno_values, + monitor_format VARCHAR(8), + membermacro VARCHAR(512), + membergosub VARCHAR(512), + queue_youarenext VARCHAR(128), + queue_thereare VARCHAR(128), + queue_callswaiting VARCHAR(128), + queue_quantity1 VARCHAR(128), + queue_quantity2 VARCHAR(128), + queue_holdtime VARCHAR(128), + queue_minutes VARCHAR(128), + queue_minute VARCHAR(128), + queue_seconds VARCHAR(128), + queue_thankyou VARCHAR(128), + queue_callerannounce VARCHAR(128), + queue_reporthold VARCHAR(128), + announce_frequency INTEGER, + announce_to_first_user yesno_values, + min_announce_frequency INTEGER, + announce_round_seconds INTEGER, + announce_holdtime VARCHAR(128), + announce_position VARCHAR(128), + announce_position_limit INTEGER, + periodic_announce VARCHAR(50), + periodic_announce_frequency INTEGER, + relative_periodic_announce yesno_values, + random_periodic_announce yesno_values, + retry INTEGER, + wrapuptime INTEGER, + penaltymemberslimit INTEGER, + autofill yesno_values, + monitor_type VARCHAR(128), + autopause queue_autopause_values, + autopausedelay INTEGER, + autopausebusy yesno_values, + autopauseunavail yesno_values, + maxlen INTEGER, + servicelevel INTEGER, + strategy queue_strategy_values, + joinempty VARCHAR(128), + leavewhenempty VARCHAR(128), + reportholdtime yesno_values, + memberdelay INTEGER, + weight INTEGER, + timeoutrestart yesno_values, + defaultrule VARCHAR(128), + timeoutpriority VARCHAR(128), + PRIMARY KEY (name) +); + +CREATE TABLE queue_members ( + queue_name VARCHAR(80) NOT NULL, + interface VARCHAR(80) NOT NULL, + uniqueid VARCHAR(80) NOT NULL, + membername VARCHAR(80), + state_interface VARCHAR(80), + penalty INTEGER, + paused INTEGER, + PRIMARY KEY (queue_name, interface) +); + +UPDATE alembic_version SET version_num='28887f25a46f' WHERE alembic_version.version_num = '21e526ad3040'; + +-- Running upgrade 28887f25a46f -> 4c573e7135bd + +ALTER TABLE ps_endpoints ALTER COLUMN tos_audio TYPE VARCHAR(10); + +ALTER TABLE ps_endpoints ALTER COLUMN tos_video TYPE VARCHAR(10); + +ALTER TABLE ps_endpoints DROP COLUMN cos_audio; + +ALTER TABLE ps_endpoints DROP COLUMN cos_video; + +ALTER TABLE ps_endpoints ADD COLUMN cos_audio INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN cos_video INTEGER; + +ALTER TABLE ps_transports ALTER COLUMN tos TYPE VARCHAR(10); + +ALTER TABLE ps_transports DROP COLUMN cos; + +ALTER TABLE ps_transports ADD COLUMN cos INTEGER; + +UPDATE alembic_version SET version_num='4c573e7135bd' WHERE alembic_version.version_num = '28887f25a46f'; + +-- Running upgrade 4c573e7135bd -> 3855ee4e5f85 + +ALTER TABLE ps_endpoints ADD COLUMN message_context VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN user_agent VARCHAR(40); + +UPDATE alembic_version SET version_num='3855ee4e5f85' WHERE alembic_version.version_num = '4c573e7135bd'; + +-- Running upgrade 3855ee4e5f85 -> e96a0b8071c + +ALTER TABLE ps_globals ALTER COLUMN user_agent TYPE VARCHAR(255); + +ALTER TABLE ps_contacts ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_contacts ALTER COLUMN uri TYPE VARCHAR(255); + +ALTER TABLE ps_contacts ALTER COLUMN user_agent TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN client_uri TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN server_uri TYPE VARCHAR(255); + +UPDATE alembic_version SET version_num='e96a0b8071c' WHERE alembic_version.version_num = '3855ee4e5f85'; + +-- Running upgrade e96a0b8071c -> c6d929b23a8 + +CREATE TABLE ps_subscription_persistence ( + id VARCHAR(40) NOT NULL, + packet VARCHAR(2048), + src_name VARCHAR(128), + src_port INTEGER, + transport_key VARCHAR(64), + local_name VARCHAR(128), + local_port INTEGER, + cseq INTEGER, + tag VARCHAR(128), + endpoint VARCHAR(40), + expires INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_subscription_persistence_id ON ps_subscription_persistence (id); + +UPDATE alembic_version SET version_num='c6d929b23a8' WHERE alembic_version.version_num = 'e96a0b8071c'; + +-- Running upgrade c6d929b23a8 -> 51f8cb66540e + +ALTER TABLE ps_endpoints ADD COLUMN force_avp yesno_values; + +ALTER TABLE ps_endpoints ADD COLUMN media_use_received_transport yesno_values; + +UPDATE alembic_version SET version_num='51f8cb66540e' WHERE alembic_version.version_num = 'c6d929b23a8'; + +-- Running upgrade 51f8cb66540e -> 1d50859ed02e + +ALTER TABLE ps_endpoints ADD COLUMN accountcode VARCHAR(20); + +UPDATE alembic_version SET version_num='1d50859ed02e' WHERE alembic_version.version_num = '51f8cb66540e'; + +-- Running upgrade 1d50859ed02e -> 1758e8bbf6b + +ALTER TABLE sippeers ALTER COLUMN useragent TYPE VARCHAR(255); + +UPDATE alembic_version SET version_num='1758e8bbf6b' WHERE alembic_version.version_num = '1d50859ed02e'; + +-- Running upgrade 1758e8bbf6b -> 5139253c0423 + +ALTER TABLE queue_members DROP COLUMN uniqueid; + +ALTER TABLE queue_members ADD COLUMN uniqueid INTEGER NOT NULL; + +ALTER TABLE queue_members ADD UNIQUE (uniqueid); + +UPDATE alembic_version SET version_num='5139253c0423' WHERE alembic_version.version_num = '1758e8bbf6b'; + +-- Running upgrade 5139253c0423 -> d39508cb8d8 + +CREATE TABLE queue_rules ( + rule_name VARCHAR(80) NOT NULL, + time VARCHAR(32) NOT NULL, + min_penalty VARCHAR(32) NOT NULL, + max_penalty VARCHAR(32) NOT NULL +); + +UPDATE alembic_version SET version_num='d39508cb8d8' WHERE alembic_version.version_num = '5139253c0423'; + +-- Running upgrade d39508cb8d8 -> 5950038a6ead + +ALTER TABLE ps_transports ALTER COLUMN verifiy_server TYPE yesno_values; + +ALTER TABLE ps_transports RENAME verifiy_server TO verify_server; + +UPDATE alembic_version SET version_num='5950038a6ead' WHERE alembic_version.version_num = 'd39508cb8d8'; + +-- Running upgrade 5950038a6ead -> 10aedae86a32 + +CREATE TYPE sip_directmedia_values_v2 AS ENUM ('yes', 'no', 'nonat', 'update', 'outgoing'); + +ALTER TABLE sippeers ALTER COLUMN directmedia TYPE sip_directmedia_values_v2 USING directmedia::text::sip_directmedia_values_v2; + +DROP TYPE sip_directmedia_values; + +UPDATE alembic_version SET version_num='10aedae86a32' WHERE alembic_version.version_num = '5950038a6ead'; + +-- Running upgrade 10aedae86a32 -> 371a3bf4143e + +ALTER TABLE ps_endpoints ADD COLUMN user_eq_phone yesno_values; + +UPDATE alembic_version SET version_num='371a3bf4143e' WHERE alembic_version.version_num = '10aedae86a32'; + +-- Running upgrade 371a3bf4143e -> 15b1430ad6f1 + +ALTER TABLE ps_endpoints ADD COLUMN moh_passthrough yesno_values; + +UPDATE alembic_version SET version_num='15b1430ad6f1' WHERE alembic_version.version_num = '371a3bf4143e'; + +-- Running upgrade 15b1430ad6f1 -> 945b1098bdd + +ALTER TABLE ps_endpoints ADD COLUMN media_encryption_optimistic yesno_values; + +UPDATE alembic_version SET version_num='945b1098bdd' WHERE alembic_version.version_num = '15b1430ad6f1'; + +-- Running upgrade 945b1098bdd -> 45e3f47c6c44 + +ALTER TABLE ps_globals ADD COLUMN endpoint_identifier_order VARCHAR(40); + +UPDATE alembic_version SET version_num='45e3f47c6c44' WHERE alembic_version.version_num = '945b1098bdd'; + +-- Running upgrade 45e3f47c6c44 -> 23530d604b96 + +ALTER TABLE ps_endpoints ADD COLUMN rpid_immediate yesno_values; + +UPDATE alembic_version SET version_num='23530d604b96' WHERE alembic_version.version_num = '45e3f47c6c44'; + +-- Running upgrade 23530d604b96 -> 31cd4f4891ec + +CREATE TYPE pjsip_dtmf_mode_values_v2 AS ENUM ('rfc4733', 'inband', 'info', 'auto'); + +ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE pjsip_dtmf_mode_values_v2 USING dtmf_mode::text::pjsip_dtmf_mode_values_v2; + +DROP TYPE pjsip_dtmf_mode_values; + +UPDATE alembic_version SET version_num='31cd4f4891ec' WHERE alembic_version.version_num = '23530d604b96'; + +-- Running upgrade 31cd4f4891ec -> 461d7d691209 + +ALTER TABLE ps_aors ADD COLUMN qualify_timeout INTEGER; + +ALTER TABLE ps_contacts ADD COLUMN qualify_timeout INTEGER; + +UPDATE alembic_version SET version_num='461d7d691209' WHERE alembic_version.version_num = '31cd4f4891ec'; + +-- Running upgrade 461d7d691209 -> a541e0b5e89 + +ALTER TABLE ps_globals ADD COLUMN max_initial_qualify_time INTEGER; + +UPDATE alembic_version SET version_num='a541e0b5e89' WHERE alembic_version.version_num = '461d7d691209'; + +-- Running upgrade a541e0b5e89 -> 28b8e71e541f + +ALTER TABLE ps_endpoints ADD COLUMN g726_non_standard yesno_values; + +UPDATE alembic_version SET version_num='28b8e71e541f' WHERE alembic_version.version_num = 'a541e0b5e89'; + +-- Running upgrade 28b8e71e541f -> 498357a710ae + +ALTER TABLE ps_endpoints ADD COLUMN rtp_keepalive INTEGER; + +UPDATE alembic_version SET version_num='498357a710ae' WHERE alembic_version.version_num = '28b8e71e541f'; + +-- Running upgrade 498357a710ae -> 26f10cadc157 + +ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN rtp_timeout_hold INTEGER; + +UPDATE alembic_version SET version_num='26f10cadc157' WHERE alembic_version.version_num = '498357a710ae'; + +-- Running upgrade 26f10cadc157 -> 154177371065 + +ALTER TABLE ps_globals ADD COLUMN default_from_user VARCHAR(80); + +UPDATE alembic_version SET version_num='154177371065' WHERE alembic_version.version_num = '26f10cadc157'; + +-- Running upgrade 154177371065 -> 28ce1e718f05 + +ALTER TABLE ps_registrations ADD COLUMN fatal_retry_interval INTEGER; + +UPDATE alembic_version SET version_num='28ce1e718f05' WHERE alembic_version.version_num = '154177371065'; + +-- Running upgrade 28ce1e718f05 -> 339a3bdf53fc + +ALTER TABLE ps_endpoints ALTER COLUMN accountcode TYPE VARCHAR(80); + +ALTER TABLE sippeers ALTER COLUMN accountcode TYPE VARCHAR(80); + +ALTER TABLE iaxfriends ALTER COLUMN accountcode TYPE VARCHAR(80); + +UPDATE alembic_version SET version_num='339a3bdf53fc' WHERE alembic_version.version_num = '28ce1e718f05'; + +-- Running upgrade 339a3bdf53fc -> 189a235b3fd7 + +ALTER TABLE ps_globals ADD COLUMN keep_alive_interval INTEGER; + +UPDATE alembic_version SET version_num='189a235b3fd7' WHERE alembic_version.version_num = '339a3bdf53fc'; + +-- Running upgrade 189a235b3fd7 -> 2d078ec071b7 + +ALTER TABLE ps_aors ALTER COLUMN contact TYPE VARCHAR(255); + +UPDATE alembic_version SET version_num='2d078ec071b7' WHERE alembic_version.version_num = '189a235b3fd7'; + +-- Running upgrade 2d078ec071b7 -> 26d7f3bf0fa5 + +ALTER TABLE ps_endpoints ADD COLUMN bind_rtp_to_media_address yesno_values; + +UPDATE alembic_version SET version_num='26d7f3bf0fa5' WHERE alembic_version.version_num = '2d078ec071b7'; + +-- Running upgrade 26d7f3bf0fa5 -> 136885b81223 + +ALTER TABLE ps_globals ADD COLUMN regcontext VARCHAR(80); + +UPDATE alembic_version SET version_num='136885b81223' WHERE alembic_version.version_num = '26d7f3bf0fa5'; + +-- Running upgrade 136885b81223 -> 423f34ad36e2 + +ALTER TABLE ps_aors ALTER COLUMN qualify_timeout TYPE FLOAT; + +ALTER TABLE ps_contacts ALTER COLUMN qualify_timeout TYPE FLOAT; + +UPDATE alembic_version SET version_num='423f34ad36e2' WHERE alembic_version.version_num = '136885b81223'; + +-- Running upgrade 423f34ad36e2 -> dbc44d5a908 + +ALTER TABLE ps_systems ADD COLUMN disable_tcp_switch yesno_values; + +ALTER TABLE ps_registrations ADD COLUMN line yesno_values; + +ALTER TABLE ps_registrations ADD COLUMN endpoint VARCHAR(40); + +UPDATE alembic_version SET version_num='dbc44d5a908' WHERE alembic_version.version_num = '423f34ad36e2'; + +-- Running upgrade dbc44d5a908 -> 3bcc0b5bc2c9 + +ALTER TABLE ps_transports ADD COLUMN allow_reload yesno_values; + +UPDATE alembic_version SET version_num='3bcc0b5bc2c9' WHERE alembic_version.version_num = 'dbc44d5a908'; + +-- Running upgrade 3bcc0b5bc2c9 -> 5813202e92be + +ALTER TABLE ps_globals ADD COLUMN contact_expiration_check_interval INTEGER; + +UPDATE alembic_version SET version_num='5813202e92be' WHERE alembic_version.version_num = '3bcc0b5bc2c9'; + +-- Running upgrade 5813202e92be -> 1c688d9a003c + +ALTER TABLE ps_globals ADD COLUMN default_voicemail_extension VARCHAR(40); + +ALTER TABLE ps_aors ADD COLUMN voicemail_extension VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN voicemail_extension VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN mwi_subscribe_replaces_unsolicited INTEGER; + +UPDATE alembic_version SET version_num='1c688d9a003c' WHERE alembic_version.version_num = '5813202e92be'; + +-- Running upgrade 1c688d9a003c -> 8d478ab86e29 + +ALTER TABLE ps_globals ADD COLUMN disable_multi_domain yesno_values; + +UPDATE alembic_version SET version_num='8d478ab86e29' WHERE alembic_version.version_num = '1c688d9a003c'; + +-- Running upgrade 8d478ab86e29 -> 65eb22eb195 + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_count INTEGER; + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_period INTEGER; + +ALTER TABLE ps_globals ADD COLUMN unidentified_request_prune_interval INTEGER; + +ALTER TABLE ps_globals ADD COLUMN default_realm VARCHAR(40); + +UPDATE alembic_version SET version_num='65eb22eb195' WHERE alembic_version.version_num = '8d478ab86e29'; + +-- Running upgrade 65eb22eb195 -> 81b01a191a46 + +ALTER TABLE ps_contacts ADD COLUMN reg_server VARCHAR(20); + +ALTER TABLE ps_contacts ADD CONSTRAINT ps_contacts_uq UNIQUE (id, reg_server); + +UPDATE alembic_version SET version_num='81b01a191a46' WHERE alembic_version.version_num = '65eb22eb195'; + +-- Running upgrade 81b01a191a46 -> 6be31516058d + +ALTER TABLE ps_contacts ADD COLUMN authenticate_qualify yesno_values; + +UPDATE alembic_version SET version_num='6be31516058d' WHERE alembic_version.version_num = '81b01a191a46'; + +-- Running upgrade 6be31516058d -> d7e3c73eb2bf + +ALTER TABLE ps_endpoints ADD COLUMN deny VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN permit VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN acl VARCHAR(40); + +ALTER TABLE ps_endpoints ADD COLUMN contact_deny VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN contact_permit VARCHAR(95); + +ALTER TABLE ps_endpoints ADD COLUMN contact_acl VARCHAR(40); + +UPDATE alembic_version SET version_num='d7e3c73eb2bf' WHERE alembic_version.version_num = '6be31516058d'; + +-- Running upgrade d7e3c73eb2bf -> a845e4d8ade8 + +ALTER TABLE ps_contacts ADD COLUMN via_addr VARCHAR(40); + +ALTER TABLE ps_contacts ADD COLUMN via_port INTEGER; + +ALTER TABLE ps_contacts ADD COLUMN call_id VARCHAR(255); + +UPDATE alembic_version SET version_num='a845e4d8ade8' WHERE alembic_version.version_num = 'd7e3c73eb2bf'; + +-- Running upgrade a845e4d8ade8 -> ef7efc2d3964 + +ALTER TABLE ps_contacts ADD COLUMN endpoint VARCHAR(40); + +ALTER TABLE ps_contacts ALTER COLUMN expiration_time TYPE BIGINT USING expiration_time::bigint; + +CREATE INDEX ps_contacts_qualifyfreq_exp ON ps_contacts (qualify_frequency, expiration_time); + +CREATE INDEX ps_aors_qualifyfreq_contact ON ps_aors (qualify_frequency, contact); + +UPDATE alembic_version SET version_num='ef7efc2d3964' WHERE alembic_version.version_num = 'a845e4d8ade8'; + +-- Running upgrade ef7efc2d3964 -> 9deac0ae4717 + +ALTER TABLE ps_endpoints ADD COLUMN subscribe_context VARCHAR(40); + +UPDATE alembic_version SET version_num='9deac0ae4717' WHERE alembic_version.version_num = 'ef7efc2d3964'; + +-- Running upgrade 9deac0ae4717 -> 4a6c67fa9b7a + +ALTER TABLE ps_endpoints ADD COLUMN fax_detect_timeout INTEGER; + +UPDATE alembic_version SET version_num='4a6c67fa9b7a' WHERE alembic_version.version_num = '9deac0ae4717'; + +-- Running upgrade 4a6c67fa9b7a -> c7a44a5a0851 + +ALTER TABLE ps_globals ADD COLUMN mwi_tps_queue_high INTEGER; + +ALTER TABLE ps_globals ADD COLUMN mwi_tps_queue_low INTEGER; + +ALTER TABLE ps_globals ADD COLUMN mwi_disable_initial_unsolicited yesno_values; + +UPDATE alembic_version SET version_num='c7a44a5a0851' WHERE alembic_version.version_num = '4a6c67fa9b7a'; + +-- Running upgrade c7a44a5a0851 -> 3772f8f828da + +ALTER TYPE pjsip_identify_by_values RENAME TO pjsip_identify_by_values_tmp; + +CREATE TYPE pjsip_identify_by_values AS ENUM ('username', 'auth_username'); + +ALTER TABLE ps_endpoints ALTER COLUMN identify_by TYPE pjsip_identify_by_values USING identify_by::text::pjsip_identify_by_values; + +DROP TYPE pjsip_identify_by_values_tmp; + +UPDATE alembic_version SET version_num='3772f8f828da' WHERE alembic_version.version_num = 'c7a44a5a0851'; + +-- Running upgrade 3772f8f828da -> 4e2493ef32e6 + +ALTER TABLE ps_endpoints ADD COLUMN contact_user VARCHAR(80); + +UPDATE alembic_version SET version_num='4e2493ef32e6' WHERE alembic_version.version_num = '3772f8f828da'; + +-- Running upgrade 4e2493ef32e6 -> 7f3e21abe318 + +ALTER TABLE ps_endpoints ADD COLUMN preferred_codec_only yesno_values; + +UPDATE alembic_version SET version_num='7f3e21abe318' WHERE alembic_version.version_num = '4e2493ef32e6'; + +-- Running upgrade 7f3e21abe318 -> a6ef36f1309 + +ALTER TABLE ps_globals ADD COLUMN ignore_uri_user_options yesno_values; + +UPDATE alembic_version SET version_num='a6ef36f1309' WHERE alembic_version.version_num = '7f3e21abe318'; + +-- Running upgrade a6ef36f1309 -> 4468b4a91372 + +ALTER TABLE ps_endpoints ADD COLUMN asymmetric_rtp_codec yesno_values; + +UPDATE alembic_version SET version_num='4468b4a91372' WHERE alembic_version.version_num = 'a6ef36f1309'; + +-- Running upgrade 4468b4a91372 -> 28ab27a7826d + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN srv_lookups yesno_values; + +UPDATE alembic_version SET version_num='28ab27a7826d' WHERE alembic_version.version_num = '4468b4a91372'; + +-- Running upgrade 28ab27a7826d -> 465e70e8c337 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN match_header VARCHAR(255); + +UPDATE alembic_version SET version_num='465e70e8c337' WHERE alembic_version.version_num = '28ab27a7826d'; + +-- Running upgrade 465e70e8c337 -> 15db7b91a97a + +ALTER TABLE ps_endpoints ADD COLUMN rtcp_mux yesno_values; + +UPDATE alembic_version SET version_num='15db7b91a97a' WHERE alembic_version.version_num = '465e70e8c337'; + +-- Running upgrade 15db7b91a97a -> f638dbe2eb23 + +ALTER TABLE ps_transports ADD COLUMN symmetric_transport yesno_values; + +ALTER TABLE ps_subscription_persistence ADD COLUMN contact_uri VARCHAR(256); + +UPDATE alembic_version SET version_num='f638dbe2eb23' WHERE alembic_version.version_num = '15db7b91a97a'; + +-- Running upgrade f638dbe2eb23 -> 8fce4c573e15 + +ALTER TABLE ps_endpoints ADD COLUMN allow_overlap yesno_values; + +UPDATE alembic_version SET version_num='8fce4c573e15' WHERE alembic_version.version_num = 'f638dbe2eb23'; + +-- Running upgrade 8fce4c573e15 -> 2da192dbbc65 + +CREATE TABLE ps_outbound_publishes ( + id VARCHAR(40) NOT NULL, + expiration INTEGER, + outbound_auth VARCHAR(40), + outbound_proxy VARCHAR(256), + server_uri VARCHAR(256), + from_uri VARCHAR(256), + to_uri VARCHAR(256), + event VARCHAR(40), + max_auth_attempts INTEGER, + transport VARCHAR(40), + multi_user yesno_values, + "@body" VARCHAR(40), + "@context" VARCHAR(256), + "@exten" VARCHAR(256), + UNIQUE (id) +); + +CREATE INDEX ps_outbound_publishes_id ON ps_outbound_publishes (id); + +CREATE TABLE ps_inbound_publications ( + id VARCHAR(40) NOT NULL, + endpoint VARCHAR(40), + "event_asterisk-devicestate" VARCHAR(40), + "event_asterisk-mwi" VARCHAR(40), + UNIQUE (id) +); + +CREATE INDEX ps_inbound_publications_id ON ps_inbound_publications (id); + +CREATE TABLE ps_asterisk_publications ( + id VARCHAR(40) NOT NULL, + devicestate_publish VARCHAR(40), + mailboxstate_publish VARCHAR(40), + device_state yesno_values, + device_state_filter VARCHAR(256), + mailbox_state yesno_values, + mailbox_state_filter VARCHAR(256), + UNIQUE (id) +); + +CREATE INDEX ps_asterisk_publications_id ON ps_asterisk_publications (id); + +UPDATE alembic_version SET version_num='2da192dbbc65' WHERE alembic_version.version_num = '8fce4c573e15'; + +-- Running upgrade 2da192dbbc65 -> 1d0e332c32af + +CREATE TABLE ps_resource_list ( + id VARCHAR(40) NOT NULL, + list_item VARCHAR(2048), + event VARCHAR(40), + full_state yesno_values, + notification_batch_interval INTEGER, + UNIQUE (id) +); + +CREATE INDEX ps_resource_list_id ON ps_resource_list (id); + +UPDATE alembic_version SET version_num='1d0e332c32af' WHERE alembic_version.version_num = '2da192dbbc65'; + +-- Running upgrade 1d0e332c32af -> 86bb1efa278d + +ALTER TABLE ps_endpoints ADD COLUMN refer_blind_progress yesno_values; + +UPDATE alembic_version SET version_num='86bb1efa278d' WHERE alembic_version.version_num = '1d0e332c32af'; + +-- Running upgrade 86bb1efa278d -> d7983954dd96 + +ALTER TABLE ps_endpoints ADD COLUMN notify_early_inuse_ringing yesno_values; + +UPDATE alembic_version SET version_num='d7983954dd96' WHERE alembic_version.version_num = '86bb1efa278d'; + +-- Running upgrade d7983954dd96 -> 39959b9c2566 + +ALTER TABLE ps_endpoints ADD COLUMN max_audio_streams INTEGER; + +ALTER TABLE ps_endpoints ADD COLUMN max_video_streams INTEGER; + +UPDATE alembic_version SET version_num='39959b9c2566' WHERE alembic_version.version_num = 'd7983954dd96'; + +-- Running upgrade 39959b9c2566 -> 164abbd708c + +CREATE TYPE pjsip_dtmf_mode_values_v3 AS ENUM ('rfc4733', 'inband', 'info', 'auto', 'auto_info'); + +ALTER TABLE ps_endpoints ALTER COLUMN dtmf_mode TYPE pjsip_dtmf_mode_values_v3 USING dtmf_mode::text::pjsip_dtmf_mode_values_v3; + +DROP TYPE pjsip_dtmf_mode_values_v2; + +UPDATE alembic_version SET version_num='164abbd708c' WHERE alembic_version.version_num = '39959b9c2566'; + +-- Running upgrade 164abbd708c -> 44ccced114ce + +ALTER TABLE ps_endpoints ADD COLUMN webrtc yesno_values; + +UPDATE alembic_version SET version_num='44ccced114ce' WHERE alembic_version.version_num = '164abbd708c'; + +-- Running upgrade 44ccced114ce -> f3d1c5d38b56 + +ALTER TABLE ps_contacts ADD COLUMN prune_on_boot yesno_values; + +UPDATE alembic_version SET version_num='f3d1c5d38b56' WHERE alembic_version.version_num = '44ccced114ce'; + +-- Running upgrade f3d1c5d38b56 -> b83645976fdd + +CREATE TYPE sha_hash_values AS ENUM ('SHA-1', 'SHA-256'); + +ALTER TABLE ps_endpoints ADD COLUMN dtls_fingerprint sha_hash_values; + +UPDATE alembic_version SET version_num='b83645976fdd' WHERE alembic_version.version_num = 'f3d1c5d38b56'; + +-- Running upgrade b83645976fdd -> a1698e8bb9c5 + +ALTER TABLE ps_endpoints ADD COLUMN incoming_mwi_mailbox VARCHAR(40); + +UPDATE alembic_version SET version_num='a1698e8bb9c5' WHERE alembic_version.version_num = 'b83645976fdd'; + +-- Running upgrade a1698e8bb9c5 -> 20abce6d1e3c + +ALTER TYPE pjsip_identify_by_values RENAME TO pjsip_identify_by_values_tmp; + +CREATE TYPE pjsip_identify_by_values AS ENUM ('username', 'auth_username', 'ip'); + +ALTER TABLE ps_endpoints ALTER COLUMN identify_by TYPE pjsip_identify_by_values USING identify_by::text::pjsip_identify_by_values; + +DROP TYPE pjsip_identify_by_values_tmp; + +UPDATE alembic_version SET version_num='20abce6d1e3c' WHERE alembic_version.version_num = 'a1698e8bb9c5'; + +-- Running upgrade 20abce6d1e3c -> de83fac997e2 + +ALTER TABLE ps_endpoints ADD COLUMN bundle yesno_values; + +UPDATE alembic_version SET version_num='de83fac997e2' WHERE alembic_version.version_num = '20abce6d1e3c'; + +-- Running upgrade de83fac997e2 -> 041c0d3d1857 + +ALTER TABLE ps_endpoints ADD COLUMN dtls_auto_generate_cert yesno_values; + +UPDATE alembic_version SET version_num='041c0d3d1857' WHERE alembic_version.version_num = 'de83fac997e2'; + +-- Running upgrade 041c0d3d1857 -> e2f04d309071 + +ALTER TABLE queue_members ADD COLUMN wrapuptime INTEGER; + +UPDATE alembic_version SET version_num='e2f04d309071' WHERE alembic_version.version_num = '041c0d3d1857'; + +-- Running upgrade e2f04d309071 -> 52798ad97bdf + +ALTER TABLE ps_endpoints ALTER COLUMN identify_by TYPE varchar(80) USING identify_by::text::pjsip_identify_by_values; + +DROP TYPE pjsip_identify_by_values; + +UPDATE alembic_version SET version_num='52798ad97bdf' WHERE alembic_version.version_num = 'e2f04d309071'; + +-- Running upgrade 52798ad97bdf -> d3e4284f8707 + +ALTER TABLE ps_subscription_persistence ADD COLUMN prune_on_boot yesno_values; + +UPDATE alembic_version SET version_num='d3e4284f8707' WHERE alembic_version.version_num = '52798ad97bdf'; + +-- Running upgrade d3e4284f8707 -> 0be05c3a8225 + +ALTER TABLE ps_systems ADD COLUMN follow_early_media_fork yesno_values; + +ALTER TABLE ps_systems ADD COLUMN accept_multiple_sdp_answers yesno_values; + +ALTER TABLE ps_endpoints ADD COLUMN follow_early_media_fork yesno_values; + +ALTER TABLE ps_endpoints ADD COLUMN accept_multiple_sdp_answers yesno_values; + +UPDATE alembic_version SET version_num='0be05c3a8225' WHERE alembic_version.version_num = 'd3e4284f8707'; + +-- Running upgrade 0be05c3a8225 -> 19b00bc19b7b + +ALTER TABLE ps_endpoints ADD COLUMN suppress_q850_reason_header yesno_values; + +UPDATE alembic_version SET version_num='19b00bc19b7b' WHERE alembic_version.version_num = '0be05c3a8225'; + +-- Running upgrade 19b00bc19b7b -> 1d3ed26d9978 + +ALTER TABLE ps_contacts ALTER COLUMN uri TYPE VARCHAR(511); + +UPDATE alembic_version SET version_num='1d3ed26d9978' WHERE alembic_version.version_num = '19b00bc19b7b'; + +-- Running upgrade 1d3ed26d9978 -> fe6592859b85 + +CREATE TYPE ast_bool_values AS ENUM ('0', '1', 'off', 'on', 'false', 'true', 'no', 'yes'); + +ALTER TABLE ps_endpoints ALTER COLUMN mwi_subscribe_replaces_unsolicited TYPE VARCHAR(5); + +ALTER TABLE ps_endpoints ALTER COLUMN mwi_subscribe_replaces_unsolicited TYPE ast_bool_values USING mwi_subscribe_replaces_unsolicited::ast_bool_values; + +UPDATE alembic_version SET version_num='fe6592859b85' WHERE alembic_version.version_num = '1d3ed26d9978'; + +-- Running upgrade fe6592859b85 -> 7f85dd44c775 + +ALTER TABLE ps_endpoints ALTER COLUMN suppress_q850_reason_header TYPE yesno_values; + +ALTER TABLE ps_endpoints RENAME suppress_q850_reason_header TO suppress_q850_reason_headers; + +UPDATE alembic_version SET version_num='7f85dd44c775' WHERE alembic_version.version_num = 'fe6592859b85'; + +-- Running upgrade 7f85dd44c775 -> 465f47f880be + +CREATE TYPE pjsip_transport_protocol_values_v2 AS ENUM ('udp', 'tcp', 'tls', 'ws', 'wss', 'flow'); + +ALTER TABLE ps_transports ALTER COLUMN protocol TYPE pjsip_transport_protocol_values_v2 USING protocol::text::pjsip_transport_protocol_values_v2; + +DROP TYPE pjsip_transport_protocol_values; + +CREATE TYPE pjsip_auth_type_values_v2 AS ENUM ('md5', 'userpass', 'google_oauth'); + +ALTER TABLE ps_auths ALTER COLUMN auth_type TYPE pjsip_auth_type_values_v2 USING auth_type::text::pjsip_auth_type_values_v2; + +DROP TYPE pjsip_auth_type_values; + +ALTER TABLE ps_registrations ADD COLUMN support_outbound ast_bool_values; + +ALTER TABLE ps_registrations ADD COLUMN contact_header_params VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN refresh_token VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN oauth_clientid VARCHAR(255); + +ALTER TABLE ps_auths ADD COLUMN oauth_secret VARCHAR(255); + +UPDATE alembic_version SET version_num='465f47f880be' WHERE alembic_version.version_num = '7f85dd44c775'; + +-- Running upgrade 465f47f880be -> 2bb1a85135ad + +ALTER TABLE ps_globals ADD COLUMN use_callerid_contact ast_bool_values; + +UPDATE alembic_version SET version_num='2bb1a85135ad' WHERE alembic_version.version_num = '465f47f880be'; + +-- Running upgrade 2bb1a85135ad -> 1ac563b350a8 + +ALTER TABLE ps_endpoints ADD COLUMN trust_connected_line ast_bool_values; + +ALTER TABLE ps_endpoints ADD COLUMN send_connected_line ast_bool_values; + +UPDATE alembic_version SET version_num='1ac563b350a8' WHERE alembic_version.version_num = '2bb1a85135ad'; + +-- Running upgrade 1ac563b350a8 -> 0838f8db6a61 + +ALTER TABLE ps_globals ADD COLUMN send_contact_status_on_update_registration ast_bool_values; + +UPDATE alembic_version SET version_num='0838f8db6a61' WHERE alembic_version.version_num = '1ac563b350a8'; + +-- Running upgrade 0838f8db6a61 -> f3c0b8695b66 + +CREATE TYPE pjsip_taskprocessor_overload_trigger_values AS ENUM ('none', 'global', 'pjsip_only'); + +ALTER TABLE ps_globals ADD COLUMN taskprocessor_overload_trigger pjsip_taskprocessor_overload_trigger_values; + +UPDATE alembic_version SET version_num='f3c0b8695b66' WHERE alembic_version.version_num = '0838f8db6a61'; + +-- Running upgrade f3c0b8695b66 -> 80473bad3c16 + +ALTER TABLE ps_endpoints ADD COLUMN ignore_183_without_sdp ast_bool_values; + +UPDATE alembic_version SET version_num='80473bad3c16' WHERE alembic_version.version_num = 'f3c0b8695b66'; + +-- Running upgrade 80473bad3c16 -> 3a094a18e75b + +ALTER TABLE ps_globals ADD COLUMN norefersub ast_bool_values; + +UPDATE alembic_version SET version_num='3a094a18e75b' WHERE alembic_version.version_num = '80473bad3c16'; + +-- Running upgrade 3a094a18e75b -> fbb7766f17bc + +CREATE TABLE musiconhold_entry ( + name VARCHAR(80) NOT NULL, + position INTEGER NOT NULL, + entry VARCHAR(1024) NOT NULL, + PRIMARY KEY (name, position) +); + +ALTER TABLE musiconhold_entry ADD CONSTRAINT fk_musiconhold_entry_name_musiconhold FOREIGN KEY(name) REFERENCES musiconhold (name); + +ALTER TYPE moh_mode_values RENAME TO moh_mode_values_tmp; + +CREATE TYPE moh_mode_values AS ENUM ('custom', 'files', 'mp3nb', 'quietmp3nb', 'quietmp3', 'playlist'); + +ALTER TABLE musiconhold ALTER COLUMN mode TYPE moh_mode_values USING mode::text::moh_mode_values; + +DROP TYPE moh_mode_values_tmp; + +UPDATE alembic_version SET version_num='fbb7766f17bc' WHERE alembic_version.version_num = '3a094a18e75b'; + +-- Running upgrade fbb7766f17bc -> 79290b511e4b + +ALTER TABLE ps_systems ADD COLUMN disable_rport ast_bool_values; + +UPDATE alembic_version SET version_num='79290b511e4b' WHERE alembic_version.version_num = 'fbb7766f17bc'; + +-- Running upgrade 79290b511e4b -> b80485ff4dd0 + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_incoming_offer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_outgoing_offer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_incoming_answer VARCHAR(128); + +ALTER TABLE ps_endpoints ADD COLUMN codec_prefs_outgoing_answer VARCHAR(128); + +UPDATE alembic_version SET version_num='b80485ff4dd0' WHERE alembic_version.version_num = '79290b511e4b'; + +-- Running upgrade b80485ff4dd0 -> 61797b9fced6 + +ALTER TABLE ps_endpoints ADD COLUMN stir_shaken ast_bool_values; + +UPDATE alembic_version SET version_num='61797b9fced6' WHERE alembic_version.version_num = 'b80485ff4dd0'; + +-- Running upgrade 61797b9fced6 -> 1ae0609b6646 + +ALTER TABLE ps_contacts ALTER COLUMN reg_server TYPE VARCHAR(255); + +UPDATE alembic_version SET version_num='1ae0609b6646' WHERE alembic_version.version_num = '61797b9fced6'; + +-- Running upgrade 1ae0609b6646 -> e658c26033ca + +ALTER TABLE ps_endpoints ADD COLUMN send_history_info ast_bool_values; + +UPDATE alembic_version SET version_num='e658c26033ca' WHERE alembic_version.version_num = '1ae0609b6646'; + +-- Running upgrade e658c26033ca -> 8915fcc5766f + +ALTER TABLE queue_members ADD COLUMN ringinuse ast_bool_values; + +UPDATE alembic_version SET version_num='8915fcc5766f' WHERE alembic_version.version_num = 'e658c26033ca'; + +-- Running upgrade 8915fcc5766f -> c20d6e3992f4 + +ALTER TABLE ps_endpoints ADD COLUMN allow_unauthenticated_options ast_bool_values; + +UPDATE alembic_version SET version_num='c20d6e3992f4' WHERE alembic_version.version_num = '8915fcc5766f'; + +-- Running upgrade c20d6e3992f4 -> f56d79a9f337 + +ALTER TABLE ps_aors ADD COLUMN remove_unavailable ast_bool_values; + +UPDATE alembic_version SET version_num='f56d79a9f337' WHERE alembic_version.version_num = 'c20d6e3992f4'; + +-- Running upgrade f56d79a9f337 -> a06d8f8462d9 + +ALTER TABLE ps_endpoints ADD COLUMN t38_bind_udptl_to_media_address ast_bool_values; + +UPDATE alembic_version SET version_num='a06d8f8462d9' WHERE alembic_version.version_num = 'f56d79a9f337'; + +-- Running upgrade a06d8f8462d9 -> 8f72185e437f + +ALTER TABLE ps_resource_list ADD COLUMN resource_display_name ast_bool_values; + +UPDATE alembic_version SET version_num='8f72185e437f' WHERE alembic_version.version_num = 'a06d8f8462d9'; + +-- Running upgrade 8f72185e437f -> 0bee61aa9425 + +ALTER TABLE ps_globals ADD COLUMN allow_sending_180_after_183 ast_bool_values; + +UPDATE alembic_version SET version_num='0bee61aa9425' WHERE alembic_version.version_num = '8f72185e437f'; + +-- Running upgrade 0bee61aa9425 -> 18e0805d367f + +ALTER TABLE ps_registrations ADD COLUMN max_random_initial_delay INTEGER; + +UPDATE alembic_version SET version_num='18e0805d367f' WHERE alembic_version.version_num = '0bee61aa9425'; + +-- Running upgrade 18e0805d367f -> 58e440314c2a + +ALTER TABLE ps_transports ADD COLUMN allow_wildcard_certs yesno_values; + +UPDATE alembic_version SET version_num='58e440314c2a' WHERE alembic_version.version_num = '18e0805d367f'; + +-- Running upgrade 58e440314c2a -> 7197536bb68d + +ALTER TABLE ps_endpoints ADD COLUMN geoloc_incoming_call_profile VARCHAR(80); + +ALTER TABLE ps_endpoints ADD COLUMN geoloc_outgoing_call_profile VARCHAR(80); + +UPDATE alembic_version SET version_num='7197536bb68d' WHERE alembic_version.version_num = '58e440314c2a'; + +-- Running upgrade 7197536bb68d -> 9f3692b1654b + +CREATE TYPE pjsip_incoming_call_offer_pref_values AS ENUM ('local', 'local_first', 'remote', 'remote_first'); + +CREATE TYPE pjsip_outgoing_call_offer_pref_values AS ENUM ('local', 'local_merge', 'local_first', 'remote', 'remote_merge', 'remote_first'); + +ALTER TABLE ps_endpoints ADD COLUMN incoming_call_offer_pref pjsip_incoming_call_offer_pref_values; + +ALTER TABLE ps_endpoints ADD COLUMN outgoing_call_offer_pref pjsip_outgoing_call_offer_pref_values; + +ALTER TABLE ps_endpoints ADD COLUMN stir_shaken_profile VARCHAR(80); + +UPDATE alembic_version SET version_num='9f3692b1654b' WHERE alembic_version.version_num = '7197536bb68d'; + +-- Running upgrade 9f3692b1654b -> 539f68bede2c + +CREATE TYPE pjsip_100rel_values_v2 AS ENUM ('no', 'required', 'peer_supported', 'yes'); + +ALTER TABLE ps_endpoints ALTER COLUMN "100rel" TYPE pjsip_100rel_values_v2 USING "100rel"::text::pjsip_100rel_values_v2; + +DROP TYPE pjsip_100rel_values; + +UPDATE alembic_version SET version_num='539f68bede2c' WHERE alembic_version.version_num = '9f3692b1654b'; + +-- Running upgrade 539f68bede2c -> 417c0247fd7e + +CREATE TYPE security_negotiation_values AS ENUM ('no', 'mediasec'); + +ALTER TABLE ps_endpoints ADD COLUMN security_negotiation security_negotiation_values; + +ALTER TABLE ps_endpoints ADD COLUMN security_mechanisms VARCHAR(512); + +ALTER TABLE ps_registrations ADD COLUMN security_negotiation security_negotiation_values; + +ALTER TABLE ps_registrations ADD COLUMN security_mechanisms VARCHAR(512); + +UPDATE alembic_version SET version_num='417c0247fd7e' WHERE alembic_version.version_num = '539f68bede2c'; + +-- Running upgrade 417c0247fd7e -> ccf795ee535f + +ALTER TABLE ps_globals ADD COLUMN all_codecs_on_empty_reinvite ast_bool_values; + +UPDATE alembic_version SET version_num='ccf795ee535f' WHERE alembic_version.version_num = '417c0247fd7e'; + +-- Running upgrade ccf795ee535f -> 5a2247c957d2 + +ALTER TABLE ps_endpoints ADD COLUMN send_aoc ast_bool_values; + +UPDATE alembic_version SET version_num='5a2247c957d2' WHERE alembic_version.version_num = 'ccf795ee535f'; + +-- Running upgrade 5a2247c957d2 -> f261363a857f + +ALTER TABLE ps_endpoints ADD COLUMN overlap_context VARCHAR(80); + +UPDATE alembic_version SET version_num='f261363a857f' WHERE alembic_version.version_num = '5a2247c957d2'; + +-- Running upgrade f261363a857f -> 4042a0ff4d9f + +ALTER TABLE queue_members ADD COLUMN reason_paused VARCHAR(80); + +UPDATE alembic_version SET version_num='4042a0ff4d9f' WHERE alembic_version.version_num = 'f261363a857f'; + +-- Running upgrade 4042a0ff4d9f -> f5b0e7427449 + +ALTER TABLE musiconhold ADD COLUMN loop_last yesno_values; + +UPDATE alembic_version SET version_num='f5b0e7427449' WHERE alembic_version.version_num = '4042a0ff4d9f'; + +-- Running upgrade f5b0e7427449 -> dac2b4c328b8 + +ALTER TABLE ps_aors ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_aors ALTER COLUMN outbound_proxy TYPE VARCHAR(255); + +ALTER TABLE ps_auths ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_auths ALTER COLUMN realm TYPE VARCHAR(255); + +ALTER TABLE ps_contacts ALTER COLUMN outbound_proxy TYPE VARCHAR(255); + +ALTER TABLE ps_contacts ALTER COLUMN endpoint TYPE VARCHAR(255); + +ALTER TABLE ps_domain_aliases ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_domain_aliases ALTER COLUMN domain TYPE VARCHAR(255); + +ALTER TABLE ps_endpoint_id_ips ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_endpoint_id_ips ALTER COLUMN endpoint TYPE VARCHAR(255); + +ALTER TABLE ps_endpoints ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_endpoints ALTER COLUMN aors TYPE VARCHAR(2048); + +ALTER TABLE ps_endpoints ALTER COLUMN auth TYPE VARCHAR(255); + +ALTER TABLE ps_endpoints ALTER COLUMN outbound_auth TYPE VARCHAR(255); + +ALTER TABLE ps_endpoints ALTER COLUMN outbound_proxy TYPE VARCHAR(255); + +ALTER TABLE ps_inbound_publications ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_inbound_publications ALTER COLUMN endpoint TYPE VARCHAR(255); + +ALTER TABLE ps_outbound_publishes ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_outbound_publishes ALTER COLUMN outbound_auth TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN id TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN outbound_auth TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN outbound_proxy TYPE VARCHAR(255); + +ALTER TABLE ps_registrations ALTER COLUMN endpoint TYPE VARCHAR(255); + +UPDATE alembic_version SET version_num='dac2b4c328b8' WHERE alembic_version.version_num = 'f5b0e7427449'; + +-- Running upgrade dac2b4c328b8 -> 37a5332640e2 + +CREATE TYPE pjsip_transport_method_values_v2 AS ENUM ('default', 'unspecified', 'tlsv1', 'tlsv1_1', 'tlsv1_2', 'tlsv1_3', 'sslv2', 'sslv23', 'sslv3'); + +ALTER TABLE ps_transports ALTER COLUMN method TYPE pjsip_transport_method_values_v2 USING method::text::pjsip_transport_method_values_v2; + +DROP TYPE pjsip_transport_method_values; + +UPDATE alembic_version SET version_num='37a5332640e2' WHERE alembic_version.version_num = 'dac2b4c328b8'; + +-- Running upgrade 37a5332640e2 -> 24c12d8e9014 + +ALTER TABLE ps_registrations ADD COLUMN user_agent VARCHAR(255); + +UPDATE alembic_version SET version_num='24c12d8e9014' WHERE alembic_version.version_num = '37a5332640e2'; + +-- Running upgrade 24c12d8e9014 -> bd335bae5d33 + +CREATE TABLE stir_tn ( + id VARCHAR(80) NOT NULL, + private_key_file VARCHAR(1024), + public_cert_url VARCHAR(1024), + attest_level VARCHAR(1), + send_mky ast_bool_values, + PRIMARY KEY (id) +); + +UPDATE alembic_version SET version_num='bd335bae5d33' WHERE alembic_version.version_num = '24c12d8e9014'; + +-- Running upgrade bd335bae5d33 -> 74dc751dfe8e + +ALTER TABLE ps_aors ALTER COLUMN authenticate_qualify TYPE ast_bool_values USING "authenticate_qualify"::text::ast_bool_values; + +ALTER TABLE ps_aors ALTER COLUMN remove_existing TYPE ast_bool_values USING "remove_existing"::text::ast_bool_values; + +ALTER TABLE ps_aors ALTER COLUMN support_path TYPE ast_bool_values USING "support_path"::text::ast_bool_values; + +ALTER TABLE ps_asterisk_publications ALTER COLUMN device_state TYPE ast_bool_values USING "device_state"::text::ast_bool_values; + +ALTER TABLE ps_asterisk_publications ALTER COLUMN mailbox_state TYPE ast_bool_values USING "mailbox_state"::text::ast_bool_values; + +ALTER TABLE ps_contacts ALTER COLUMN authenticate_qualify TYPE ast_bool_values USING "authenticate_qualify"::text::ast_bool_values; + +ALTER TABLE ps_contacts ALTER COLUMN prune_on_boot TYPE ast_bool_values USING "prune_on_boot"::text::ast_bool_values; + +ALTER TABLE ps_endpoint_id_ips ALTER COLUMN srv_lookups TYPE ast_bool_values USING "srv_lookups"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN accept_multiple_sdp_answers TYPE ast_bool_values USING "accept_multiple_sdp_answers"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN aggregate_mwi TYPE ast_bool_values USING "aggregate_mwi"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN allow_overlap TYPE ast_bool_values USING "allow_overlap"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN allow_subscribe TYPE ast_bool_values USING "allow_subscribe"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN allow_transfer TYPE ast_bool_values USING "allow_transfer"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN asymmetric_rtp_codec TYPE ast_bool_values USING "asymmetric_rtp_codec"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN bind_rtp_to_media_address TYPE ast_bool_values USING "bind_rtp_to_media_address"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN bundle TYPE ast_bool_values USING "bundle"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN direct_media TYPE ast_bool_values USING "direct_media"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN disable_direct_media_on_nat TYPE ast_bool_values USING "disable_direct_media_on_nat"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN dtls_auto_generate_cert TYPE ast_bool_values USING "dtls_auto_generate_cert"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN fax_detect TYPE ast_bool_values USING "fax_detect"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN follow_early_media_fork TYPE ast_bool_values USING "follow_early_media_fork"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN force_avp TYPE ast_bool_values USING "force_avp"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN force_rport TYPE ast_bool_values USING "force_rport"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN g726_non_standard TYPE ast_bool_values USING "g726_non_standard"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN ice_support TYPE ast_bool_values USING "ice_support"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN inband_progress TYPE ast_bool_values USING "inband_progress"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN media_encryption_optimistic TYPE ast_bool_values USING "media_encryption_optimistic"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN media_use_received_transport TYPE ast_bool_values USING "media_use_received_transport"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN moh_passthrough TYPE ast_bool_values USING "moh_passthrough"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN notify_early_inuse_ringing TYPE ast_bool_values USING "notify_early_inuse_ringing"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN one_touch_recording TYPE ast_bool_values USING "one_touch_recording"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN preferred_codec_only TYPE ast_bool_values USING "preferred_codec_only"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN refer_blind_progress TYPE ast_bool_values USING "refer_blind_progress"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN rewrite_contact TYPE ast_bool_values USING "rewrite_contact"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN rpid_immediate TYPE ast_bool_values USING "rpid_immediate"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN rtcp_mux TYPE ast_bool_values USING "rtcp_mux"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN rtp_ipv6 TYPE ast_bool_values USING "rtp_ipv6"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN rtp_symmetric TYPE ast_bool_values USING "rtp_symmetric"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN send_diversion TYPE ast_bool_values USING "send_diversion"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN send_pai TYPE ast_bool_values USING "send_pai"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN send_rpid TYPE ast_bool_values USING "send_rpid"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN srtp_tag_32 TYPE ast_bool_values USING "srtp_tag_32"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN suppress_q850_reason_headers TYPE ast_bool_values USING "suppress_q850_reason_headers"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN t38_udptl TYPE ast_bool_values USING "t38_udptl"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN t38_udptl_ipv6 TYPE ast_bool_values USING "t38_udptl_ipv6"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN t38_udptl_nat TYPE ast_bool_values USING "t38_udptl_nat"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN trust_id_inbound TYPE ast_bool_values USING "trust_id_inbound"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN trust_id_outbound TYPE ast_bool_values USING "trust_id_outbound"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN use_avpf TYPE ast_bool_values USING "use_avpf"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN use_ptime TYPE ast_bool_values USING "use_ptime"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN user_eq_phone TYPE ast_bool_values USING "user_eq_phone"::text::ast_bool_values; + +ALTER TABLE ps_endpoints ALTER COLUMN webrtc TYPE ast_bool_values USING "webrtc"::text::ast_bool_values; + +ALTER TABLE ps_globals ALTER COLUMN disable_multi_domain TYPE ast_bool_values USING "disable_multi_domain"::text::ast_bool_values; + +ALTER TABLE ps_globals ALTER COLUMN ignore_uri_user_options TYPE ast_bool_values USING "ignore_uri_user_options"::text::ast_bool_values; + +ALTER TABLE ps_globals ALTER COLUMN mwi_disable_initial_unsolicited TYPE ast_bool_values USING "mwi_disable_initial_unsolicited"::text::ast_bool_values; + +ALTER TABLE ps_outbound_publishes ALTER COLUMN multi_user TYPE ast_bool_values USING "multi_user"::text::ast_bool_values; + +ALTER TABLE ps_registrations ALTER COLUMN auth_rejection_permanent TYPE ast_bool_values USING "auth_rejection_permanent"::text::ast_bool_values; + +ALTER TABLE ps_registrations ALTER COLUMN line TYPE ast_bool_values USING "line"::text::ast_bool_values; + +ALTER TABLE ps_registrations ALTER COLUMN support_path TYPE ast_bool_values USING "support_path"::text::ast_bool_values; + +ALTER TABLE ps_resource_list ALTER COLUMN full_state TYPE ast_bool_values USING "full_state"::text::ast_bool_values; + +ALTER TABLE ps_subscription_persistence ALTER COLUMN prune_on_boot TYPE ast_bool_values USING "prune_on_boot"::text::ast_bool_values; + +ALTER TABLE ps_systems ALTER COLUMN accept_multiple_sdp_answers TYPE ast_bool_values USING "accept_multiple_sdp_answers"::text::ast_bool_values; + +ALTER TABLE ps_systems ALTER COLUMN compact_headers TYPE ast_bool_values USING "compact_headers"::text::ast_bool_values; + +ALTER TABLE ps_systems ALTER COLUMN disable_tcp_switch TYPE ast_bool_values USING "disable_tcp_switch"::text::ast_bool_values; + +ALTER TABLE ps_systems ALTER COLUMN follow_early_media_fork TYPE ast_bool_values USING "follow_early_media_fork"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN allow_reload TYPE ast_bool_values USING "allow_reload"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN allow_wildcard_certs TYPE ast_bool_values USING "allow_wildcard_certs"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN require_client_cert TYPE ast_bool_values USING "require_client_cert"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN symmetric_transport TYPE ast_bool_values USING "symmetric_transport"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN verify_client TYPE ast_bool_values USING "verify_client"::text::ast_bool_values; + +ALTER TABLE ps_transports ALTER COLUMN verify_server TYPE ast_bool_values USING "verify_server"::text::ast_bool_values; + +UPDATE alembic_version SET version_num='74dc751dfe8e' WHERE alembic_version.version_num = 'bd335bae5d33'; + +-- Running upgrade 74dc751dfe8e -> 8fce8496f03e + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_enable BOOLEAN; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_idle_time INTEGER; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_interval_time INTEGER; + +ALTER TABLE ps_transports ADD COLUMN tcp_keepalive_probe_count INTEGER; + +UPDATE alembic_version SET version_num='8fce8496f03e' WHERE alembic_version.version_num = '74dc751dfe8e'; + +-- Running upgrade 8fce8496f03e -> cf150a175fd3 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN match_request_uri VARCHAR(255); + +UPDATE alembic_version SET version_num='cf150a175fd3' WHERE alembic_version.version_num = '8fce8496f03e'; + +-- Running upgrade cf150a175fd3 -> d5122576cca8 + +ALTER TABLE ps_endpoint_id_ips ADD COLUMN transport VARCHAR(128); + +UPDATE alembic_version SET version_num='d5122576cca8' WHERE alembic_version.version_num = 'cf150a175fd3'; + +-- Running upgrade d5122576cca8 -> 6c475a93f48a + +ALTER TABLE ps_aors ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_auths ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_domain_aliases ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_endpoint_id_ips ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_endpoints ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_inbound_publications ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_outbound_publishes ALTER COLUMN id SET NOT NULL; + +ALTER TABLE ps_registrations ALTER COLUMN id SET NOT NULL; + +UPDATE alembic_version SET version_num='6c475a93f48a' WHERE alembic_version.version_num = 'd5122576cca8'; + +-- Running upgrade 6c475a93f48a -> bd9c5159c7ea + +ALTER TABLE ps_endpoint_id_ips DROP COLUMN transport; + +UPDATE alembic_version SET version_num='bd9c5159c7ea' WHERE alembic_version.version_num = '6c475a93f48a'; + +-- Running upgrade bd9c5159c7ea -> 2b7c507d7d12 + +ALTER TABLE queues ADD COLUMN log_restricted_caller_id ast_bool_values; + +UPDATE alembic_version SET version_num='2b7c507d7d12' WHERE alembic_version.version_num = 'bd9c5159c7ea'; + +-- Running upgrade 2b7c507d7d12 -> 655054a68ad5 + +ALTER TABLE ps_endpoints ADD COLUMN tenantid VARCHAR(80); + +UPDATE alembic_version SET version_num='655054a68ad5' WHERE alembic_version.version_num = '2b7c507d7d12'; + +-- Running upgrade 655054a68ad5 -> 801b9fced8b7 + +ALTER TABLE ps_subscription_persistence ADD COLUMN generator_data TEXT; + +UPDATE alembic_version SET version_num='801b9fced8b7' WHERE alembic_version.version_num = '655054a68ad5'; + +-- Running upgrade 801b9fced8b7 -> 4f91fc18c979 + +ALTER TABLE ps_endpoints ADD COLUMN suppress_moh_on_sendonly ast_bool_values; + +UPDATE alembic_version SET version_num='4f91fc18c979' WHERE alembic_version.version_num = '801b9fced8b7'; + +-- Running upgrade 4f91fc18c979 -> 44bd6dd914fa + +ALTER TABLE ps_aors ADD COLUMN qualify_2xx_only ast_bool_values; + +ALTER TABLE ps_contacts ADD COLUMN qualify_2xx_only ast_bool_values; + +UPDATE alembic_version SET version_num='44bd6dd914fa' WHERE alembic_version.version_num = '4f91fc18c979'; + +-- Running upgrade 44bd6dd914fa -> abdc9ede147d + +ALTER TABLE ps_auths ADD COLUMN password_digest VARCHAR(1024); + +ALTER TABLE ps_auths ADD COLUMN supported_algorithms_uas VARCHAR(1024); + +ALTER TABLE ps_auths ADD COLUMN supported_algorithms_uac VARCHAR(1024); + +ALTER TABLE ps_globals ADD COLUMN default_auth_algorithms_uas VARCHAR(1024); + +ALTER TABLE ps_globals ADD COLUMN default_auth_algorithms_uac VARCHAR(1024); + +UPDATE alembic_version SET version_num='abdc9ede147d' WHERE alembic_version.version_num = '44bd6dd914fa'; + +COMMIT; + diff --git a/contrib/realtime/postgresql/postgresql_queue_log.sql b/contrib/realtime/postgresql/postgresql_queue_log.sql new file mode 100644 index 0000000000..924f8406fe --- /dev/null +++ b/contrib/realtime/postgresql/postgresql_queue_log.sql @@ -0,0 +1,29 @@ +BEGIN; + +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> 4105ee839f58 + +CREATE TABLE queue_log ( + id BIGSERIAL NOT NULL, + time TIMESTAMP WITHOUT TIME ZONE, + callid VARCHAR(80), + queuename VARCHAR(256), + agent VARCHAR(80), + event VARCHAR(32), + data1 VARCHAR(100), + data2 VARCHAR(100), + data3 VARCHAR(100), + data4 VARCHAR(100), + data5 VARCHAR(100), + PRIMARY KEY (id), + UNIQUE (id) +); + +INSERT INTO alembic_version (version_num) VALUES ('4105ee839f58') RETURNING alembic_version.version_num; + +COMMIT; + diff --git a/contrib/realtime/postgresql/postgresql_voicemail.sql b/contrib/realtime/postgresql/postgresql_voicemail.sql new file mode 100644 index 0000000000..67d0287c6d --- /dev/null +++ b/contrib/realtime/postgresql/postgresql_voicemail.sql @@ -0,0 +1,51 @@ +BEGIN; + +CREATE TABLE alembic_version ( + version_num VARCHAR(32) NOT NULL, + CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) +); + +-- Running upgrade -> a2e9769475e + +CREATE TABLE voicemail_messages ( + dir VARCHAR(255) NOT NULL, + msgnum INTEGER NOT NULL, + context VARCHAR(80), + macrocontext VARCHAR(80), + callerid VARCHAR(80), + origtime INTEGER, + duration INTEGER, + recording BYTEA, + flag VARCHAR(30), + category VARCHAR(30), + mailboxuser VARCHAR(30), + mailboxcontext VARCHAR(30), + msg_id VARCHAR(40) +); + +ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum); + +CREATE INDEX voicemail_messages_dir ON voicemail_messages (dir); + +INSERT INTO alembic_version (version_num) VALUES ('a2e9769475e') RETURNING alembic_version.version_num; + +-- Running upgrade a2e9769475e -> 39428242f7f5 + +ALTER TABLE voicemail_messages ALTER COLUMN recording TYPE BYTEA; + +UPDATE alembic_version SET version_num='39428242f7f5' WHERE alembic_version.version_num = 'a2e9769475e'; + +-- Running upgrade 39428242f7f5 -> 1c55c341360f + +ALTER TABLE voicemail_messages DROP COLUMN macrocontext; + +UPDATE alembic_version SET version_num='1c55c341360f' WHERE alembic_version.version_num = '39428242f7f5'; + +-- Running upgrade 1c55c341360f -> 64fae6bbe7fb + +DROP INDEX voicemail_messages_dir; + +UPDATE alembic_version SET version_num='64fae6bbe7fb' WHERE alembic_version.version_num = '1c55c341360f'; + +COMMIT; +