#!/usr/bin/env python
import subprocess
import time
import sys
# Check if the caller argument is provided
if len(sys.argv) < 2:
print("Usage: script.py <caller>")
sys.exit(1)
caller = sys.argv[1]
i = 0
while i < 30:
print(i)
time.sleep(1)
i += 1
# Run the command and capture the output
command = ['/usr/sbin/asterisk', '-x', 'channel redirect {} vc_lookup,100,play'.format(caller)]
try:
result = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = result.communicate()
# Print the output
print(output)
if error:
print("Error:", error)
except Exception as e:
print("An error occurred:", str(e))
No hay comentarios:
Publicar un comentario