Guest User

Asterisk_Intercom_code&config

a guest
Aug 6th, 2014
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. ----------------------------------------------------------------
  2. /etc/rc.local
  3. ----------------------------------------------------------------
  4. #!/bin/sh -e
  5. #
  6. # rc.local
  7. #
  8. # This script is executed at the end of each multiuser runlevel.
  9. # Make sure that the script will "exit 0" on success or any other
  10. # value on error.
  11. #
  12. # In order to enable or disable this script just change the execution
  13. # bits.
  14. #
  15. # By default this script does nothing.
  16.  
  17. # Print the IP address
  18. _IP=$(hostname -I) || true
  19. if [ "$_IP" ]; then
  20. printf "My IP address is %s\n" "$_IP"
  21. fi
  22.  
  23. python /home/pi/Call_Button.py
  24.  
  25. exit 0
  26. -------------------------------------------------------------------------
  27. /etc/sudoers.tmp ######### modify using visudo only! #########
  28. -------------------------------------------------------------------------
  29. #
  30. # This file MUST be edited with the 'visudo' command as root.
  31. #
  32. # Please consider adding local content in /etc/sudoers.d/ instead of
  33. # directly modifying this file.
  34. #
  35. # See the man page for details on how to write a sudoers file.
  36. #
  37. Defaults env_reset
  38. Defaults mail_badpass
  39. Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  40.  
  41. # Host alias specification
  42.  
  43. # User alias specification
  44.  
  45. # Cmnd alias specification
  46.  
  47. # User privilege specification
  48. root ALL=(ALL:ALL) ALL
  49.  
  50. # Allow members of group sudo to execute any command
  51. %sudo ALL=(ALL:ALL) ALL
  52.  
  53. # See sudoers(5) for more information on "#include" directives:
  54.  
  55. #includedir /etc/sudoers.d
  56. pi ALL=(ALL) NOPASSWD: ALL
  57.  
  58. #asterisk ALL = NOPASSWD: /usr/share/asterisk/agi-bin/unlock_door.py
  59.  
  60. -------------------------------------------------------------------------
  61. /home/pi/Call_button.py
  62. -------------------------------------------------------------------------
  63. #!/usr/bin/env python
  64.  
  65. import RPi.GPIO as GPIO
  66. import time
  67. import logging
  68. logging.basicConfig(filename='/home/pi/door_trigger.log',level=logging.DEBUG ,format='%(asctime)s %(message)s')
  69. logging.info('Door Unlocked!')
  70. GPIO.setwarnings(False)
  71. GPIO.setmode(GPIO.BCM)
  72. GPIO.setup(17, GPIO.OUT)
  73. GPIO.output(17,True)
  74. time.sleep(5.0)
  75. GPIO.output(17,False)
  76.  
  77. --------------------------------------------------------------
  78. /usr/share/asterisk/agi-bin/unlock_door
  79. --------------------------------------------------------------
  80. #!/usr/bin/perl
  81. $|=1;
  82. system 'sudo /usr/share/asterisk/agi-bin/unlock_door.py';
  83. sleep 3;
  84.  
  85. --------------------------------------------------------------
  86. /usr/share/asterisk/agi-bin/unlock_door.py
  87. --------------------------------------------------------------
  88. #!/usr/bin/env python
  89.  
  90. import RPi.GPIO as GPIO
  91. import time
  92. import logging
  93. logging.basicConfig(filename='/home/pi/door_trigger.log',level=logging.DEBUG ,format='%(asctime)s %(message)s')
  94. logging.info('Door Unlocked!')
  95. GPIO.setwarnings(False)
  96. GPIO.setmode(GPIO.BCM)
  97. GPIO.setup(17, GPIO.OUT)
  98. GPIO.output(17,True)
  99. time.sleep(5.0)
  100. GPIO.output(17,False)
  101.  
  102. -------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment