| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SMS::Send::Orange::ContactEveryone; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12779
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
21
|
|
|
5
|
1
|
|
|
1
|
|
2
|
use Carp; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
63
|
|
|
6
|
1
|
|
|
1
|
|
671
|
use XML::Simple qw(XMLout); |
|
|
1
|
|
|
|
|
6291
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
1
|
|
|
1
|
|
609
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
31319
|
|
|
|
1
|
|
|
|
|
27
|
|
|
8
|
1
|
|
|
1
|
|
440
|
use HTTP::Request::Common; |
|
|
1
|
|
|
|
|
1476
|
|
|
|
1
|
|
|
|
|
70
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
11
|
1
|
|
|
1
|
|
5
|
use base 'SMS::Send::Driver'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
429
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use constant { |
|
14
|
1
|
|
|
|
|
327
|
SERVICE => 'https://www.api-contact-everyone.fr.orange-business.com/ContactEveryone/services/MultiDiffusionWS', |
|
15
|
|
|
|
|
|
|
SOAPACTION => 'MultiDiffusionWS' |
|
16
|
1
|
|
|
1
|
|
245
|
}; |
|
|
1
|
|
|
|
|
1
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
SMS::Send::Orange::ContactEveryone - SMS::Send driver to send messages |
|
21
|
|
|
|
|
|
|
via ContactEveryone (www.orange-business.com/fr/produits/contact-everyone). |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use SMS::Send; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Create a sender |
|
28
|
|
|
|
|
|
|
my $sender = SMS::Send->new('SMS::Send::Orange::ContactEveryone', |
|
29
|
|
|
|
|
|
|
ssl_opts => { |
|
30
|
|
|
|
|
|
|
verify_hostname => 0, |
|
31
|
|
|
|
|
|
|
SSL_verify_mode => 1, |
|
32
|
|
|
|
|
|
|
SSL_cert_file => "/path/to/cert.pem", |
|
33
|
|
|
|
|
|
|
SSL_key_file => "/path/to/cert.key" |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Send a message |
|
38
|
|
|
|
|
|
|
my $sent = $sender->send_sms( |
|
39
|
|
|
|
|
|
|
text => 'This is a test message', |
|
40
|
|
|
|
|
|
|
to => '+61*****20' |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 |
|
44
|
|
|
|
|
|
|
DESCRIPTION |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
SMS::Send::Orange::ContactEveryone - SMS::Send driver to send messages |
|
47
|
|
|
|
|
|
|
via ContactEveryone (www.orange-business.com/fr/produits/contact-everyone). |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This is not intended to be used directly, but instead called by SMS::Send |
|
50
|
|
|
|
|
|
|
(see synopsis above for a basic illustration, and see SMS::Send's documentation |
|
51
|
|
|
|
|
|
|
for further information). |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 METHODS |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=over 4 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item new |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Constructor, takes argument pairs passed by SMS::Send. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new { |
|
65
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#use Data::Dumper; |
|
68
|
|
|
|
|
|
|
#warn Data::Dumper::Dumper(\@_); |
|
69
|
|
|
|
|
|
|
my $userAgent = LWP::UserAgent->new( |
|
70
|
|
|
|
|
|
|
ssl_opts => $args{_ssl_opts} |
|
71
|
0
|
|
|
|
|
|
); |
|
72
|
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
my $self = bless { %args }, $class; |
|
74
|
0
|
|
|
|
|
|
$self->{ua} = $userAgent; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item send_sms |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Send the message - see SMS::Send for details. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub send_sms { |
|
86
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $message = $self->xml_message(%args); |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $request = HTTP::Request->new(POST => SERVICE); |
|
91
|
0
|
|
|
|
|
|
$request->header(SOAPAction => SOAPACTION); |
|
92
|
0
|
|
|
|
|
|
$request->content_type("text/xml; charset=utf-8"); |
|
93
|
0
|
|
|
|
|
|
$request->content($message); |
|
94
|
0
|
|
|
|
|
|
my $response = $self->{ua}->request($request); |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
if($response->code == 200) { |
|
97
|
0
|
|
|
|
|
|
return 1; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
else { |
|
100
|
0
|
|
|
|
|
|
Carp::croak($response->decoded_content); |
|
101
|
0
|
|
|
|
|
|
return 0; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item xml_message |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Build XML message to be sent to ContactEveryone. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub xml_message { |
|
112
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $envelope = { |
|
115
|
|
|
|
|
|
|
"xmlns:SOAP-ENV" => "http://schemas.xmlsoap.org/soap/envelope/", |
|
116
|
|
|
|
|
|
|
"xmlns:apachesoap" => "http://xml.apache.org/xml-soap", |
|
117
|
|
|
|
|
|
|
"xmlns:impl" => "MultiDiffusionWS", |
|
118
|
|
|
|
|
|
|
"xmlns:intf" => "MultiDiffusionWS", |
|
119
|
|
|
|
|
|
|
"xmlns:wsdl" => "http://schemas.xmlsoap.org/wsdl/", |
|
120
|
|
|
|
|
|
|
"xmlns:wsdlsoap" => "http://schemas.xmlsoap.org/wsdl/soap/", |
|
121
|
|
|
|
|
|
|
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema", |
|
122
|
|
|
|
|
|
|
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", |
|
123
|
|
|
|
|
|
|
"SOAP-ENV:Body" => [ |
|
124
|
|
|
|
|
|
|
] |
|
125
|
|
|
|
|
|
|
}; |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
0
|
|
|
|
$args{dest_name} ||= 'Unknown'; |
|
128
|
0
|
|
0
|
|
|
|
$args{dest_forname} ||= ''; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
my $profile = ' |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
' . $args{dest_name} .' |
|
134
|
|
|
|
|
|
|
' . $args{dest_forname} . ' |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
personnal_mobile |
|
138
|
0
|
|
|
|
|
|
' . $args{to} . ' |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sms |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
'; |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
my $body = { |
|
148
|
|
|
|
|
|
|
"intf:sendMessage" => [ |
|
149
|
|
|
|
|
|
|
{ |
|
150
|
|
|
|
|
|
|
"xmlns:intf" => "MultiDiffusionWS", |
|
151
|
|
|
|
|
|
|
"intf:wsMessage" => [ |
|
152
|
|
|
|
|
|
|
{ |
|
153
|
0
|
|
|
|
|
|
"intf:resumeContent" => [ $args{text} ], |
|
154
|
|
|
|
|
|
|
"intf:custId" => [ 'mediatheque_de_digne' ], |
|
155
|
|
|
|
|
|
|
"intf:sendProfiles" => [ $profile ], |
|
156
|
|
|
|
|
|
|
"intf:strategy" => [ 'sms' ] |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
] |
|
159
|
|
|
|
|
|
|
} |
|
160
|
|
|
|
|
|
|
] |
|
161
|
|
|
|
|
|
|
}; |
|
162
|
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
|
push @{ $envelope->{"SOAP-ENV:Body"} }, $body; |
|
|
0
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
return XMLout($envelope, RootName => "SOAP-ENV:Envelope" ); |
|
166
|
|
|
|
|
|
|
} |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=back |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Alex Arnaud, Egg.alexarnaud@gmail.comE |