rtckit / php-sip Goto Github PK
View Code? Open in Web Editor NEW:phone: SIP Parsing/Rendering Library for PHP
License: MIT License
:phone: SIP Parsing/Rendering Library for PHP
License: MIT License
Hello,
I m newbie with sip and have a question.
I read the readme and think the anwser to my question is yes but i have to be sure.
For what i understand the documentation part for my use case is "SIP Message Rendering" and i guess "SIP Message Parsing" to be sure everything run smothly (aka : following protocol) ?
Thx for your time
A Contact: header in a response to REGISTER request may contain one or more values separated by commas, like this:
Contact: <sip:[email protected]:55497;transport=tls>;expires=111;received="sip:[email protected]:55497";reg-id=1;+sip.instance="<d79966b435633699badcf12507380d51d4e97eab>",<sip:[email protected]:17127;transport=tls>;expires=258;received="sip:[email protected]:17127";reg-id=2;+sip.instance="<65be01c100f2ccd762df61057569f037bd46a367>"
This actually happens in practice if the indicated user is registered from multiple devices.
The StreamParser, as of version 0.7.0., does not anticipate this possibility and will enter an infinite loop in some cases. The main problem seems to be that the method
ContactHeader.parse(array $hbody)
receives only an array of count 1, while it should receive an array of count N, exploded by the delimiter ,.
I made a crude and ugly fix in ContactHeader.parse like this:
public static function parse(array $hbody): ContactHeader
{
$ret = new static;
$hbody2 = array();
foreach ($hbody as $hline) {
$explodedLine = explode(',', $hline);
$hbody2 = array_merge($hbody2, $explodedLine);
}
$hbody = $hbody2;
It works, but it is also very ugly. I suppose that the original author has a better solution.
AFAIK, in case of SIP, if a header contains commas, it is as if the same header was present multiple times, so
Contact: XX,YY
is equivalent to
Contact: XX
Contact: YY
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.