#!/usr/bin/perl use Asterisk::AGI; $agi = new Asterisk::AGI; local $::INPUT_RECORD_SEPARATOR="\n"; local $::OUTPUT_AUTOFLUSH=1; my $agi = new Asterisk::AGI; my %input = $agi->ReadParse(); my ($callerid) = shift @ARGV; my $tel = $callerid; if ($tel == NULL) { $agi->exec("SetCIDNum 1234567890"); <<< Set to a default telephone number if no value found } else { $tel =~ tr/-+() //d; my $char = substr($tel, 0, 1); if ($char == 1) { <<< This if loop is optional $tel =~ s/^1*//; } $agi->exec("SetCIDNum $tel"); }