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.

25 lines
1.2 KiB

  1. #! /bin/sh
  2. # Written by Alexis de Lattre <alexis.delattre@akretion.com>
  3. # Example of wrapper for get_cid_name.py which makes sure that the
  4. # script doesn't take too much time to execute
  5. # Limiting the execution time of get_cid_name.py is important because
  6. # the script is designed to be executed at the beginning of each
  7. # incoming phone call... and if the script get stucks, the phone call
  8. # will also get stucks and you will miss the call !
  9. # For Debian Lenny and Ubuntu Lucid, you need to install the package "timeout"
  10. # For Ubuntu >= Maverick and Debian >= Squeeze, the "timeout" command is shipped
  11. # in the "coreutils" package
  12. # The first argument of the "timeout" command is the maximum execution time
  13. # In this example, we chose 2 seconds. Note that geolocalisation takes about
  14. # 1 second on an small machine ; so if you enable the --geoloc option,
  15. # don't put a 1 sec timeout !
  16. # To test this script manually (i.e. outside of Asterisk), run :
  17. # echo "agi_callerid:0141981242"|get_cid_name_timeout.sh
  18. # where 0141981242 is a phone number that could be presented by the calling party
  19. timeout 2s /usr/local/bin/get_cid_name.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --geoloc --geoloc-country "FR" --geoloc-lang "fr"