/usr/bin/asterisk-dump is in python-asterisk 0.5.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | #! /usr/bin/python
'''
Dump events from the Manager interface to stdout.
'''
__author__ = 'David Wilson'
__id__ = '$Id$'
import sys, time, socket
from Asterisk.Config import Config
from Asterisk.Manager import CoreManager
import Asterisk.Manager, Asterisk.Util
class MyManager(CoreManager):
'''
Print events to stdout.
'''
def on_Event(self, event):
Asterisk.Util.dump_packet(event)
def main2():
manager = MyManager(*Config().get_connection())
try:
print '#', repr(manager)
print
manager.serve_forever()
except KeyboardInterrupt, e:
raise SystemExit
def main(argv):
max_reconnects = 100
reconnect_delay = 2
while True:
try:
main2()
except Asterisk.Manager.GoneAwayError, e:
print '#', str(e)
except socket.error, e:
print
print '# Connect error:', e[1]
reconnect_delay *= 2
print '# Waiting', reconnect_delay, 'seconds before reconnect.'
print '# Will try', max_reconnects, 'more times before exit..'
max_reconnects -= 1
time.sleep(reconnect_delay)
print '# Reconnecting...'
if __name__ == '__main__':
main(sys.argv[1:])
|