removal of some depricated files
documentation updates git-svn-id: svn://192.168.202.10@231 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+10
-10
@@ -622,8 +622,8 @@ PHASE 4: INSTALLING ASTERISK
|
||||
|
||||
OK, all the prep work is done, now it's time to start having fun with Asterisk.
|
||||
There are two basic ways to install Asterisk, an official release(at the time of
|
||||
this writing the official release is 1.2.10) and the SVN_DEV version(development
|
||||
branch). We recommend using Asterisk 1.2.10. These instructions are how we get
|
||||
this writing the official release is 1.2.11) and the SVN_DEV version(development
|
||||
branch). We recommend using Asterisk 1.2.11. These instructions are how we get
|
||||
our Asterisk system with it's T1 line installed with our 2 SIP VOIP devices and
|
||||
one IAX2 softphone.
|
||||
|
||||
@@ -638,13 +638,13 @@ with the following patch:
|
||||
- mkdir /usr/src/asterisk
|
||||
- cd /usr/src/asterisk
|
||||
A. if you want 1.2 release (reliable with new features):
|
||||
- wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.10.tar.gz
|
||||
- wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.7.tar.gz
|
||||
- wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.11.tar.gz
|
||||
- wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.8.tar.gz
|
||||
- wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.3.tar.gz
|
||||
- gunzip asterisk-1.2.10.tar.gz
|
||||
- tar xvf asterisk-1.2.10.tar
|
||||
- gunzip zaptel-1.2.7.tar.gz
|
||||
- tar xvf zaptel-1.2.7.tar
|
||||
- gunzip asterisk-1.2.11.tar.gz
|
||||
- tar xvf asterisk-1.2.11.tar
|
||||
- gunzip zaptel-1.2.8.tar.gz
|
||||
- tar xvf zaptel-1.2.8.tar
|
||||
- gunzip libpri-1.2.3.tar.gz
|
||||
- tar xvf libpri-1.2.3.tar
|
||||
B. if you want latest SVN_DEV version (sometimes unstable) [1.3 tree]
|
||||
@@ -665,7 +665,7 @@ with the following patch:
|
||||
edit this line at the top and just add a hash # in front of it as shown:
|
||||
#PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
|
||||
|
||||
- cd ./zaptel-1.2.7
|
||||
- cd ./zaptel-1.2.8
|
||||
- make clean
|
||||
- make
|
||||
- make install
|
||||
@@ -673,7 +673,7 @@ with the following patch:
|
||||
- make clean
|
||||
- make
|
||||
- make install
|
||||
- cd ../asterisk-1.2.10
|
||||
- cd ../asterisk-1.2.11
|
||||
- (1.2 tree) If you want to include Answering Machine Detection ability
|
||||
you will need to download app_amd.c and amd.conf and alter the
|
||||
apps/Makefile to compile it properly
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
### AST_VICI_conf.pl
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
|
||||
### Customized Variables
|
||||
$SIP_user = 'SIP/cc100'; # your phone id
|
||||
$server_ip = '10.10.10.15'; # Asterisk server IP
|
||||
$DB_server = '10.10.10.15'; # MySQL server IP
|
||||
$DB_database = 'asterisk'; # MySQL database name
|
||||
$DB_user = 'idcheck'; # MySQL user
|
||||
$DB_pass = '1234'; # MySQL pass
|
||||
$DB_port = '3306'; # MySQL connection port
|
||||
|
||||
### Constants
|
||||
$record_channel='';
|
||||
$filename='';
|
||||
$recording_id='';
|
||||
$US = '_';
|
||||
$MT[0] = '';
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
# this subroutine is to be used with the callerID function to customize the
|
||||
# variables that are passed in the URL string and the way that they are passed,
|
||||
# these are the variables you have to work with:
|
||||
# $callerID_areacode
|
||||
# $callerID_prefix
|
||||
# $callerID_last4
|
||||
# $callerID_Time
|
||||
# $callerID_Channel
|
||||
# $callerID_uniqueID
|
||||
# $callerID_phone_ext
|
||||
# $callerID_server_ip
|
||||
# $callerID_extension
|
||||
# $callerID_inbound_number
|
||||
# $callerID_comment_a
|
||||
# $callerID_comment_b
|
||||
# $callerID_comment_c
|
||||
# $callerID_comment_d
|
||||
# $callerID_comment_e
|
||||
|
||||
sub create_callerID_local_query_string
|
||||
{
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$callerID_areacode";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$callerID_prefix";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$callerID_last4";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$callerID_Time";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Channel=$callerID_Channel";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$callerID_uniqueID";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$callerID_phone_ext";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$callerID_server_ip";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$callerID_extension";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$callerID_inbound_number";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$callerID_comment_a";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$callerID_comment_b";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$callerID_comment_c";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$callerID_comment_d";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$callerID_comment_e";
|
||||
}
|
||||
|
||||
# $lead_id
|
||||
# $vendor_id
|
||||
# $list_id
|
||||
# $phone_code
|
||||
# $phone_number
|
||||
# $title
|
||||
# $first_name
|
||||
# $middle_initial
|
||||
# $last_name
|
||||
# $address1
|
||||
# $address2
|
||||
# $address3
|
||||
# $city
|
||||
# $state
|
||||
# $province
|
||||
# $postal_code
|
||||
# $country_code
|
||||
# $gender
|
||||
# $date_of_birth
|
||||
# $alt_phone
|
||||
# $email
|
||||
# $security
|
||||
# $comments
|
||||
# $user
|
||||
# $pass
|
||||
# $fronter
|
||||
# $closer
|
||||
# $campaign
|
||||
# $group
|
||||
# $SQLdate
|
||||
# $epoch
|
||||
# $uniqueid
|
||||
# $customer_zap_channel
|
||||
# $server_ip
|
||||
# $SIPexten
|
||||
|
||||
sub create_VICIDIAL_query_string
|
||||
{
|
||||
$VICIDIAL_web_QUERY_STRING ='';
|
||||
$VICIDIAL_web_QUERY_STRING.="?lead_id=$lead_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&vendor_id=$vendor_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&list_id=$list_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone_code=$phone_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone_number=$phone_number";
|
||||
$VICIDIAL_web_QUERY_STRING.="&title=$title";
|
||||
$VICIDIAL_web_QUERY_STRING.="&first_name=$first_name";
|
||||
$VICIDIAL_web_QUERY_STRING.="&middle_initial=$middle_initial";
|
||||
$VICIDIAL_web_QUERY_STRING.="&last_name=$last_name";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address1=$address1";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address2=$address2";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address3=$address3";
|
||||
$VICIDIAL_web_QUERY_STRING.="&city=$city";
|
||||
$VICIDIAL_web_QUERY_STRING.="&state=$state";
|
||||
$VICIDIAL_web_QUERY_STRING.="&province=$province";
|
||||
$VICIDIAL_web_QUERY_STRING.="&postal_code=$postal_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&country_code=$country_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&gender=$gender";
|
||||
$VICIDIAL_web_QUERY_STRING.="&date_of_birth=$date_of_birth";
|
||||
$VICIDIAL_web_QUERY_STRING.="&alt_phone=$alt_phone";
|
||||
$VICIDIAL_web_QUERY_STRING.="&email=$email";
|
||||
$VICIDIAL_web_QUERY_STRING.="&security=$security";
|
||||
$VICIDIAL_web_QUERY_STRING.="&comments=$comments";
|
||||
$VICIDIAL_web_QUERY_STRING.="&user=$user";
|
||||
$VICIDIAL_web_QUERY_STRING.="&pass=$userpass";
|
||||
$VICIDIAL_web_QUERY_STRING.="&fronter=$fronter";
|
||||
$VICIDIAL_web_QUERY_STRING.="&closer=$user";
|
||||
$VICIDIAL_web_QUERY_STRING.="&campaign=$campaign";
|
||||
$VICIDIAL_web_QUERY_STRING.="&group=$group";
|
||||
$VICIDIAL_web_QUERY_STRING.="&channel_group=$channel_group";
|
||||
$VICIDIAL_web_QUERY_STRING.="&SQLdate=$SQLdate";
|
||||
$VICIDIAL_web_QUERY_STRING.="&epoch=$secX";
|
||||
$VICIDIAL_web_QUERY_STRING.="&uniqueid=$uniqueid";
|
||||
$VICIDIAL_web_QUERY_STRING.="&customer_zap_channel=$customer_zap_channel";
|
||||
$VICIDIAL_web_QUERY_STRING.="&server_ip=$server_ip";
|
||||
$VICIDIAL_web_QUERY_STRING.="&SIPexten=$SIPexten";
|
||||
$VICIDIAL_web_QUERY_STRING.="&session_id=$session_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone=$phone_number";
|
||||
$VICIDIAL_web_QUERY_STRING.="&parked_by=$lead_id";
|
||||
$VICIDIAL_web_QUERY_STRING =~ s/ /+/gi;
|
||||
$VICIDIAL_web_QUERY_STRING =~ s/\`|\~|\:|\;|\#|\'|\"|\{|\}|\(|\)|\*|\^|\%|\$|\!|\%|\r|\t|\n//gi;
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
### AST_VICI_conf.pl
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
|
||||
### Customized Variables
|
||||
$SIP_user = 'SIP/cc100'; # your phone id
|
||||
$server_ip = '10.10.10.15'; # Asterisk server IP
|
||||
$DB_server = '10.10.10.15'; # MySQL server IP
|
||||
$DB_database = 'asterisk'; # MySQL database name
|
||||
$DB_user = 'idcheck'; # MySQL user
|
||||
$DB_pass = '1234'; # MySQL pass
|
||||
$DB_port = '3306'; # MySQL connection port
|
||||
|
||||
### Constants
|
||||
$record_channel='';
|
||||
$filename='';
|
||||
$recording_id='';
|
||||
$US = '_';
|
||||
$MT[0] = '';
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
# this subroutine is to be used with the callerID function to customize the
|
||||
# variables that are passed in the URL string and the way that they are passed,
|
||||
# these are the variables you have to work with:
|
||||
# $callerID_areacode
|
||||
# $callerID_prefix
|
||||
# $callerID_last4
|
||||
# $callerID_Time
|
||||
# $callerID_Channel
|
||||
# $callerID_uniqueID
|
||||
# $callerID_phone_ext
|
||||
# $callerID_server_ip
|
||||
# $callerID_extension
|
||||
# $callerID_inbound_number
|
||||
# $callerID_comment_a
|
||||
# $callerID_comment_b
|
||||
# $callerID_comment_c
|
||||
# $callerID_comment_d
|
||||
# $callerID_comment_e
|
||||
|
||||
sub create_callerID_local_query_string
|
||||
{
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$callerID_areacode";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$callerID_prefix";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$callerID_last4";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$callerID_Time";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Channel=$callerID_Channel";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$callerID_uniqueID";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$callerID_phone_ext";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$callerID_server_ip";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$callerID_extension";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$callerID_inbound_number";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$callerID_comment_a";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$callerID_comment_b";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$callerID_comment_c";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$callerID_comment_d";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$callerID_comment_e";
|
||||
}
|
||||
|
||||
# $lead_id
|
||||
# $vendor_id
|
||||
# $list_id
|
||||
# $phone_code
|
||||
# $phone_number
|
||||
# $title
|
||||
# $first_name
|
||||
# $middle_initial
|
||||
# $last_name
|
||||
# $address1
|
||||
# $address2
|
||||
# $address3
|
||||
# $city
|
||||
# $state
|
||||
# $province
|
||||
# $postal_code
|
||||
# $country_code
|
||||
# $gender
|
||||
# $date_of_birth
|
||||
# $alt_phone
|
||||
# $email
|
||||
# $security
|
||||
# $comments
|
||||
# $user
|
||||
# $pass
|
||||
# $fronter
|
||||
# $closer
|
||||
# $campaign
|
||||
# $group
|
||||
# $SQLdate
|
||||
# $epoch
|
||||
# $uniqueid
|
||||
# $customer_zap_channel
|
||||
# $server_ip
|
||||
# $SIPexten
|
||||
|
||||
sub create_VICIDIAL_query_string
|
||||
{
|
||||
$VICIDIAL_web_QUERY_STRING ='';
|
||||
$VICIDIAL_web_QUERY_STRING.="?lead_id=$lead_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&vendor_id=$vendor_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&list_id=$list_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone_code=$phone_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone_number=$phone_number";
|
||||
$VICIDIAL_web_QUERY_STRING.="&title=$title";
|
||||
$VICIDIAL_web_QUERY_STRING.="&first_name=$first_name";
|
||||
$VICIDIAL_web_QUERY_STRING.="&middle_initial=$middle_initial";
|
||||
$VICIDIAL_web_QUERY_STRING.="&last_name=$last_name";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address1=$address1";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address2=$address2";
|
||||
$VICIDIAL_web_QUERY_STRING.="&address3=$address3";
|
||||
$VICIDIAL_web_QUERY_STRING.="&city=$city";
|
||||
$VICIDIAL_web_QUERY_STRING.="&state=$state";
|
||||
$VICIDIAL_web_QUERY_STRING.="&province=$province";
|
||||
$VICIDIAL_web_QUERY_STRING.="&postal_code=$postal_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&country_code=$country_code";
|
||||
$VICIDIAL_web_QUERY_STRING.="&gender=$gender";
|
||||
$VICIDIAL_web_QUERY_STRING.="&date_of_birth=$date_of_birth";
|
||||
$VICIDIAL_web_QUERY_STRING.="&alt_phone=$alt_phone";
|
||||
$VICIDIAL_web_QUERY_STRING.="&email=$email";
|
||||
$VICIDIAL_web_QUERY_STRING.="&security=$security";
|
||||
$VICIDIAL_web_QUERY_STRING.="&comments=$comments";
|
||||
$VICIDIAL_web_QUERY_STRING.="&user=$user";
|
||||
$VICIDIAL_web_QUERY_STRING.="&pass=$userpass";
|
||||
$VICIDIAL_web_QUERY_STRING.="&fronter=$fronter";
|
||||
$VICIDIAL_web_QUERY_STRING.="&closer=$user";
|
||||
$VICIDIAL_web_QUERY_STRING.="&campaign=$campaign";
|
||||
$VICIDIAL_web_QUERY_STRING.="&group=$group";
|
||||
$VICIDIAL_web_QUERY_STRING.="&channel_group=$channel_group";
|
||||
$VICIDIAL_web_QUERY_STRING.="&SQLdate=$SQLdate";
|
||||
$VICIDIAL_web_QUERY_STRING.="&epoch=$secX";
|
||||
$VICIDIAL_web_QUERY_STRING.="&uniqueid=$uniqueid";
|
||||
$VICIDIAL_web_QUERY_STRING.="&customer_zap_channel=$customer_zap_channel";
|
||||
$VICIDIAL_web_QUERY_STRING.="&server_ip=$server_ip";
|
||||
$VICIDIAL_web_QUERY_STRING.="&SIPexten=$SIPexten";
|
||||
$VICIDIAL_web_QUERY_STRING.="&session_id=$session_id";
|
||||
$VICIDIAL_web_QUERY_STRING.="&phone=$phone_number";
|
||||
$VICIDIAL_web_QUERY_STRING.="&parked_by=$lead_id";
|
||||
$VICIDIAL_web_QUERY_STRING =~ s/ /+/gi;
|
||||
$VICIDIAL_web_QUERY_STRING =~ s/\`|\~|\:|\;|\#|\'|\"|\{|\}|\(|\)|\*|\^|\%|\$|\!|\%|\r|\t|\n//gi;
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 311 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 240 B |
Binary file not shown.
|
Before Width: | Height: | Size: 230 B |
Binary file not shown.
|
Before Width: | Height: | Size: 520 B |
-1015
File diff suppressed because it is too large
Load Diff
@@ -1,266 +0,0 @@
|
||||
package Net::HTTP;
|
||||
|
||||
# $Id: HTTP.pm,v 1.43 2002/12/26 09:13:53 gisle Exp $
|
||||
|
||||
use strict;
|
||||
use vars qw($VERSION @ISA);
|
||||
|
||||
$VERSION = "1.00";
|
||||
eval { require IO::Socket::INET } || require IO::Socket;
|
||||
require Net::HTTP::Methods;
|
||||
|
||||
@ISA=qw(IO::Socket::INET Net::HTTP::Methods);
|
||||
|
||||
sub configure {
|
||||
my($self, $cnf) = @_;
|
||||
$self->http_configure($cnf);
|
||||
}
|
||||
|
||||
sub http_connect {
|
||||
my($self, $cnf) = @_;
|
||||
$self->SUPER::configure($cnf);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Net::HTTP - Low-level HTTP connection (client)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Net::HTTP;
|
||||
my $s = Net::HTTP->new(Host => "www.perl.com) || die $@;
|
||||
$s->write_request(GET => "/", 'User-Agent' => "Mozilla/5.0");
|
||||
my($code, $mess, %h) = $s->read_response_headers;
|
||||
|
||||
while (1) {
|
||||
my $buf;
|
||||
my $n = $s->read_entity_body($buf, 1024);
|
||||
die "read failed: $!" unless defined $n;
|
||||
last unless $n;
|
||||
print $buf;
|
||||
}
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The C<Net::HTTP> class is a low-level HTTP client. An instance of the
|
||||
C<Net::HTTP> class represents a connection to an HTTP server. The
|
||||
HTTP protocol is described in RFC 2616. The C<Net::HTTP> class
|
||||
support C<HTTP/1.0> and C<HTTP/1.1>.
|
||||
|
||||
C<Net::HTTP> is a sub-class of C<IO::Socket::INET>. You can mix the
|
||||
methods described below with reading and writing from the socket
|
||||
directly. This is not necessary a good idea, unless you know what you
|
||||
are doing.
|
||||
|
||||
The following methods are provided (in addition to those of
|
||||
C<IO::Socket::INET>):
|
||||
|
||||
=over
|
||||
|
||||
=item $s = Net::HTTP->new( %options )
|
||||
|
||||
The C<Net::HTTP> constructor method takes the same options as
|
||||
C<IO::Socket::INET>'s as well as these:
|
||||
|
||||
Host: Initial host attribute value
|
||||
KeepAlive: Initial keep_alive attribute value
|
||||
SendTE: Initial send_te attribute_value
|
||||
HTTPVersion: Initial http_version attribute value
|
||||
PeerHTTPVersion: Initial peer_http_version attribute value
|
||||
MaxLineLength: Initial max_line_length attribute value
|
||||
MaxHeaderLines: Initial max_header_lines attribute value
|
||||
|
||||
The C<Host> option is also the default for C<IO::Socket::INET>'s
|
||||
C<PeerAddr>. The C<PeerPort> defaults to 80 if not provided.
|
||||
|
||||
The C<Listen> option provided by C<IO::Socket::INET>'s constructor
|
||||
method is not allowed.
|
||||
|
||||
If unable to connect to the given HTTP server then the constructor
|
||||
returns C<undef> and $@ contains the reason. After a successful
|
||||
connect, a C<Net:HTTP> object is returned.
|
||||
|
||||
=item $s->host
|
||||
|
||||
Get/set the default value of the C<Host> header to send. The $host
|
||||
should not be set to an empty string (or C<undef>).
|
||||
|
||||
=item $s->keep_alive
|
||||
|
||||
Get/set the I<keep-alive> value. If this value is TRUE then the
|
||||
request will be sent with headers indicating that the server should try
|
||||
to keep the connection open so that multiple requests can be sent.
|
||||
|
||||
The actual headers set will depend on the value of the C<http_version>
|
||||
and C<peer_http_version> attributes.
|
||||
|
||||
=item $s->send_te
|
||||
|
||||
Get/set the a value indicating if the request will be sent with a "TE"
|
||||
header to indicate the transfer encodings that the server can chose to
|
||||
use. If the C<Compress::Zlib> module is installed then this will
|
||||
annouce that this client accept both the I<deflate> and I<gzip>
|
||||
encodings.
|
||||
|
||||
=item $s->http_version
|
||||
|
||||
Get/set the HTTP version number that this client should announce.
|
||||
This value can only be set to "1.0" or "1.1". The default is "1.1".
|
||||
|
||||
=item $s->peer_http_version
|
||||
|
||||
Get/set the protocol version number of our peer. This value will
|
||||
initially be "1.0", but will be updated by a successful
|
||||
read_response_headers() method call.
|
||||
|
||||
=item $s->max_line_length
|
||||
|
||||
Get/set a limit on the length of response line and response header
|
||||
lines. The default is 4096. A value of 0 means no limit.
|
||||
|
||||
=item $s->max_header_length
|
||||
|
||||
Get/set a limit on the number of headers lines that a response can
|
||||
have. The default is 128. A value of 0 means no limit.
|
||||
|
||||
=item $s->format_request($method, $uri, %headers, [$content])
|
||||
|
||||
Format a request message and return it as a string. If the headers do
|
||||
not include a C<Host> header, then a header is inserted with the value
|
||||
of the C<host> attribute. Headers like C<Connection> and
|
||||
C<Keep-Alive> might also be added depending on the status of the
|
||||
C<keep_alive> attribute.
|
||||
|
||||
If $content is given (and it is non-empty), then a C<Content-Length>
|
||||
header is automatically added unless it was already present.
|
||||
|
||||
=item $s->write_request($method, $uri, %headers, [$content])
|
||||
|
||||
Format and send a request message. Arguments are the same as for
|
||||
format_request(). Returns true if successful.
|
||||
|
||||
=item $s->format_chunk( $data )
|
||||
|
||||
Returns the string to be written for the given chunk of data.
|
||||
|
||||
=item $s->write_chunk($data)
|
||||
|
||||
Will write a new chunk of request entity body data. This method
|
||||
should only be used if the C<Transfer-Encoding> header with a value of
|
||||
C<chunked> was sent in the request. Note, writing zero-length data is
|
||||
a no-op. Use the write_chunk_eof() method to signal end of entity
|
||||
body data.
|
||||
|
||||
Returns true if successful.
|
||||
|
||||
=item $s->format_chunk_eof( %trailers )
|
||||
|
||||
Returns the string to be written for signaling EOF when a
|
||||
C<Transfer-Encoding> of C<chunked> is used.
|
||||
|
||||
=item $s->write_chunk_eof( %trailers )
|
||||
|
||||
Will write eof marker for chunked data and optional trailers. Note
|
||||
that trailers should not really be used unless is was signaled
|
||||
with a C<Trailer> header.
|
||||
|
||||
Returns true if successful.
|
||||
|
||||
=item ($code, $mess, %headers) = $s->read_response_headers( %opts )
|
||||
|
||||
Read response headers from server and return it. The $code is the 3
|
||||
digit HTTP status code (see L<HTTP::Status>) and $mess is the textual
|
||||
message that came with it. Headers are then returned as key/value
|
||||
pairs. Since key letter casing is not normalized and the same key can
|
||||
even occur multiple times, assigning these values directly to a hash
|
||||
is not wise. Only the $code is returned if this method is called in
|
||||
scalar context.
|
||||
|
||||
As a side effect this method updates the 'peer_http_version'
|
||||
attribute.
|
||||
|
||||
Options might be passed in as key/value pairs. There are currently
|
||||
only two options supported; C<laxed> and C<junk_out>.
|
||||
|
||||
The C<laxed> option will make read_response_headers() more forgiving
|
||||
towards servers that have not learned how to speak HTTP properly. The
|
||||
C<laxed> option is a boolean flag, and is enabled by passing in a TRUE
|
||||
value. The C<junk_out> option can be used to capture bad header lines
|
||||
when C<laxed> is enabled. The value should be an array reference.
|
||||
Bad header lines will be pushed onto the array.
|
||||
|
||||
The C<laxed> option must be specified in order to communicate with
|
||||
pre-HTTP/1.0 servers that don't describe the response outcome or the
|
||||
data they send back with a header block. For these servers
|
||||
peer_http_version is set to "0.9" and this method returns (200,
|
||||
"Assumed OK").
|
||||
|
||||
The method will raise an exception (die) if the server does not speak
|
||||
proper HTTP or if the C<max_line_length> or C<max_header_length>
|
||||
limits are reached. If the C<laxed> option is turned on and
|
||||
C<max_line_length> and C<max_header_length> checks are turned off,
|
||||
then no exception will be raised and this method will always
|
||||
return a response code.
|
||||
|
||||
=item $n = $s->read_entity_body($buf, $size);
|
||||
|
||||
Reads chunks of the entity body content. Basically the same interface
|
||||
as for read() and sysread(), but the buffer offset argument is not
|
||||
supported yet. This method should only be called after a successful
|
||||
read_response_headers() call.
|
||||
|
||||
The return value will be C<undef> on read errors, 0 on EOF, -1 if no data
|
||||
could be returned this time, otherwise the number of bytes assgined
|
||||
to $buf. The $buf set to "" when the return value is -1.
|
||||
|
||||
This method will raise exceptions (die) if the server does not speak
|
||||
proper HTTP. This can only happen when reading chunked data.
|
||||
|
||||
=item %headers = $s->get_trailers
|
||||
|
||||
After read_entity_body() has returned 0 to indicate end of the entity
|
||||
body, you might call this method to pick up any trailers.
|
||||
|
||||
=item $s->_rbuf
|
||||
|
||||
Get/set the read buffer content. The read_response_headers() and
|
||||
read_entity_body() methods use an internal buffer which they will look
|
||||
for data before they actually sysread more from the socket itself. If
|
||||
they read too much, the remaining data will be left in this buffer.
|
||||
|
||||
=item $s->_rbuf_length
|
||||
|
||||
Returns the number of bytes in the read buffer. This should always be
|
||||
the same as:
|
||||
|
||||
length($s->_rbuf)
|
||||
|
||||
but might be more efficient.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SUBCLASSING
|
||||
|
||||
The read_response_headers() and read_entity_body() will invoke the
|
||||
sysread() method when they need more data. Subclasses might want to
|
||||
override this method to contol how reading takes place.
|
||||
|
||||
The object itself is a glob. Subclasses should avoid using hash key
|
||||
names prefixed with C<http_> and C<io_>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<LWP>, L<IO::Socket::INET>, L<Net::HTTP::NB>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2001-2003 Gisle Aas.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
@@ -1,55 +0,0 @@
|
||||
package Net::HTTPS;
|
||||
|
||||
# $Id: HTTPS.pm,v 1.3 2002/12/23 18:16:29 gisle Exp $
|
||||
|
||||
use strict;
|
||||
use vars qw($VERSION $SSL_SOCKET_CLASS @ISA);
|
||||
|
||||
$VERSION = "1.00";
|
||||
|
||||
# Figure out which SSL implementation to use
|
||||
if ($IO::Socket::SSL::VERSION) {
|
||||
$SSL_SOCKET_CLASS = "IO::Socket::SSL"; # it was already loaded
|
||||
}
|
||||
else {
|
||||
eval { require Net::SSL; }; # from Crypt-SSLeay
|
||||
if ($@) {
|
||||
my $old_errsv = $@;
|
||||
eval {
|
||||
require IO::Socket::SSL;
|
||||
};
|
||||
if ($@) {
|
||||
$old_errsv =~ s/\s\(\@INC contains:.*\)/)/g;
|
||||
die $old_errsv . $@;
|
||||
}
|
||||
$SSL_SOCKET_CLASS = "IO::Socket::SSL";
|
||||
}
|
||||
else {
|
||||
$SSL_SOCKET_CLASS = "Net::SSL";
|
||||
}
|
||||
}
|
||||
|
||||
require Net::HTTP::Methods;
|
||||
|
||||
@ISA=($SSL_SOCKET_CLASS, 'Net::HTTP::Methods');
|
||||
|
||||
sub configure {
|
||||
my($self, $cnf) = @_;
|
||||
$self->http_configure($cnf);
|
||||
}
|
||||
|
||||
sub http_connect {
|
||||
my($self, $cnf) = @_;
|
||||
$self->SUPER::configure($cnf);
|
||||
}
|
||||
|
||||
sub http_default_port {
|
||||
443;
|
||||
}
|
||||
|
||||
# The underlying SSLeay classes fails to work if the socket is
|
||||
# placed in non-blocking mode. This override of the blocking
|
||||
# method makes sure it stays the way it was created.
|
||||
sub blocking { } # noop
|
||||
|
||||
1;
|
||||
-1015
File diff suppressed because it is too large
Load Diff
@@ -1,255 +0,0 @@
|
||||
package Net::SSH;
|
||||
|
||||
use strict;
|
||||
use vars qw($VERSION @ISA @EXPORT_OK $ssh $equalspace $DEBUG @ssh_options);
|
||||
use Exporter;
|
||||
use IO::File;
|
||||
use IPC::Open2;
|
||||
use IPC::Open3;
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw( ssh issh ssh_cmd sshopen2 sshopen3 );
|
||||
$VERSION = '0.07';
|
||||
|
||||
$DEBUG = 0;
|
||||
|
||||
$ssh = "ssh";
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Net::SSH - Perl extension for secure shell
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Net::SSH qw(ssh issh sshopen2 sshopen3);
|
||||
|
||||
ssh('user@hostname', $command);
|
||||
|
||||
issh('user@hostname', $command);
|
||||
|
||||
ssh_cmd('user@hostname', $command);
|
||||
ssh_cmd( {
|
||||
user => 'user',
|
||||
host => 'host.name',
|
||||
command => 'command',
|
||||
args => [ '-arg1', '-arg2' ],
|
||||
stdin_string => "string\n",
|
||||
} );
|
||||
|
||||
sshopen2('user@hostname', $reader, $writer, $command);
|
||||
|
||||
sshopen3('user@hostname', $writer, $reader, $error, $command);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Simple wrappers around ssh commands.
|
||||
|
||||
For an all-perl implementation that does not require the system B<ssh> command,
|
||||
see L<Net::SSH::Perl> instead.
|
||||
|
||||
=head1 SUBROUTINES
|
||||
|
||||
=over 4
|
||||
|
||||
=item ssh [USER@]HOST, COMMAND [, ARGS ... ]
|
||||
|
||||
Calls ssh in batch mode.
|
||||
|
||||
=cut
|
||||
|
||||
sub ssh {
|
||||
my($host, @command) = @_;
|
||||
@ssh_options = &_ssh_options unless @ssh_options;
|
||||
my @cmd = ($ssh, @ssh_options, $host, @command);
|
||||
warn "[Net::SSH::ssh] executing ". join(' ', @cmd). "\n"
|
||||
if $DEBUG;
|
||||
system(@cmd);
|
||||
}
|
||||
|
||||
=item issh [USER@]HOST, COMMAND [, ARGS ... ]
|
||||
|
||||
Prints the ssh command to be executed, waits for the user to confirm, and
|
||||
(optionally) executes the command.
|
||||
|
||||
=cut
|
||||
|
||||
sub issh {
|
||||
my($host, @command) = @_;
|
||||
my @cmd = ($ssh, $host, @command);
|
||||
print join(' ', @cmd), "\n";
|
||||
if ( &_yesno ) {
|
||||
system(@cmd);
|
||||
}
|
||||
}
|
||||
|
||||
=item ssh_cmd [USER@]HOST, COMMAND [, ARGS ... ]
|
||||
|
||||
=item ssh_cmd OPTIONS_HASHREF
|
||||
|
||||
Calls ssh in batch mode. Throws a fatal error if data occurs on the command's
|
||||
STDERR. Returns any data from the command's STDOUT.
|
||||
|
||||
If using the hashref-style of passing arguments, possible keys are:
|
||||
|
||||
user (optional)
|
||||
host (requried)
|
||||
command (required)
|
||||
args (optional, arrayref)
|
||||
stdin_string (optional) - written to the command's STDIN
|
||||
|
||||
=cut
|
||||
|
||||
sub ssh_cmd {
|
||||
my($host, $stdin_string, @command);
|
||||
if ( ref($_[0]) ) {
|
||||
my $opt = shift;
|
||||
$host = $opt->{host};
|
||||
$host = $opt->{user}. '@'. $host if exists $opt->{user};
|
||||
@command = ( $opt->{command} );
|
||||
push @command, @{ $opt->{args} } if exists $opt->{args};
|
||||
$stdin_string = $opt->{stdin_string};
|
||||
} else {
|
||||
($host, @command) = @_;
|
||||
undef $stdin_string;
|
||||
}
|
||||
|
||||
my $reader = IO::File->new();
|
||||
my $writer = IO::File->new();
|
||||
my $error = IO::File->new();
|
||||
|
||||
sshopen3( $host, $writer, $reader, $error, @command ) or die $!;
|
||||
|
||||
print $writer $stdin_string if defined $stdin_string;
|
||||
close $writer;
|
||||
|
||||
local $/ = undef;
|
||||
my $output_stream = <$reader>;
|
||||
my $error_stream = <$error>;
|
||||
|
||||
if ( length $error_stream ) {
|
||||
die "[Net:SSH::ssh_cmd] STDERR $error_stream";
|
||||
}
|
||||
|
||||
return $output_stream;
|
||||
|
||||
}
|
||||
|
||||
=item sshopen2 [USER@]HOST, READER, WRITER, COMMAND [, ARGS ... ]
|
||||
|
||||
Connects the supplied filehandles to the ssh process (in batch mode).
|
||||
|
||||
=cut
|
||||
|
||||
sub sshopen2 {
|
||||
my($host, $reader, $writer, @command) = @_;
|
||||
@ssh_options = &_ssh_options unless @ssh_options;
|
||||
open2($reader, $writer, $ssh, @ssh_options, $host, @command);
|
||||
}
|
||||
|
||||
=item sshopen3 HOST, WRITER, READER, ERROR, COMMAND [, ARGS ... ]
|
||||
|
||||
Connects the supplied filehandles to the ssh process (in batch mode).
|
||||
|
||||
=cut
|
||||
|
||||
sub sshopen3 {
|
||||
my($host, $writer, $reader, $error, @command) = @_;
|
||||
@ssh_options = &_ssh_options unless @ssh_options;
|
||||
open3($writer, $reader, $error, $ssh, @ssh_options, $host, @command);
|
||||
}
|
||||
|
||||
sub _yesno {
|
||||
print "Proceed [y/N]:";
|
||||
my $x = scalar(<STDIN>);
|
||||
$x =~ /^y/i;
|
||||
}
|
||||
|
||||
sub _ssh_options {
|
||||
my $reader = IO::File->new();
|
||||
my $writer = IO::File->new();
|
||||
my $error = IO::File->new();
|
||||
open3($writer, $reader, $error, $ssh, '-V');
|
||||
my $ssh_version = <$error>;
|
||||
chomp($ssh_version);
|
||||
if ( $ssh_version =~ /.*OpenSSH[-|_](\w+)\./ && $1 == 1 ) {
|
||||
$equalspace = " ";
|
||||
} else {
|
||||
$equalspace = "=";
|
||||
}
|
||||
my @options = ( '-o', 'BatchMode'.$equalspace.'yes' );
|
||||
if ( $ssh_version =~ /.*OpenSSH[-|_](\w+)\./ && $1 > 1 ) {
|
||||
unshift @options, '-T';
|
||||
}
|
||||
@options;
|
||||
}
|
||||
|
||||
=back
|
||||
|
||||
=head1 EXAMPLE
|
||||
|
||||
use Net::SSH qw(sshopen2);
|
||||
use strict;
|
||||
|
||||
my $user = "username";
|
||||
my $host = "hostname";
|
||||
my $cmd = "command";
|
||||
|
||||
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
|
||||
|
||||
while (<READER>) {
|
||||
chomp();
|
||||
print "$_\n";
|
||||
}
|
||||
|
||||
close(READER);
|
||||
close(WRITER);
|
||||
|
||||
=head1 FREQUENTLY ASKED QUESTIONS
|
||||
|
||||
Q: How do you supply a password to connect with ssh within a perl script
|
||||
using the Net::SSH module?
|
||||
|
||||
A: You don't. Use RSA or DSA keys. See the ssh-keygen(1) manpage.
|
||||
|
||||
Q: My script is "leaking" ssh processes.
|
||||
|
||||
A: See L<perlfaq8/"How do I avoid zombies on a Unix system">, L<IPC::Open2>,
|
||||
L<IPC::Open3> and L<perlfunc/waitpid>.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
Ivan Kohler <ivan-netssh_pod@420.am>
|
||||
|
||||
John Harrison <japh@in-ta.net> contributed an example for the documentation.
|
||||
|
||||
Martin Langhoff <martin@cwa.co.nz> contributed the ssh_cmd command, and
|
||||
Jeff Finucane <jeff@cmh.net> updated it and took care of the 0.04 release.
|
||||
|
||||
Anthony Awtrey <tony@awtrey.com> contributed a fix for those still using
|
||||
OpenSSH v1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2002 Ivan Kohler.
|
||||
Copyright (c) 2002 Freeside Internet Services, LLC
|
||||
All rights reserved.
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the same terms as Perl itself.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
Not OO.
|
||||
|
||||
Look at IPC::Session (also fsh)
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
For an all-perl implementation that does not require the system B<ssh> command,
|
||||
see L<Net::SSH::Perl> instead.
|
||||
|
||||
ssh-keygen(1), ssh(1), L<IO::File>, L<IPC::Open2>, L<IPC::Open3>
|
||||
|
||||
=cut
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user