--- /dev/null
+21.0.0-rc1
--- /dev/null
+ChangeLogs/ChangeLog-21.0.0-rc1.md
\ No newline at end of file
--- /dev/null
+
+Change Log for Release asterisk-21.0.0-rc1
+========================================
+
+Links:
+----------------------------------------
+
+ - [Full ChangeLog](https://downloads.asterisk.org/pub/telephony/asterisk/releases/ChangeLog-21.0.0-rc1.md)
+ - [GitHub Diff](https://github.com/asterisk/asterisk/compare/21.0.0-pre1...21.0.0-rc1)
+ - [Tarball](https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-21.0.0-rc1.tar.gz)
+ - [Downloads](https://downloads.asterisk.org/pub/telephony/asterisk)
+
+Summary:
+----------------------------------------
+
+- Update master branch for Asterisk 21
+- translate.c: Prefer better codecs upon translate ties.
+- chan_skinny: Remove deprecated module.
+- app_osplookup: Remove deprecated module.
+- chan_mgcp: Remove deprecated module.
+- chan_alsa: Remove deprecated module.
+- pbx_builtins: Remove deprecated and defunct functionality.
+- chan_sip: Remove deprecated module.
+- app_cdr: Remove deprecated application and option.
+- app_macro: Remove deprecated module.
+- res_monitor: Remove deprecated module.
+- http.c: Minor simplification to HTTP status output.
+- app_osplookup: Remove obsolete sample config.
+- say.c: Fix French time playback. (#42)
+- core: Cleanup gerrit and JIRA references. (#58)
+- utils.h: Deprecate `ast_gethostbyname()`. (#79)
+- res_pjsip_pubsub: Add new pubsub module capabilities. (#82)
+- app_sla: Migrate SLA applications out of app_meetme.
+- Update config.yml
+- rest-api: Ran make ari stubs to fix resource_endpoints inconsistency
+- .github: Update AsteriskReleaser for security releases
+- users.conf: Deprecate users.conf configuration.
+- Update version for Asterisk 21
+- Remove unneeded CHANGES and UPGRADE files
+- ari-stubs: Fix more local anchor references
+- ari-stubs: Fix more local anchor references
+- ari-stubs: Fix broken documentation anchors
+- res_pjsip_session: Send Session Interval too small response
+- .github: Update workflow-application-token-action to v2
+- app_dial: Fix infinite loop when sending digits.
+- app_voicemail: Fix for loop declarations
+- alembic: Fix quoting of the 100rel column
+- pbx.c: Fix gcc 12 compiler warning.
+- app_audiosocket: Fixed timeout with -1 to avoid busy loop.
+- download_externals: Fix a few version related issues
+- main/refer.c: Fix double free in refer_data_destructor + potential leak
+- sig_analog: Add Called Subscriber Held capability.
+- Revert "app_stack: Print proper exit location for PBXless channels."
+- install_prereq: Fix dependency install on aarch64.
+- res_pjsip.c: Set contact_user on incoming call local Contact header
+- extconfig: Allow explicit DB result set ordering to be disabled.
+- rest-api: Run make ari-stubs
+- res_pjsip_header_funcs: Make prefix argument optional.
+- pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
+- manager: Tolerate stasis messages with no channel snapshot.
+- Remove unneeded CHANGES and UPGRADE files
+
+User Notes:
+----------------------------------------
+
+- ### sig_analog: Add Called Subscriber Held capability.
+ Called Subscriber Held is now supported for analog
+ FXS channels, using the calledsubscriberheld option. This allows
+ a station user to go on hook when receiving an incoming call
+ and resume from another phone on the same line by going on hook,
+ without disconnecting the call.
+
+- ### res_pjsip_header_funcs: Make prefix argument optional.
+ The prefix argument to PJSIP_HEADERS is now
+ optional. If not specified, all header names will be
+ returned.
+
+- ### http.c: Minor simplification to HTTP status output.
+ For bound addresses, the HTTP status page now combines the bound
+ address and bound port in a single line. Additionally, the SSL bind
+ address has been renamed to TLS.
+
+
+Upgrade Notes:
+----------------------------------------
+
+- ### utils.h: Deprecate `ast_gethostbyname()`. (#79)
+ ast_gethostbyname() has been deprecated and will be removed\r
+ in Asterisk 23. New code should use `ast_sockaddr_resolve()` and\r
+ `ast_sockaddr_resolve_first_af()`.
+
+- ### app_sla: Migrate SLA applications out of app_meetme.
+ The SLAStation and SLATrunk applications have been moved
+ from app_meetme to app_sla. If you are using these applications and have
+ autoload=no, you will need to explicitly load this module in modules.conf.
+
+- ### users.conf: Deprecate users.conf configuration.
+ The users.conf config is now deprecated
+ and will be removed in a future version of Asterisk.
+
+- ### app_osplookup: Remove deprecated module.
+ This module was deprecated in Asterisk 19
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+
+- ### res_monitor: Remove deprecated module.
+ This module was deprecated in Asterisk 16
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+ This also removes the 'w' and 'W' options
+ for app_queue.
+ MixMonitor should be default and only option
+ for all settings that previously used either
+ Monitor or MixMonitor.
+
+- ### chan_sip: Remove deprecated module.
+ This module was deprecated in Asterisk 17
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+
+- ### chan_alsa: Remove deprecated module.
+ This module was deprecated in Asterisk 19
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+
+- ### chan_mgcp: Remove deprecated module.
+ This module was deprecated in Asterisk 19
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+
+- ### chan_skinny: Remove deprecated module.
+ This module was deprecated in Asterisk 19
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+
+- ### app_macro: Remove deprecated module.
+ This module was deprecated in Asterisk 16
+ and is now being removed in accordance with
+ the Asterisk Module Deprecation policy.
+ For most modules that interacted with app_macro,
+ this change is limited to no longer looking for
+ the current context from the macrocontext when set.
+ The following modules have additional impacts:
+ app_dial - no longer supports M^ connected/redirecting macro
+ app_minivm - samples written using macro will no longer work.
+ The sample needs to be re-written
+ app_queue - can no longer call a macro on the called party's
+ channel. Use gosub which is currently supported
+ ccss - no callback macro, gosub only
+ app_voicemail - no macro support
+ channel - remove macrocontext and priority, no connected
+ line or redirection macro options
+ options - stdexten is deprecated to gosub as the default
+ and only options
+ pbx - removed macrolock
+ pbx_dundi - no longer look for macro
+ snmp - removed macro context, exten, and priority
+
+- ### pbx_builtins: Remove deprecated and defunct functionality.
+ The previously deprecated ImportVar and SetAMAFlags
+ applications have now been removed.
+
+- ### translate.c: Prefer better codecs upon translate ties.
+ When setting up translation between two codecs the quality was not taken into account,
+ resulting in suboptimal translation. The quality is now taken into account,
+ which can reduce the number of translation steps required, and improve the resulting quality.
+
+- ### app_cdr: Remove deprecated application and option.
+ The previously deprecated NoCDR application has been removed.
+ Additionally, the previously deprecated 'e' option to the ResetCDR
+ application has been removed.
+
+
+Closed Issues:
+----------------------------------------
+
+ - #37: [Bug]: contrib/scripts/install_prereq tries to install armhf packages on aarch64 Debian platforms
+ - #39: [Bug]: Remove .gitreview from repository.
+ - #41: [Bug]: say.c Time announcement does not say o'clock for the French language
+ - #50: [improvement]: app_sla: Migrate SLA applications from app_meetme
+ - #78: [improvement]: Deprecate ast_gethostbyname()
+ - #81: [improvement]: Enhance and add additional PJSIP pubsub callbacks
+ - #179: [bug]: Queue strategy “Linear” with Asterisk 20 on Realtime
+ - #183: [deprecation]: Deprecate users.conf
+ - #226: [improvement]: Apply contact_user to incoming calls
+ - #230: [bug]: PJSIP_RESPONSE_HEADERS function documentation is misleading
+ - #240: [new-feature]: sig_analog: Add Called Subscriber Held capability
+ - #253: app_gosub patch appear to have broken predial handlers that utilize macros that call gosubs
+ - #255: [bug]: pjsip_endpt_register_module: Assertion "Too many modules registered"
+ - #263: [bug]: download_externals doesn't always handle versions correctly
+ - #267: [bug]: ari: refer with display_name key in request body leads to crash
+ - #274: [bug]: Syntax Error in SQL Code
+ - #275: [bug]:Asterisk make now requires ASTCFLAGS='-std=gnu99 -Wdeclaration-after-statement'
+ - #277: [bug]: pbx.c: Compiler error with gcc 12.2
+ - #281: [bug]: app_dial: Infinite loop if called channel hangs up while receiving digits
+
+Commits By Author:
+----------------------------------------
+
+- ### Bastian Triller (1):
+ - res_pjsip_session: Send Session Interval too small response
+
+- ### George Joseph (9):
+ - Remove unneeded CHANGES and UPGRADE files
+ - pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
+ - rest-api: Run make ari-stubs
+ - download_externals: Fix a few version related issues
+ - alembic: Fix quoting of the 100rel column
+ - .github: Update workflow-application-token-action to v2
+ - ari-stubs: Fix broken documentation anchors
+ - ari-stubs: Fix more local anchor references
+ - ari-stubs: Fix more local anchor references
+
+- ### Jason D. McCormick (1):
+ - install_prereq: Fix dependency install on aarch64.
+
+- ### Joshua C. Colp (1):
+ - manager: Tolerate stasis messages with no channel snapshot.
+
+- ### Matthew Fredrickson (1):
+ - Revert "app_stack: Print proper exit location for PBXless channels."
+
+- ### Maximilian Fridrich (1):
+ - main/refer.c: Fix double free in refer_data_destructor + potential leak
+
+- ### Mike Bradeen (1):
+ - app_voicemail: Fix for loop declarations
+
+- ### MikeNaso (1):
+ - res_pjsip.c: Set contact_user on incoming call local Contact header
+
+- ### Naveen Albert (4):
+ - res_pjsip_header_funcs: Make prefix argument optional.
+ - sig_analog: Add Called Subscriber Held capability.
+ - pbx.c: Fix gcc 12 compiler warning.
+ - app_dial: Fix infinite loop when sending digits.
+
+- ### Sean Bright (1):
+ - extconfig: Allow explicit DB result set ordering to be disabled.
+
+- ### zhengsh (1):
+ - app_audiosocket: Fixed timeout with -1 to avoid busy loop.
+
+
+Detail:
+----------------------------------------
+
+- ### Update master branch for Asterisk 21
+ Author: George Joseph
+ Date: 2022-07-20
+
+
+- ### translate.c: Prefer better codecs upon translate ties.
+ Author: Naveen Albert
+ Date: 2021-05-27
+
+ If multiple codecs are available for the same
+ resource and the translation costs between
+ multiple codecs are the same, ties are
+ currently broken arbitrarily, which means a
+ lower quality codec would be used. This forces
+ Asterisk to explicitly use the higher quality
+ codec, ceteris paribus.
+
+ ASTERISK-29455
+
+
+- ### chan_skinny: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-16
+
+ ASTERISK-30300
+
+
+- ### app_osplookup: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-18
+
+ ASTERISK-30302
+
+
+- ### chan_mgcp: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-15
+
+ Also removes res_pktcops to avoid merge conflicts
+ with ASTERISK~30301.
+
+ ASTERISK-30299
+
+
+- ### chan_alsa: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-14
+
+ ASTERISK-30298
+
+
+- ### pbx_builtins: Remove deprecated and defunct functionality.
+ Author: Naveen Albert
+ Date: 2022-11-29
+
+ This removes the ImportVar and SetAMAFlags applications
+ which have been deprecated since Asterisk 12, but were
+ never removed previously.
+
+ Additionally, it removes remnants of defunct options
+ that themselves were removed years ago.
+
+ ASTERISK-30335 #close
+
+
+- ### chan_sip: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-28
+
+ ASTERISK-30297
+
+
+- ### app_cdr: Remove deprecated application and option.
+ Author: Naveen Albert
+ Date: 2022-12-22
+
+ This removes the deprecated NoCDR application, which
+ was deprecated in Asterisk 12, having long been fully
+ superseded by the CDR_PROP function.
+
+ The deprecated e option to ResetCDR is also removed
+ for the same reason.
+
+ ASTERISK-30371 #close
+
+
+- ### app_macro: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-12-12
+
+ For most modules that interacted with app_macro, this change is limited
+ to no longer looking for the current context from the macrocontext when
+ set. Additionally, the following modules are impacted:
+
+ app_dial - no longer supports M^ connected/redirecting macro
+ app_minivm - samples written using macro will no longer work.
+ The sample needs a re-write
+
+ app_queue - can no longer a macro on the called party's channel.
+ Use gosub which is currently supported
+
+ ccss - no callback macro, gosub only
+
+ app_voicemail - no macro support
+
+ channel - remove macrocontext and priority, no connected line or
+ redirection macro options
+ options - stdexten is deprecated to gosub as the default and only
+ pbx - removed macrolock
+ pbx_dundi - no longer look for macro
+
+ snmp - removed macro context, exten, and priority
+
+ ASTERISK-30304
+
+
+- ### res_monitor: Remove deprecated module.
+ Author: Mike Bradeen
+ Date: 2022-11-18
+
+ ASTERISK-30303
+
+
+- ### http.c: Minor simplification to HTTP status output.
+ Author: Boris P. Korzun
+ Date: 2023-01-05
+
+ Change the HTTP status page (located at /httpstatus by default) by:
+
+ * Combining the address and port into a single line.
+ * Changing "SSL" to "TLS"
+
+ ASTERISK-30433 #close
+
+
+- ### app_osplookup: Remove obsolete sample config.
+ Author: Naveen Albert
+ Date: 2023-02-24
+
+ ASTERISK_30302 previously removed app_osplookup,
+ but its sample config was not removed.
+ This removes it since nothing else uses it.
+
+ ASTERISK-30438 #close
+
+
+- ### say.c: Fix French time playback. (#42)
+ Author: InterLinked1
+ Date: 2023-05-02
+
+ ast_waitstream was not called after ast_streamfile,\r
+ resulting in "o'clock" being skipped in French.\r
+ \r
+ Additionally, the minute announcements should be\r
+ feminine.\r
+ \r
+ Reported-by: Danny Lloyd\r
+ \r
+ Resolves: #41\r
+ ASTERISK-30488
+- ### core: Cleanup gerrit and JIRA references. (#58)
+ Author: Sean Bright
+ Date: 2023-05-03
+
+ * Remove .gitreview and switch to pulling the main asterisk branch\r
+ version from configure.ac instead.\r
+ \r
+ * Replace references to JIRA with GitHub.\r
+ \r
+ * Other minor cleanup found along the way.\r
+ \r
+ Resolves: #39
+- ### utils.h: Deprecate `ast_gethostbyname()`. (#79)
+ Author: Sean Bright
+ Date: 2023-05-11
+
+ Deprecate `ast_gethostbyname()` in favor of `ast_sockaddr_resolve()` and\r
+ `ast_sockaddr_resolve_first_af()`. `ast_gethostbyname()` has not been\r
+ used by any in-tree code since 2021.\r
+ \r
+ This function will be removed entirely in Asterisk 23.\r
+ \r
+ Resolves: #78\r
+ \r
+ UpgradeNote: ast_gethostbyname() has been deprecated and will be removed\r
+ in Asterisk 23. New code should use `ast_sockaddr_resolve()` and\r
+ `ast_sockaddr_resolve_first_af()`.
+- ### res_pjsip_pubsub: Add new pubsub module capabilities. (#82)
+ Author: InterLinked1
+ Date: 2023-05-18
+
+ The existing res_pjsip_pubsub APIs are somewhat limited in\r
+ what they can do. This adds a few API extensions that make\r
+ it possible for PJSIP pubsub modules to implement richer\r
+ features than is currently possible.\r
+ \r
+ * Allow pubsub modules to get a handle to pjsip_rx_data on subscription\r
+ * Allow pubsub modules to run a callback when a subscription is renewed\r
+ * Allow pubsub modules to run a callback for outgoing NOTIFYs, with\r
+ a handle to the tdata, so that modules can append their own headers\r
+ to the NOTIFYs\r
+ \r
+ This change does not add any features directly, but makes possible\r
+ several new features that will be added in future changes.\r
+ \r
+ Resolves: #81\r
+ ASTERISK-30485 #close\r
+ \r
+ Master-Only: True
+- ### app_sla: Migrate SLA applications out of app_meetme.
+ Author: Naveen Albert
+ Date: 2023-05-02
+
+ This removes the dependency of the SLAStation and SLATrunk
+ applications on app_meetme, in anticipation of the imminent
+ removal of the deprecated app_meetme module.
+
+ The user interface for the SLA applications is exactly the
+ same, and in theory, users should not notice a difference.
+ However, the SLA applications now use ConfBridge under the
+ hood, rather than MeetMe, and they are now contained within
+ their own module.
+
+ Resolves: #50
+ ASTERISK-30309
+
+ UpgradeNote: The SLAStation and SLATrunk applications have been moved
+ from app_meetme to app_sla. If you are using these applications and have
+ autoload=no, you will need to explicitly load this module in modules.conf.
+
+- ### Update config.yml
+ Author: Joshua C. Colp
+ Date: 2023-06-15
+
+
+- ### rest-api: Ran make ari stubs to fix resource_endpoints inconsistency
+ Author: George Joseph
+ Date: 2023-06-27
+
+
+- ### .github: Update AsteriskReleaser for security releases
+ Author: George Joseph
+ Date: 2023-07-07
+
+
+- ### users.conf: Deprecate users.conf configuration.
+ Author: Naveen Albert
+ Date: 2023-06-30
+
+ This deprecates the users.conf config file, which
+ is no longer as widely supported but still integrated
+ with a number of different modules.
+
+ Because there is no real mechanism for marking a
+ configuration file as "deprecated", and users.conf
+ is not just used in a single place, this now emits
+ a warning to the user when the PBX loads to notify
+ about the deprecation.
+
+ This configuration mechanism has been widely criticized
+ and discouraged since its inception, and is no longer
+ relevant to the configuration that most users are doing
+ today. Removing it will allow for some simplification
+ and cleanup in the codebase.
+
+ Resolves: #183
+
+ UpgradeNote: The users.conf config is now deprecated
+ and will be removed in a future version of Asterisk.
+
+- ### Update version for Asterisk 21
+ Author: George Joseph
+ Date: 2023-08-09
+
+
+- ### Remove unneeded CHANGES and UPGRADE files
+ Author: George Joseph
+ Date: 2023-08-09
+
+
+- ### ari-stubs: Fix more local anchor references
+ Author: George Joseph
+ Date: 2023-09-05
+
+ Also allow CreateDocs job to be run manually with default branches.
+
+
+- ### ari-stubs: Fix more local anchor references
+ Author: George Joseph
+ Date: 2023-09-05
+
+ Also allow CreateDocs job to be run manually with default branches.
+
+
+- ### ari-stubs: Fix broken documentation anchors
+ Author: George Joseph
+ Date: 2023-09-05
+
+ All of the links that reference page anchors with capital letters in
+ the ids (#Something) have been changed to lower case to match the
+ anchors that are generated by mkdocs.
+
+
+- ### res_pjsip_session: Send Session Interval too small response
+ Author: Bastian Triller
+ Date: 2023-08-28
+
+ Handle session interval lower than endpoint's configured minimum timer
+ when sending first answer. Timer setting is checked during this step and
+ needs to handled appropriately.
+ Before this change, no response was sent at all. After this change a
+ response with 422 Session Interval too small is sent to UAC.
+
+
+- ### .github: Update workflow-application-token-action to v2
+ Author: George Joseph
+ Date: 2023-08-31
+
+
+- ### app_dial: Fix infinite loop when sending digits.
+ Author: Naveen Albert
+ Date: 2023-08-28
+
+ If the called party hangs up while digits are being
+ sent, -1 is returned to indicate so, but app_dial
+ was not checking the return value, resulting in
+ the hangup being lost and looping forever until
+ the caller manually hangs up the channel. We now
+ abort if digit sending fails.
+
+ ASTERISK-29428 #close
+
+ Resolves: #281
+
+- ### app_voicemail: Fix for loop declarations
+ Author: Mike Bradeen
+ Date: 2023-08-29
+
+ Resolve for loop initial declarations added in cli changes.
+
+ Resolves: #275
+
+- ### alembic: Fix quoting of the 100rel column
+ Author: George Joseph
+ Date: 2023-08-28
+
+ Add quoting around the ps_endpoints 100rel column in the ALTER
+ statements. Although alembic doesn't complain when generating
+ sql statements, postgresql does (rightly so).
+
+ Resolves: #274
+
+- ### pbx.c: Fix gcc 12 compiler warning.
+ Author: Naveen Albert
+ Date: 2023-08-27
+
+ Resolves: #277
+
+- ### app_audiosocket: Fixed timeout with -1 to avoid busy loop.
+ Author: zhengsh
+ Date: 2023-08-24
+
+ Resolves: asterisk#234
+
+- ### download_externals: Fix a few version related issues
+ Author: George Joseph
+ Date: 2023-08-18
+
+ * Fixed issue with the script not parsing the new tag format for
+ certified releases. The format changed from certified/18.9-cert5
+ to certified-18.9-cert5.
+
+ * Fixed issue where the asterisk version wasn't being considered
+ when looking for cached versions.
+
+ Resolves: #263
+
+- ### main/refer.c: Fix double free in refer_data_destructor + potential leak
+ Author: Maximilian Fridrich
+ Date: 2023-08-21
+
+ Resolves: #267
+
+- ### sig_analog: Add Called Subscriber Held capability.
+ Author: Naveen Albert
+ Date: 2023-08-09
+
+ This adds support for Called Subscriber Held for FXS
+ lines, which allows users to go on hook when receiving
+ a call and resume the call later from another phone on
+ the same line, without disconnecting the call. This is
+ a convenience mechanism that most real PSTN telephone
+ switches support.
+
+ ASTERISK-30372 #close
+
+ Resolves: #240
+
+ UserNote: Called Subscriber Held is now supported for analog
+ FXS channels, using the calledsubscriberheld option. This allows
+ a station user to go on hook when receiving an incoming call
+ and resume from another phone on the same line by going on hook,
+ without disconnecting the call.
+
+
+- ### Revert "app_stack: Print proper exit location for PBXless channels."
+ Author: Matthew Fredrickson
+ Date: 2023-08-10
+
+ This reverts commit 617dad4cba1513dddce87b8e95a61415fb587cf1.
+
+ apps/app_stack.c: Revert buggy gosub patch
+
+ This seems to break the case when a predial macro calls a gosub.
+ When the gosub calls return, the Return function outputs:
+
+ app_stack.c:423 return_exec: Return without Gosub: stack is empty
+
+ This returns -1 to the calling macro, which returns to app_dial
+ and causes the call to hangup instead of proceeding with the macro
+ that invoked the gosub.
+
+ Resolves: #253
+
+- ### install_prereq: Fix dependency install on aarch64.
+ Author: Jason D. McCormick
+ Date: 2023-04-28
+
+ Fixes dependency solutions in install_prereq for Debian aarch64
+ platforms. install_prereq was attempting to forcibly install 32-bit
+ armhf packages due to the aptitude search for dependencies.
+
+ Resolves: #37
+
+- ### res_pjsip.c: Set contact_user on incoming call local Contact header
+ Author: MikeNaso
+ Date: 2023-08-08
+
+ If the contact_user is configured on the endpoint it will now be set on the local Contact header URI for incoming calls. The contact_user has already been set on the local Contact header URI for outgoing calls.
+
+ Resolves: #226
+
+- ### extconfig: Allow explicit DB result set ordering to be disabled.
+ Author: Sean Bright
+ Date: 2023-07-12
+
+ Added a new boolean configuration flag -
+ `order_multi_row_results_by_initial_column` - to both res_pgsql.conf
+ and res_config_odbc.conf that allows the administrator to disable the
+ explicit `ORDER BY` that was previously being added to all generated
+ SQL statements that returned multiple rows.
+
+ Fixes: #179
+
+- ### rest-api: Run make ari-stubs
+ Author: George Joseph
+ Date: 2023-08-09
+
+ An earlier cherry-pick that involved rest-api somehow didn't include
+ a comment change in res/ari/resource_endpoints.h. This commit
+ corrects that. No changes other than the comment.
+
+
+- ### res_pjsip_header_funcs: Make prefix argument optional.
+ Author: Naveen Albert
+ Date: 2023-08-09
+
+ The documentation for PJSIP_HEADERS claims that
+ prefix is optional, but in the code it is actually not.
+ However, there is no inherent reason for this, as users
+ may want to retrieve all header names, not just those
+ beginning with a certain prefix.
+
+ This makes the prefix optional for this function,
+ simply fetching all header names if not specified.
+ As a result, the documentation is now correct.
+
+ Resolves: #230
+
+ UserNote: The prefix argument to PJSIP_HEADERS is now
+ optional. If not specified, all header names will be
+ returned.
+
+
+- ### pjproject_bundled: Increase PJSIP_MAX_MODULE to 38
+ Author: George Joseph
+ Date: 2023-08-11
+
+ The default is 32 with 8 being used by pjproject itself. Recent
+ commits have put us over the limit resulting in assertions in
+ pjproject. Since this value is used in invites, dialogs,
+ transports and subscriptions as well as the global pjproject
+ endpoint, we don't want to increase it too much.
+
+ Resolves: #255
+
+- ### manager: Tolerate stasis messages with no channel snapshot.
+ Author: Joshua C. Colp
+ Date: 2023-08-09
+
+ In some cases I have yet to determine some stasis messages may
+ be created without a channel snapshot. This change adds some
+ tolerance to this scenario, preventing a crash from occurring.
+
+
+- ### Remove unneeded CHANGES and UPGRADE files
+ Author: George Joseph
+ Date: 2023-08-09
+
+
+===== WARNING, THIS FILE IS OBSOLETE AND WILL BE REMOVED IN A FUTURE VERSION =====
+See 'Upgrade Notes' in the CHANGES file
+
===========================================================
===
=== THIS FILE IS AUTOMATICALLY GENERATED DURING THE RELEASE
--- /dev/null
+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';
+
--- /dev/null
+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';
+
--- /dev/null
+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');
+
+COMMIT;
+
--- /dev/null
+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';
+
--- /dev/null
+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');
+
+-- 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;
+
--- /dev/null
+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');
+
+-- 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';
+
+COMMIT;
+
--- /dev/null
+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');
+
+COMMIT;
+
--- /dev/null
+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');
+
+-- 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';
+
+COMMIT;
+