Modify Perl script

hidalgo

Member
Joined
Sep 13, 2011
Messages
50
Reaction score
0
I got this script from here:
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&note=$my_note_e&flagged=$SHOULD_FLAG";
	my $browser = LWP::UserAgent->new;
	$browser->post($url);
}

exit(0);
But now I get a message on every Mac when a call comes in. How to modify this script to have the message only on the mac the phone stands by?
I think it has to extract the extension that’s ringing and have an entry in the AsteriskDB the corresponding IP address …
 

Members online

No members online now.

Forum statistics

Threads
25,804
Messages
167,724
Members
19,232
Latest member
voiplads
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top