Swara Installation on Ubuntu

In order to install Swara, you need to be reasonably proficient with Linux in general and your distribution (in this case Ubuntu) in particular.
This means you shoudl be able to install your own applications using apt-get and be able to troubleshoot broken downloads and dependencies.
If this is all g(r)eek to you, please find someone who know their way around a Linux system to at least look over your shoulder, so that you don’t waste time with trivial issues. Of course spending time solving trivial issues is the best way to get good with any system.

To get Swara installed on Ubuntu, you need:

  1. An Ubuntu system (d-uh), preferably a newer version, 64 and 32 bit are both supported
    • If you are installing a fresh system, we recommend Ubuntu Server (the latest edition). While installing the system, please make sure to install the following:
      1. OpenSSH Server
      2. LAMP
      3. Mail Server
  2. An internet connection (and patience depending on where you’re installing from)
  3. Root credentials (yes, I know this is insecure and one day I promise I will update this page to reflect a minimal permission set

Steps:

  1. Open a terminal (CTRL+ALT+T)
  2. Run sudo su - and provide your credentials
  3. Run the following commands to install the dependencies:

    # apt-get install lame asterisk mysql-server wget gcc g++ bison zlib1g zlib-bin openssl php5-mysql php5 apache2 python-mysqldb
    # apt-get install python-setuptools
    # easy_install MySQL-Python
    # easy_install tweepy
    # easy_install oauth2
    # easy_install stopwatch
    # easy_install simplejson
  4. Turn off all firewalls
  5. Set up required services to start on boot:

    # /usr/bin/mysql_secure_installation (Answer yes to every question, set a new password for the root user)
    # mysql -u root -p
    mysql>create database swara;
    mysql>exit
  6. Download Swara and install:

    # wget https://github.com/mojolab/swara/tarball/developers

    # mv developers /opt/
    swara.tgz
    # cd /opt

    # tar xvzf swara.tgz

    # mv mojolab-swara swara

    # cd /var/www/

    # ln -s /opt/swara/web /var/www/swara

    # cd /usr/share/asterisk 

    # mkdir orig && mv sounds agi-bin orig/

    # ln -s /opt/swara/bin agi-bin && ln -s /opt/swara/sounds sounds

    # cd /opt/swara/conf

    #
    <Edit swara.conf and put in your database password>
    # cp swara.conf /etc

    # cp extensions.conf /etc/as
    terisk
    # cp sip.conf /etc/asterisk
    # mysql -u root -p swara < swaradb.sql

    # cd /opt/swara/web
    # mkdir /opt/swara/sounds/web && ln -s /opt/swara/sounds/web
    audio
    # ln -s /opt/swara/sounds/web upload

    # chmod a+rwx -R /opt/swara
    # touch /var/log/swara.log

    # chmod a+rwx -R /var/log/swara.log
  7. Open a browser and go to http://<yourIPAddress>/swara/install.php
  8. Check that the permissions are correct and click “Next”
  9. Enter the details for your setup as shown, click “Next”
  10. Open the file “/opt/swara/web/loudblog/custom/config.php” in a text editor, remove all the existing contents and replace with the contents of the text box in the browser
  11. Save and close the file
  12. Go back to the browser and click “Next”
  13. This will complete the setup

This completes the web and IVR setup on the server side. Next we need to set up clients and test the IVR to confirm that it works.

  1. Install a softphone application such as XLite, Twinke or MySJPhone.
  2. Configure it with the SIP account details of the server with the following:
    1. SIP Server : Your Ubuntu machine’s IP address
    2. Username: mysjphone
    3. Password: blablabla
  3. Use the softphone to call the SIP extension: swara-local
  4. You should hear the IVR prompts
  5. If you press 1 you should be able to record a new message, which will in turn show up on the Postings page,

 

 

9 thoughts on “Swara Installation on Ubuntu”

  1. Thank you for the useful and instructive tuts.

    I followed the instructions and successfully completed the installation. I provided the credentials for the SIP Account on Twinkle too. But unfortunately when I call the call ends in a second.

    The display section says:
    Line 1: far end answered call

    What the problem might be.

    1. Try this:
      chmod a+rwx -R /var/log/swara.log

      If that doesn’t work, check the logs:

      tail -100 /var/log/asterisk/messages
      tail -100 /var/log/swara.log

      And paste output here.

      This is most likely either a broken simlink or a permissions issue.

      Cheers
      Arjun

  2. I tried setting the permission but still same issue. Followings are the result for the tail:

    tail -100 /var/log/asterisk/messages
    [Feb 27 09:27:10] NOTICE[784] cdr.c: CDR simple logging enabled.
    [Feb 27 09:27:10] NOTICE[784] loader.c: 217 modules will be loaded.
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘app_voicemail.so’: /usr/lib/asterisk/modules/app_voicemail.so: undefined symbol: ast_smdi_mwi_set
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘chan_iax2.so’: /usr/lib/asterisk/modules/chan_iax2.so: undefined symbol: ast_aes_set_encrypt_key
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘pbx_ael.so’: /usr/lib/asterisk/modules/pbx_ael.so: undefined symbol: ael2_parse
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘res_calendar_caldav.so’: /usr/lib/asterisk/modules/res_calendar_caldav.so: undefined symbol: ast_calendar_event_container_alloc
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘res_calendar_icalendar.so’: /usr/lib/asterisk/modules/res_calendar_icalendar.so: undefined symbol: ast_calendar_register
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘app_speech_utils.so’: /usr/lib/asterisk/modules/app_speech_utils.so: undefined symbol: ast_speech_dtmf
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘res_calendar_exchange.so’: /usr/lib/asterisk/modules/res_calendar_exchange.so: undefined symbol: ast_calendar_register
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘chan_jingle.so’: /usr/lib/asterisk/modules/chan_jingle.so: undefined symbol: ast_aji_send
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘chan_gtalk.so’: /usr/lib/asterisk/modules/chan_gtalk.so: undefined symbol: ast_aji_send
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘app_stack.so’: /usr/lib/asterisk/modules/app_stack.so: undefined symbol: ast_agi_unregister
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘res_agi.so’: /usr/lib/asterisk/modules/res_agi.so: undefined symbol: ast_speech_change
    [Feb 27 09:27:10] NOTICE[784] res_odbc.c: res_odbc loaded.
    [Feb 27 09:27:10] NOTICE[784] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
    [Feb 27 09:27:10] WARNING[784] loader.c: Error loading module ‘app_stack.so’: /usr/lib/asterisk/modules/app_stack.so: undefined symbol: ast_agi_unregister
    [Feb 27 09:27:10] WARNING[784] loader.c: Module ‘app_stack.so’ could not be loaded.
    [Feb 27 09:27:10] NOTICE[784] config.c: Registered Config Engine sqlite
    [Feb 27 09:27:10] NOTICE[784] config.c: Registered Config Engine curl
    [Feb 27 09:27:10] NOTICE[784] res_config_ldap.c: No directory user found, anonymous binding as default.
    [Feb 27 09:27:10] ERROR[784] res_config_ldap.c: No directory URL or host found.
    [Feb 27 09:27:10] ERROR[784] res_config_ldap.c: Cannot load LDAP RealTime driver.
    [Feb 27 09:27:10] NOTICE[784] chan_sip.c: The ‘username’ field for sip peers has been deprecated in favor of the term ‘defaultuser’
    [Feb 27 09:27:10] NOTICE[784] chan_skinny.c: Configuring skinny from skinny.conf
    [Feb 27 09:27:10] NOTICE[784] cel_tds.c: cel_tds has no global category, nothing to configure.
    [Feb 27 09:27:10] WARNING[784] cel_tds.c: cel_tds module had config problems; declining load
    [Feb 27 09:27:10] WARNING[784] cel_pgsql.c: CEL pgsql config file missing global section.
    [Feb 27 09:27:10] ERROR[784] ais/clm.c: Could not initialize cluster membership service: Try Again
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: Starting AEL load process.
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: AEL load process: parsed config file name ‘/etc/asterisk/extensions.ael’.
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: AEL load process: checked config file name ‘/etc/asterisk/extensions.ael’.
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: AEL load process: compiled config file name ‘/etc/asterisk/extensions.ael’.
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: AEL load process: merged config file name ‘/etc/asterisk/extensions.ael’.
    [Feb 27 09:27:10] NOTICE[784] pbx_ael.c: AEL load process: verified config file name ‘/etc/asterisk/extensions.ael’.
    [Feb 27 09:27:10] ERROR[784] chan_vpb.cc: No Voicetronix cards detected
    ———————————–

    tail -100 /var/log/swara.log
    No Result

    1. Does /var/log/swara.log exist? Try creating it manually and then change permissions to make it writeable by all.

        1. I caught up with Guest (Abdul Rehman Sherzad, my friend from the Kabul Innovation Lab) and we solved this one:

          me: sherzad, were you able to get it to work
          ?
          Sent at 4:53 PM on Wednesday
          Abdul: no
          it connects just after a second it disconnect
          I followed the steps you mentioned
          me: ok…if it is immediately disconnecting, you may have some simlinks missing or permissions set wrong
          try chmod a+rwx -R /opt/swara
          if that doesnt fix it run these commands
          cd /opt/swara/bin
          ./menu_system_localized.py
          if the python script fails to run, send me the error message
          if it does run, then put in the following input (there wont be a prompt):
          agi_callerid: 981112222
          and then enter
          it should give you an error message at this point, if there are missing simlinks
          try it out and let me know how it went
          Abdul: ok
          Sent at 4:58 PM on Wednesday
          Abdul: Result of running ./menu_system_localized.py
          Traceback (most recent call last): File “./menu_system_localized.py”, line 8, in import stopwatch
          me: ah ok…great, so there are some packages missing
          Abdul: ImportError: No module named stopwatch
          me: one sec
          run these:
          # apt-get install python-setuptools
          # easy_install MySQL-Python
          # easy_install tweepy
          # easy_install oauth2
          # easy_install stopwatch
          # easy_install simplejson
          and then try calling from twinkle again
          Sent at 5:10 PM on Wednesday
          Abdul: thank you Arjun
          me: its working now?
          Abdul: Stopwatch was missing
          a quick question
          If want to swap the default instruction sound which file I have to modify?
          yeah it is working
          me: great…ok…on the sound files, you need to open the /opt/swara/prompts folder
          sorry../opt/swara/sounds/prompts
          you will see several folders there
          if you open the english folder you will see many files…these are raw audio files
          you need to use audacity to replace each file with one of yours…the sound should be recorded at 8000 KHz
          i will write up a full article soon about how to replace the prompts
          meanwhile, do you mind if i post this chat to the website?
          other people will be able to reference it
          Abdul: that is fine
          me: Thanks!
          Abdul: you welcome and thank you from you too
          Sent at 5:19 PM on Wednesday

  3. Hi Arjun,

    I have installed Swara server as described in this page on a desktop running ubuntu 11.10 and is installed perfectly. Now while configuring it with Matrix ATA 211G, can you pls guide what configuration to do on the Matrix adapter to work with Swara.

    regards
    Saubhik Roy
    saubhikr@praxis-softek.com

Leave a Reply to admin Cancel reply

Your email address will not be published.