Giter VIP home page Giter VIP logo

php-sip's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

php-sip's Issues

Question

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.

  • Can i make a phone ringing and display (on the phone) a custom message.

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

StreamParser hangs when processing a Contact line with multiple bindings

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.