Ich habe im Internet dieses Script gefunden:
Leider verstehe ich zuwenig von AGI, um es meinen Bedürfnissen anpassen zu können.
Das Problem ist, dieses Script sendet eine Meldung an jeden Computer, dessen IP-Adresse in der ersten Zeile eingegeben wurde. Ich möchte nun die Meldung nur an den Computer schicken, dessen Nebenstelle auch wirklich klingelt.
Ich habe die Nebenstellen und die zugehörigen IP-Adressen in der Asterisk DB gespeichert und würde nun gern wissen, wie ich diese Einträge innerhalb des Scripts abrufen kann.
Code:
#!/usr/bin/perl -w
# -------------------------------------------------------------------- #
# #
# This script requires that you have the Dialectic Remote HTTP #
# server running. #
# #
# Update the properties below as necessary. #
# #
# On the Asterisk server, copy this script into: #
# /var/lib/asterisk/agi-bin/ #
# #
# Update the permissions on the AGI file: #
# #
# cd /var/lib/asterisk/agi-bin/ #
# chmod 755 dialectic-asterisk-incoming-call-monitor.agi #
# #
# To actually call the script, modify your extensions_custom.conf #
# file. For example: #
# #
# exten => s,1,AGI,dialectic-asterisk-incoming-call-monitor.agi #
# #
# If you're using an extensions.ael file, the block for incoming #
# calls could look similar to this: #
# #
# 1 => { #
# AGI(dialectic-asterisk-incoming-call-monitor.agi); #
# } #
# #
# After modifying the extensions_custom.conf or extensions.ael file, #
# you'll need to reload your Asterisk server for the new #
# settings to take effect. #
# #
# Some users have reported issues when editing this file on a #
# Windows machine. #
# #
# -------------------------------------------------------------------- #
# -------------------------------------------------------------------- #
# #
# EDIT THE FOLLOWING PROPERTIES AS NECESSARY #
# #
# -------------------------------------------------------------------- #
@DIALECTIC_MAC_IP_ARRAY = ('192.168.0.100'); # The IP address(es) of the Mac(s) running Dialectic listening for incoming calls.
# For multiple Macs, add additional single-quoted IP addresses to the array separated
# by commas like so:
# @DIALECTIC_MAC_IP_ARRAY = ('192.168.0.100','192.168.0.101','192.168.0.102');
$DIALECTIC_MAC_PORT = '58384'; # The port of the Mac running Dialectic as set in the Dialectic preferences
$DIALECTIC_PASSWORD = 'mySecretWord'; # The password as set in the Dialectic preferences
$MY_DEVICE_NAME = 'My Phone'; # The name of the device that will be included in the Dialectic call log
$MY_NOTE = 'Note to include in the log.'; # Static text that will be included in the Dialectic call log
$SHOULD_FLAG = 'NO'; # 'YES' to flag the entry in the Dialectic call log
# -------------------------------------------------------------------- #
# #
# DO NOT EDIT BELOW HERE #
# #
# -------------------------------------------------------------------- #
open STDOUT, '>/dev/null';
fork and exit;
use Asterisk::AGI;
use LWP::UserAgent;
use URI::Escape;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
my $caller_id = $input{'callerid'};
my $caller_id_name = $input{'calleridname'};
my $caller_id_e = uri_escape($caller_id);
my $caller_id_name_e = uri_escape($caller_id_name);
my $dialectic_password_e = uri_escape($DIALECTIC_PASSWORD);
my $my_device_name_e = uri_escape($MY_DEVICE_NAME);
my $my_note_e = uri_escape($MY_NOTE);
foreach(@DIALECTIC_MAC_IP_ARRAY) {
my $url = "http://$_:$DIALECTIC_MAC_PORT/callDetected?password=$dialectic_password_e&number=$caller_id_e&name=$caller_id_name_e&device=$my_device_name_e¬e=$my_note_e&flagged=$SHOULD_FLAG";
my $browser = LWP::UserAgent->new;
$browser->post($url);
}
exit(0);
Das Problem ist, dieses Script sendet eine Meldung an jeden Computer, dessen IP-Adresse in der ersten Zeile eingegeben wurde. Ich möchte nun die Meldung nur an den Computer schicken, dessen Nebenstelle auch wirklich klingelt.
Ich habe die Nebenstellen und die zugehörigen IP-Adressen in der Asterisk DB gespeichert und würde nun gern wissen, wie ich diese Einträge innerhalb des Scripts abrufen kann.