emiago / sipgox

Extra libs for sipgo
BSD 2-Clause "Simplified" License
62 stars 8 forks source link

Problems with registration on 3CX (407 errors) #8

Closed simobgl closed 7 months ago

simobgl commented 7 months ago

Hi, I'm trying to register to a 3CX cloud PBX, but I got multiple 407 errors. I've modified the example code for the registration to deal with 407 (401 was present already) thus fetching the correct header, but I still got a 407 response. I've noticed that the CSeq is the same (the req is cloned) but every req should have an incremented seq#. Might this be the cause of the error?

emiago commented 7 months ago

Hi @simobgl as I am not sure how much current example is updated. Can you instead try below

Here a non working snippet, but you will get it working:

username:= ...
password:=....
ua, _ := sipgo.NewUA(
        sipgo.WithUserAgent(username),
)
phone := sipgox.NewPhone(ua)
err = phone.Register(regCtx, sip.Uri{User: username, Host: pbxhost, Port: pbxport}, sipgox.RegisterOptions{
            Username: username, 
            Password: password,
            Expiry:   int(registerExpiry.Seconds()),
})
emiago commented 7 months ago

aah 407. I know what you need. Let me also update sipgox. It is proxy auth probably.

emiago commented 7 months ago

HI @simobgl ok I have updated sipgox. SO that above code should work in your case. If auth is correct you should get different response

simobgl commented 7 months ago

Thank you, it looks like it's registering correctly now. Now I'm about to try to understand how to wait for calls, respond, and get audio from the codec.

simobgl commented 7 months ago

I'm working on a paid project and I have some budget for consultancy. Are you interested?

emiago commented 7 months ago

@simobgl pls contact me over email. emirfreelance91@gmail.com