---
- name: Application de la conf général SIP
  template:
    src: sip-profiles.xml.j2
    dest: /opt/freeswitch/conf/sip_profiles/external/sip.xml
    mode: u=rw,g=r,o=r
    owner: freeswitch
    group: daemon
  notify:
    - restart freeswitch

- name: Application de la conf SIP
  file:
    src: bbb_sip_ovh.xml
    dest: /opt/freeswitch/conf/dialplan/public/bbb_sip_ovh.xml
    mode: u=rw,g=r,o=r
    owner: freeswitch
    group: daemon
  notify:
    - restart freeswitch

- name: Ajout d'un message d'information dans le chat
  lineinfile:
    path: /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties
    regexp: "defaultDialAccessNumber="
    line: "defaultDialAccessNumber={{ bbb_sip_telnum_for_user }}"

- name: Ajout d'un message d'information dans le chat
  lineinfile:
    path: /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties
    regexp: "defaultWelcomeMessageFooter="
    line:
      "defaultWelcomeMessageFooter=Pour rejoindre la conf&eacute;rence par t&eacute;l&eacute;phone,
       appeler au num&eacute;ro :<br>  %%DIALNUM%%<br> puis saisir le code :<br> %%CONFNUM%%"
  notify:
    - restart bigbluebutton

- name: Changement du message d'accueil audio
  copy:
    src: "{{ inventory_hostname }}/bbb-sounds/{{ item }}/conf-pin.wav"
    dest: "/opt/freeswitch/share/freeswitch/sounds/en/us/callie/conference/{{ item }}/"
    owner: freeswitch
    group: daemon
    mode: u=rw,g=r,o=r
    backup: true
  loop:
    - 8000
    - 16000
    - 32000
    - 48000
