๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/asterisk/templates/custom_queues.j2

26 lines
1.2 KiB

{% for user in asterisk_users | d({}) | dict2items -%}
{% if user.value is mapping -%}
[queue-{{ user.key }}]({{ user.value['self_queue_type'] | d('queue-single') }})
member => PJSIP/{{ user.key }},0,{{ user.value['callerid'] | d(user.key) }}
{% endif -%}
{% endfor %}
{% set defined_queues = (asterisk_users | d({}) | dict2items | map(attribute='value') | list | selectattr('queues', 'defined') | map(attribute='queues') | list | flatten | unique | list) -%}
{% set auto_queues = (asterisk_users | d({}) | dict2items | rejectattr('value.queues', 'defined') | map(attribute='key') | list) -%}
{% set all_queues = ((defined_queues | d([])) + (auto_queues | d([])) | unique | list) -%}
{% for queue in defined_queues -%}
{% if asterisk_users[queue] is not defined -%}
{% set queue_users = (asterisk_users | d({}) | dict2items | selectattr('value.queues', 'defined') | selectattr('value.queues', 'contains', queue) | list) -%}
{% if queue_users | length > 1 -%}
[queue-{{ queue }}](queue-template)
{% for user in queue_users -%}
member => PJSIP/{{ user.key }},0,{{ user.value['callerid'] | d(user.key) }}
{% endfor -%}
{%- if not loop.last %}
{% endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}