Is there any Perl Module available to send messages to Office Communicator?
-
08-10-2019 - |
Question
Is there any Perl module available to send messages to Office Communicator? I searched in CPAN but without any luck. Can I use Python or Ruby to send messages to Office Communicator. I want to do this from a Linux Box.
Solution
As "Office Communicator" is using a modified version of SIP, you can try using SIP clients like Net::SIP (or Net::SIP::Simple from same package).
OTHER TIPS
I guess you'll have found a solution after more than a year, but nonetheless, if you just want to send a SIP message writing a perl program, you can have a look at this approach: http://archive.cert.uni-stuttgart.de/bugtraq/2005/07/msg00276.html
A possible customization:
#!/usr/bin/perl
use strict;
use warnings;
use Socket;
sub SendSIPTo {
my ($from, $to, $text, $ProxyIP) = @_;
my $contentLength = length($text);
my $AT = '@';
my $domain = 'example.com';
my $ToURI = 'sip:' . $to . $AT . $domain;
my $FromURI = 'sip:' . $from . $AT . $domain;
my $MESG = "MESSAGE $ToURI SIP\/2.0\r
Via: SIP/2.0/UDP 10.10.10.10;branch=z9hG4bK8fe6.db5fade4.0\r
To: $ToURI\r
From: <$FromURI>;tag=578c0e59d7504cca4dc4a96522981b0a-0c8b\r
CSeq: 1 MESSAGE\r
Call-ID: 609ded3a79a9cbd5\r
Content-Length: $contentLength\r
User-Agent: perl\r
\r
" . $text;
my $proto = getprotobyname('udp');
socket(SOCKET, PF_INET, SOCK_DGRAM, $proto) ;
my $iaddr = inet_aton("0.0.0.0");
my $paddr = sockaddr_in(5060, $iaddr);
bind(SOCKET, $paddr) ;
my $port = 5060;
my $hisiaddr = inet_aton($ProxyIP) ;
my $hispaddr = sockaddr_in($port, $hisiaddr);
send(SOCKET, $MESG, 0, $hispaddr ) || warn "send $!\n";
return 'OK';
}
1;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow