是否有任何PERL模块可以将消息发送给Office Communicator?我在CPAN搜索,但没有运气。我可以使用Python或Ruby将消息发送给办公室通信者。我想从Linux盒子做到这一点。

有帮助吗?

解决方案

由于“ Office Communicator”正在使用SIP的修改版本,因此您可以尝试使用SIP客户端 net :: sip (或者 net :: sip ::简单 来自同一包)。

其他提示

我想一年多后您已经找到了解决方案,但是尽管如此,如果您只想发送SIP消息编写Perl程序,则可以查看这种方法: http://archive.cert.uni-stuttgart.de/bugtraq/2005/07/msg00276.html

可能的自定义:

#!/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;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top