---
- name:  Download PJSUA
  become: yes
  shell: 'sudo wget https://www.pjsip.org/release/2.9/pjproject-2.9.tar.bz2'
  args:
    chdir: '/tmp'

- name:  Unzip PJSUA
  become: yes
  shell: 'sudo tar -xvf pjproject-2.9.tar.bz2'
  args:
    chdir: '/tmp'

- name:  Export CFLAGS
  become: yes
  shell: 'export CFLAGS="$CFLAGS -fPIC"'

- name:  Install PJSUA
  become: yes
  shell: 'sudo ./configure && make dep && make && make install'
  args:
    chdir: '/tmp/pjproject-2.9'

- name:  Copy PJSUA into /usr/bin
  become: yes
  shell: 'sudo mv pjsua-x86_64-unknown-linux-gnu /usr/bin/pjsua'
  args:
    chdir: '/tmp/pjproject-2.9/pjsip-apps/bin'
