Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal error during SIP auth #238

Open
IngLP opened this issue Dec 6, 2024 · 1 comment
Open

Internal error during SIP auth #238

IngLP opened this issue Dec 6, 2024 · 1 comment
Labels
bug Something isn't working SIP

Comments

@IngLP
Copy link

IngLP commented Dec 6, 2024

I am using livekit sip server to make outbound calls. It should call a FreePBX server.
All is going well, until an error is raised when parsing digest auth challenge.
I believe this is a sip server problem, since SIP messaging is correct.

These are SIP messages excanged:

[2024-12-06 18:13:54] VERBOSE[2102] res_pjsip_logger.c: <--- Received SIP request (792 bytes) from UDP:195.231.38.148:5060 --->
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 195.231.38.148:5060;branch=z9hG4bK.wiMNSQdfuXE3UNNY;alias
Content-Length: 292
To: <sip:[email protected]>
From: "544" <sip:[email protected]:5060>;tag=SCL_Eg8yhiyDTYts
Contact: <sip:[email protected]:5060>
Content-Type: application/sdp
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Call-ID: b4be7c1e-e017-459b-a1a6-2a79d8a2210e
CSeq: 1 INVITE
Max-Forwards: 70

v=0
o=- 12272812632277277963 12272812632277277963 IN IP4 195.231.38.148
s=LiveKit
c=IN IP4 195.231.38.148
t=0 0
m=audio 14455 RTP/AVP 9 0 8 101
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

[2024-12-06 18:13:54] VERBOSE[19222] res_pjsip_logger.c: <--- Transmitting SIP response (538 bytes) to UDP:195.231.38.148:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 195.231.38.148:5060;rport=5060;received=195.231.38.148;branch=z9hG4bK.wiMNSQdfuXE3UNNY;alias
Call-ID: b4be7c1e-e017-459b-a1a6-2a79d8a2210e
From: "544" <sip:[email protected]>;tag=SCL_Eg8yhiyDTYts
To: <sip:[email protected]>;tag=z9hG4bK.wiMNSQdfuXE3UNNY
CSeq: 1 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1733505234/9bd0eb00793c97491d7e9def3a6d194d",opaque="28a2c55f561e39e5",algorithm=md5,qop="auth"
Server: FPBX-14.0.17(13.18.3)
Content-Length: 0


[2024-12-06 18:13:54] VERBOSE[2102] res_pjsip_logger.c: <--- Received SIP request (407 bytes) from UDP:195.231.38.148:5060 --->
ACK sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 195.231.38.148:5060;alias;branch=z9hG4bK.wiMNSQdfuXE3UNNY
Max-Forwards: 70
From: "544" <sip:[email protected]:5060>;tag=SCL_Eg8yhiyDTYts
To: <sip:[email protected]>;tag=z9hG4bK.wiMNSQdfuXE3UNNY
Call-ID: b4be7c1e-e017-459b-a1a6-2a79d8a2210e
CSeq: 1 ACK
Contact: <sip:[email protected]:5060>
Content-Length: 0

Now, an authenticated invite should come, but it never arrives. the sip server had a problem:

sip-1  | 2024-12-06T17:13:54.809Z	INFO	sip	sip/client.go:196	Creating SIP participant	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876"}
sip-1  | 2024-12-06T17:13:54.891Z	INFO	sip	[email protected]/localparticipant.go:123	published track	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876", "name": "sip-320out", "source": "MICROPHONE", "trackID": "TR_AMH3qSm75EXRDZ"}
sip-1  | 2024-12-06T17:13:54.953Z	INFO	sip	sip/outbound.go:392	SIP invite failed	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876", "error": "param: expected '=', got  "}
sip-1  | 2024-12-06T17:13:54.954Z	WARN	sip	sip/outbound.go:174	Closing outbound call with error	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876", "reason": "invite-failed"}
sip-1  | 2024-12-06T17:13:54.954Z	INFO	sip	sip/outbound.go:129	SIP call failed	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876", "error": "update SIP failed: param: expected '=', got  "}
sip-1  | 2024-12-06T17:13:55.042Z	ERROR	sip	[email protected]/transport.go:410	could not negotiate	{"nodeID": "NE_QBH9LLVYcJpz", "sipTrunk": "ST_xogGgxaXHyCW", "callID": "SCL_Eg8yhiyDTYts", "room": "my-sip-room", "participant": "sip-320out", "participantName": "Test Call", "fromHost": "", "fromUser": "544", "toHost": "pbx.myhost.eu", "toUser": "876", "error": "InvalidStateError: connection closed"}
sip-1  | github.com/livekit/server-sdk-go/v2.(*PCTransport).createAndSendOffer
sip-1  | 	/go/pkg/mod/github.com/livekit/server-sdk-go/[email protected]/transport.go:410
sip-1  | github.com/livekit/server-sdk-go/v2.(*LocalParticipant).PublishTrack.(*PCTransport).Negotiate.func1
sip-1  | 	/go/pkg/mod/github.com/livekit/server-sdk-go/[email protected]/transport.go:373

this is a parser error, occurring here https://github.com/icholy/digest/blob/f2e2eb0db70aa325b748c85418db1da76b4deebc/internal/param/param.go#L90

but it really doesn't make sense, since the auth header sent by freepbx is perfectly fine.

Can you help me?

@IngLP IngLP changed the title Error while authenticating Internal error during SIP auth Dec 6, 2024
@dennwc
Copy link
Contributor

dennwc commented Dec 7, 2024

Could you try with the change from this PR?

@linear linear bot added bug Something isn't working SIP labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SIP
Projects
None yet
Development

No branches or pull requests

2 participants