res_musiconhold: Add option to loop last file.

Adds the loop_last option to res_musiconhold,
which allows the last audio file in the directory
to be looped perpetually once reached, rather than
circling back to the beginning again.

Resolves: #122
ASTERISK-30462

UserNote: The loop_last option in musiconhold.conf now
allows the last file in the directory to be looped once reached.
This commit is contained in:
Naveen Albert
2023-05-25 23:58:41 +00:00
parent 86a11d5b19
commit edf488c76e
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
"""Add loop_last to res_musiconhold
Revision ID: f5b0e7427449
Revises: f261363a857f
Create Date: 2023-03-13 23:59:00.835055
"""
# revision identifiers, used by Alembic.
revision = 'f5b0e7427449'
down_revision = 'f261363a857f'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import ENUM
YESNO_NAME = 'yesno_values'
YESNO_VALUES = ['yes', 'no']
def upgrade():
yesno_values = ENUM(*YESNO_VALUES, name=YESNO_NAME, create_type=False)
op.add_column('musiconhold', sa.Column('loop_last', yesno_values))
def downgrade():
if op.get_context().bind.dialect.name == 'mssql':
op.drop_constraint('musiconhold','loop_last')
op.drop_column('musiconhold', 'loop_last')