pyVoIP icon indicating copy to clipboard operation
pyVoIP copied to clipboard

Fix issue #167

Open obrain17 opened this issue 2 years ago • 3 comments

Fix issue #167 phone.call() function does't work on Fritz!Box.

This PR only contains the 3 lines for the basic fix, so the Fritz!Box will accept the Invite. Other stuff in connection with the Fritz!Box (see zip-file attached to #167) I am considering to suggest with further PRs, following the guideline to do only small fixes per PR.

What is done?

  • Change the branch id after the Unauthorized response. Fritz!Box appearently needs this.
  • I have been using this for some years in my own C++ SIP library.
  • German Softphone for Windows PhonerLite is doing this as well.

obrain17 avatar Feb 20 '24 16:02 obrain17

I am currently investigating the same issue as I've also encountered it while trying to perform a INVITE request using FritzBox as server. Upon sending the INVITE request I get a 401 as response. From successful attempts with pjsip I know that the first invite usually fails but the next one will include the required auth header(s). This second attempt is missing with pyVoIP and thus the target phone won't ring.

Applying the changes proposed here resolve that issue so long story short: +1 on this one!

fussel132 avatar Feb 23 '24 22:02 fussel132

@fussel132 The "second attempt" as you call it, containing the authentication, has been done at line 1643 also before. But with the lines added by the PR it uses a new branch id and thus is recognized by the Fritz!Box server as a new invite.

            branch = branch[0:hexindex] + f'{hexdigit:x}' + branch[hexindex+1:]

            invite = self.gen_invite(
                number, str(sess_id), ms, sendtype, branch, call_id
            )

So the issue is resolved and the Fritz!Box makes the phone ring.

obrain17 avatar Feb 24 '24 08:02 obrain17

Uh oh okay my bad. Have not created a WireShark capture with pyVoIP and just assumed it to be the same issue as I had with pjsip before.

Thanks and sorry 🙈

fussel132 avatar Feb 24 '24 10:02 fussel132