Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否有任何Perl模块可用于向Office Communicator发送消息?_Perl_Sip_Office Communicator - Fatal编程技术网

是否有任何Perl模块可用于向Office Communicator发送消息?

是否有任何Perl模块可用于向Office Communicator发送消息?,perl,sip,office-communicator,Perl,Sip,Office Communicator,是否有任何Perl模块可用于向Office Communicator发送消息? 我在CPAN搜索过,但没有任何运气。 我可以使用Python或Ruby向Office Communicator发送消息吗。 我想在Linux机器上实现这一点。由于“Office Communicator”使用的是经过修改的SIP版本,您可以尝试使用类似于(或来自同一软件包)的SIP客户端。我想您在一年多后会找到解决方案,但尽管如此,如果您只想通过编写perl程序发送SIP消息,您可以看看这种方法: 可能的定制: #!

是否有任何Perl模块可用于向Office Communicator发送消息? 我在CPAN搜索过,但没有任何运气。 我可以使用Python或Ruby向Office Communicator发送消息吗。
我想在Linux机器上实现这一点。

由于“Office Communicator”使用的是经过修改的SIP版本,您可以尝试使用类似于(或来自同一软件包)的SIP客户端。

我想您在一年多后会找到解决方案,但尽管如此,如果您只想通过编写perl程序发送SIP消息,您可以看看这种方法:

可能的定制:

#!/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;
#/usr/bin/perl
严格使用;
使用警告;
使用插座;
森西普托分公司{
my($from,$to,$text,$ProxyIP)=@;
my$contentLength=长度($text);
我的$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\n
Via:SIP/2.0/UDP 10.10.10.10;branch=z9hG4bK8fe6.db5fade4.0\r\n
到:$ToURI\r\n
发件人:;标记=578c0e59d7504cca4dc4a96522981b0a-0c8b\r\n
CSeq:1条消息\r\n
呼叫ID:609ded3a79a9cbd5\r\n
内容长度:$contentLength\r\n
用户代理:perl\r\n
\r
“$文本;
my$proto=getprotobyname('udp');
插座(插座、PF_INET、SOCK_DGRAM、$proto);
我的$iaddr=inet_aton(“0.0.0.0”);
my$paddr=sockaddr_in(5060,$iaddr);
绑定(套接字,$paddr);
我的$port=5060;
我的$hisiaddr=inet_aton($ProxyIP);
我的$hispaddr=sockaddr_in($port,$hisiaddr);
发送(套接字,$MESG,0,$hispardr)| |警告“发送$!\n”;
返回“OK”;
}
1.