odannyc / sipit
此包最新版本(v0.1)没有可用的许可证信息。
一个用于向野外公开的SIP设备发送OPTIONping的SIP库。
v0.1
2016-06-24 22:49 UTC
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-04 09:45:57 UTC
README
一个用于向野外公开的SIP设备发送OPTIONping的SIP库。SIP(会话初始化协议)是一种在VoIP通信中使用的协议,允许用户进行语音和视频通话。
use Sipit\SipitFactory as Sipit; $destination_ip = '192.168.1.100'; $destination_port = 5060; Sipit::ping($destination_ip, $destination_port);
摘要
Sipit是一个简单的SIP设备ping库。当你调用Sipit::ping()
方法时,它将返回一个包含请求和响应的信息数组。这有助于了解SIP服务器是否活跃。例如,如果你正在显示SIP服务器的状态,你可以使用这个方法进行检查。如果一个端点没有响应,它将返回一个空数组作为响应部分。
安装
安装此库的最佳方式是使用Composer。
composer require odannyc/sipit
或者
{ "require": { "odannyc/sipit": "*" } }
用法
目前Sipit只有一个方法,即pingSIP设备,未来我计划添加更多。使用Sipit的一个简单方法是ping方法
use sipit\SipitFactory as Sipit; Sipit::ping('192.168.1.10', 5060);
响应将看起来像这样
Array ( [request_full] => Array ( [OPTIONS sip] => OPTIONS sip:192.168.1.10:5060 SIP/2.0 [Via] => Via: SIP/2.0/UDP 192.168.1.121:5090;rport;branch=z9hG4bK572601 [From] => From: <sip:ping@sipit.com>;tag=10877 [To] => To: <sip:192.168.1.10:5060> [Call-ID] => Call-ID: callid:1d6a6668d796af55d63b1c712602c34b;@192.168.1.121 [CSeq] => CSeq: 20 OPTIONS [Contact] => Contact: <sip:ping@192.168.1.121:5090> [Max-Forwards] => Max-Forwards: 70 [User-Agent] => User-Agent: SIPIT [Content-Length] => Content-Length: 0 ) [response_code] => 403 [response_message] => Forbidden [response_concat] => 403 Forbidden [response_full] => Array ( [SIP/2.0 403 Forbidden] => SIP/2.0 403 Forbidden [Via] => Via: SIP/2.0/UDP 192.168.1.121:5090;received=192.168.1.121;branch=z9hG4bK572601;rport=5090 [From] => From: <sip:ping@sipit.com>;tag=10877 [To] => To: <sip:192.168.1.10:5060>;tag=aprqngfrt-qra2n33000081 [Call-ID] => Call-ID: callid:1d6a6668d796af55d63b1c712602c34b;@192.168.1.121 [CSeq] => CSeq: 20 OPTIONS ) )