PJSIP syntax error exception when parsing 'Via' header on line 2 col 34 How can ı fix this?

[2019-10-19 11:54:52] ERROR[8980] pjproject: sip_transport.c Error processing 420 bytes packet from UDP : PJSIP syntax error exception when parsing ‘Via’ header on line 2 col 34:
SIP/2.0 200 Keepalive
Via: SIP/2.0/UDP;rport=23842;branch=z9hG4bKPj95d08c5f-9367-45a9-aafc-f95703f79245;received=
From: <sip:[email protected]>;tag=e9c8ee7f-38a4-4761-b4b9-3af1dc7ad799
To: <sip:>;tag=89757bbff68d7d0abdeaa0f6fc52d389.06aa
Call-ID: 126a39c5-e6a6-4f02-8e6b-7615a9272bed
CSeq: 13177 OPTIONS
Server: kamailio (4.3.7 (x86_64/linux))
Content-Length: 0

I made some reseach but couldnt find any solution.why I getting this

I saw that someone in this forum have same error and nobody answer as well
anyone know why ı getting that error?

It is objecting to seeing a port number attached to the rport parameter, but, as far as I can see that is normal behaviour for a UAS that has received a request with rport set. The UAC, which is Asterisk in this example, should be throwing away that Via header. Character 34 is the “=” character, after rport.

This is clearly a NAT case. Could you check the Contact header on the request and make sure that is the 94… address. If not, adjusting your information about local networks and public addresses might just help.

İ try to do interconnect with other server but they said my server doesn’t reply and send me this

Timestamp: 2019-10-19 13:47:44
From IP: udp:
To IP: udp:
Method: INVITE
From tag: as2f8d8e97
To tag:

INVITE sip:[email protected] SIP/2.0
Record-Route: sip:;lr=on;did=7e3.72e1
Via: SIP/2.0/UDP;branch=z9hG4bK7b21.da277d8c29ae2975c48165f6b9a42285.0
Via: SIP/2.0/UDP;branch=z9hG4bK3310565f
Max-Forwards: 69
From: sip:[email protected];tag=as2f8d8e97
To: sip:[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: kamailio
Date: Sat, 19 Oct 2019 11:47:44 GMT
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 309

o=root 495144055 495144055 IN IP4
c=IN IP4
t=0 0
m=audio 44556 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

Timestamp: 2019-10-19 13:48:03
From IP: udp:
To IP: udp:
Method: CANCEL
From tag: as2f8d8e97
To tag:

CANCEL sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK3310565f
Max-Forwards: 70
From: sip:[email protected];tag=as2f8d8e97
To: sip:[email protected]
Call-ID: [email protected]:5060
CSeq: 102 CANCEL
User-Agent: kamailio
Content-Length: 0

That’s invalid. There’s two ports there, when there should be one, so the parser doesn’t like it. Are you behind a SIP ALG or something?

How can I fix this two port issue?

This would be a problem. You have the port appended twice on the IP in the VIA header. That’s wrong.

There is no evidence that the two ports problem originated on the Asterisk side. Unless you can show a request from Asterisk containing the same error, you will need to fix it on the other side.

Please provide the OPTIONS request that produced the problem response.

Im confused a bit.
ıs the two port problem or not?

It is a problem. It is invalid. It is in the received packet so something has altered it. The other case I’ve seen something similar it was a poorly written SIP ALG in a router.

1 Like

I changed my port to 5060
what should ı do for sıp alg issue?

The preferred solution to SIP ALG problems is to disable it the router and make sure you are properly configured for NAT in Asterisk (i.e. you have set the public address and declared your local networks).

The alternative is to change to a router that doesn’t have the problem.

after ı changed my port to 5060
ı see that problem now
[2019-10-19 15:18:21] ERROR[46205] res_pjsip.c: Error 171065 ‘Transport not available for use (PJSIP_ETPNOTAVAIL)’ sending OPTIONS request to endpoint hello

all ım tryna do is getting a phone number from eurocall24.com which is a premium rate number service.
I want to build my own conference sytem or something

Signaling port 5060:
Traffic will come from IP and
Media port 10000-20000: and

this is the other suppliers info and ı created chanpjsıp for connect the number
ı setup the income route to terminate call
ı connected the number supplier and they said my server doesnt reply

Right now this is looking like your Kamailio is configured wrong. You need to look there.

Sorry, I regret replying here and have withdrawn my questions. You were already given correct answers and now you’re just trying random stuff, which is just frustrating to all who try to help.

Im newbie and ı wasnt try frustrating anybody

Nobody said to change your port. Now you made your problem worse.

Change it back, and then carefully investigate your router which is what has already been suggested.

you know denzel washington have a line
tell me like I am 6 years old