Compare messages of SIP and PJSIP

Hi,
I am having the following problem:
Provider (client) send OPTION to Asterisk1.8 and Asterisk16 with the same format:
And response of Asterisk1.8 is different from response of Asterisk16. My provider tell to me that. The format of response of Asterisk1.8 is OK, and of Asterisk16 is not OK.
Any body can help me compare and declare response on PSIP is the same SIP.
(I see the different. With response of Asterisk16 do not have port in uri)

This is response of Asterisk1.8:

<--- Transmitting (no NAT) to 10.226.4.10:5099 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 10.226.4.10:5099;branch=z9hG4bKpujuj8dvwxipoftxo6nfxd7do;X-DispMsg=1409;received=10.226.4.10
**From: <sip:10.226.4.10:5060>;tag=7t8nox6p-CC-1004-OFC-13**
**To: <sip:10.226.39.51:5060>;tag=as24ba201b**
Call-ID: p7uwfwoo6opfwxuo674fxd46ntxx4xvd@10.18.5.64
CSeq: 1 OPTIONS
Server: Asterisk PBX 1.8.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Accept: application/sdp
Content-Length: 0

This is response of Asterisk16:

<--- Transmitting SIP response (846 bytes) to UDP:10.226.2.2:5065 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.226.2.2:5065;received=10.226.2.2;branch=z9hG4bK8du9g9r8satiiu8o191didkto;X-DispMsg=1400
Call-ID: dqdd3d1dntd33dk1t8k9do1taaktsi18@10.18.5.64
**From: <sip:10.226.2.2>;tag=3rtatdd1-CC-1003-OFC-11**
**To: <sip:10.226.39.49>;tag=z9hG4bK8du9g9r8satiiu8o191didkto**
CSeq: 1 OPTIONS
Accept: application/simple-message-summary, application/xpidf+xml, application/cpim-pidf+xml, application/pidf+xml, application/dialog-info+xml, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: identity
Accept-Language: en
Server: Asterisk PBX 16.20.0
Content-Length:  0

This is my endpoint:

[10-226-2-2]
type=endpoint
transport=transport-udp
context=from_trunk_GMSC
disallow=all
allow=ulaw
allow=alaw
allow=g726
allow=h263
aors=10-226-2-2


from_domain=10.226.39.49:5060
from_user=199

send_rpid=yes

rtp_symmetric=no
force_rport=no
rewrite_contact=yes

Both replies are OK, as OPTION request should be treated as normal INVITE

11.2 Processing of OPTIONS Request The response to an OPTIONS is constructed using the standard rules for a SIP response as discussed in Section 8.2.6. The response code chosen MUST be the same that would have been chosen had the request been an INVITE. That is, a 200 (OK) would be returned if the UAS is ready to accept a call, a 486 (Busy Here) would be returned if the UAS is busy, etc. This allows an OPTIONS request to be used to determine the basic state of a UAS, which can be an indication of whether the UAS will accept an INVITE request.

So what it is exactly the issue ?

Thanks Mr ambiarixg12,

I am using asterisk16.
With the same OPTION from my Provider send to my Asterisk16.
If i endable SIP then asterisk return:


<--- Transmitting (no NAT) to 10.226.2.10:5066 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.226.2.10:5066;branch=z9hG4bK8t81sgaqqnsrosg3t18i8dio9;X-DispMsg=1401;received=10.226.2.10
From: <sip:10.226.2.10:5060>;tag=antdgtd8-CC-1003-OFC-12
To: <sip:10.226.39.49:5060>;tag=as79fd5bc1
Call-ID: ntqun9qrk9dtr83ni93gn3tutno1gdnt@10.18.5.64
CSeq: 1 OPTIONS
Server: Asterisk PBX 16.20.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:10.226.39.49:5060>
Accept: application/sdp
Content-Length: 0

And if i enable PJSIP then my asterisk16 will return:

<--- Transmitting SIP response (846 bytes) to UDP:10.226.2.2:5065 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.226.2.2:5065;received=10.226.2.2;branch=z9hG4bK8du9g9r8satiiu8o191didkto;X-DispMsg=1400
Call-ID: dqdd3d1dntd33dk1t8k9do1taaktsi18@10.18.5.64
**From: <sip:10.226.2.2>;tag=3rtatdd1-CC-1003-OFC-11**
**To: <sip:10.226.39.49>;tag=z9hG4bK8du9g9r8satiiu8o191didkto**
CSeq: 1 OPTIONS
Accept: application/simple-message-summary, application/xpidf+xml, application/cpim-pidf+xml, application/pidf+xml, application/dialog-info+xml, application/pidf+xml, application/dialog-info+xml, application/simple-message-summary, application/sdp, message/sipfrag;version=2.0
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Accept-Encoding: identity
Accept-Language: en
Server: Asterisk PBX 16.20.0
Content-Length:  0

My Provider accept response of SIP format. They tell to me that, when i response with PJSIP format then their system warning LinkSip to down (in their system) and LinkSip Up with SIP format response.
I dont know. If i want to use PJSIP then what i must to do?

Thanks,

What header in your reply is causing this ?

Dear Mr,
my provider do not tell to me that, why their system accept SIP response and do not accept PJSIP response. I think it are the same.

I like PJSIP but in this case i must using SIP

They should tell you what header active the warning, and from there we should see if there is a setting that can modify the information on this

Thanks for answer my question,
Operating staff in my provider don’t know. They only config on system.
My asterisk is working ok in inbound flowing via SIP(chan_sip). I am woriking for outbound via SIP.

Thanks Mr agian.

Do you actually need to test the connection with OPTIONS?

Hi Mr @david551 ,
I skipped check connection with OPTION and make a outbound with chan_sip(originate SIP/76689999@trunk_GMSC22). But the result is not good. I do not know in my provider mistake or my system mistake

This is config of peer

[trunk_GMSC22]
type=peer
host=10.226.2.2
;port=5060
domain=10.226.2.2
context=from_trunk_GMSC
qualify=no
nat=no
;keepalive=45
dtmfmode=rfc2833
disallow=all
allow=gsm
allow=alaw
allow=ulaw
canreinvite = no
insecure=port,invite

sendrpid = yes
fromdomain=10.226.39.49
fromuser=199
;usereqphone = yes
;transport = udp
session-timers=originate
session-expires=1800
session-minse=90
session-refresher=uac

And this is log of debug

localhost*CLI>
  == Setting global variable 'QUEUE_OUTBOUND' to 'ADVERTISE'
  == Setting global variable 'params' to '1_1_75666668_1_199_ADVERTISE_5'
  == Using SIP RTP CoS mark 5
Audio is at 22134
Adding codec gsm to SDP
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 10.226.2.2:5060:
INVITE sip:75666668@10.226.2.2 SIP/2.0
Via: SIP/2.0/UDP 10.226.39.49:5060;branch=z9hG4bK3e5d74f1
Max-Forwards: 70
From: "Test" <sip:199@10.226.39.49>;tag=as0cbda2aa
To: <sip:75666668@10.226.2.2>
Contact: <sip:199@10.226.39.49:5060>
Call-ID: 3488484c3abf77d059fd4986571bce26@10.226.39.49
CSeq: 102 INVITE
User-Agent: Asterisk PBX 16.20.0
Date: Mon, 06 Sep 2021 15:20:37 GMT
Session-Expires: 1800
Min-SE: 90
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Remote-Party-ID: "Test" <sip:199@10.226.39.49>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 285

v=0
o=root 772362562 772362562 IN IP4 10.226.39.49
s=Asterisk PBX 16.20.0
c=IN IP4 10.226.39.49
t=0 0
m=audio 22134 RTP/AVP 3 8 0 101
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

---
    -- Called 75666668@trunk_GMSC22

<--- SIP read from UDP:10.226.2.2:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.226.39.49:5060;branch=z9hG4bK3e5d74f1
Call-ID: 3488484c3abf77d059fd4986571bce26@10.226.39.49
From: "Test"<sip:199@10.226.39.49>;tag=as0cbda2aa
To: <sip:75666668@10.226.2.2>
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---

<--- SIP read from UDP:10.226.2.2:5060 --->
SIP/2.0 500 Server Internal Error
Via: SIP/2.0/UDP 10.226.39.49:5060;branch=z9hG4bK3e5d74f1
Call-ID: 3488484c3abf77d059fd4986571bce26@10.226.39.49
From: "Test"<sip:199@10.226.39.49>;tag=as0cbda2aa
To: <sip:75666668@10.226.2.2>;tag=6zwgu0y6
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
    -- Got SIP response 500 "Server Internal Error" back from 10.226.2.2:5060
Transmitting (no NAT) to 10.226.2.2:5060:
ACK sip:75666668@10.226.2.2 SIP/2.0
Via: SIP/2.0/UDP 10.226.39.49:5060;branch=z9hG4bK3e5d74f1
Max-Forwards: 70
From: "Test" <sip:199@10.226.39.49>;tag=as0cbda2aa
To: <sip:75666668@10.226.2.2>;tag=6zwgu0y6
Contact: <sip:199@10.226.39.49:5060>
Call-ID: 3488484c3abf77d059fd4986571bce26@10.226.39.49
CSeq: 102 ACK
User-Agent: Asterisk PBX 16.20.0
Content-Length: 0


---
    -- SIP/trunk_GMSC22-00000000 is circuit-busy
  == Setting global variable 'RESUL_OUTBOUND' to 'FALSE'

You need to address this error with 10.226.2.2 first

Thanks Mr,

That is error from my provider’s side and they are checking in their system.
I have say to them that when i send invite(outbond) to their system then i need to response 100 trying &180 ring &200 ok. It is the same
image

I am waiting respose from my provider with err

Just wait, because there is nothing you can’t do on your end to deal with a SIP 500 error returned by your provider

Thanks for reply,

I am waiting from my provider side to fix that err.

Hi Mr,

My provider just send to me a log SIP, that they have received from other outbound(this outboun is working )

[No.           ] 1723
[TimeStamp     ] 2021-09-14 21:25:51.610
[Msg Name      ] >INVITE
[Module No     ] 1400
[Local Address ] 10.226.2.2:5060
[Remote Address] 10.226.41.11:11000
[Ticks         ] 
[Call-ID       ] 484a0834-73a8-4804-b0b1-2a66fc154c56
[Hex Msg       ] 49 4E 56 49 54 45 20 73 69 70 3A 37 36 36 38 39 39 39 39 40 ...


INVITE sip:76689999@10.226.2.2 SIP/2.0
Via: SIP/2.0/UDP 10.226.41.11:11000;rport;branch=z9hG4bKrFScQ3gp8Z08g
Max-Forwards: 49
From: "Zenilton M M Soares" <sip:186@10.226.41.11>;tag=XB2QtZgNZ3pcg
To: <sip:76689999@10.226.2.2>
Call-ID: 484a0834-73a8-4804-b0b1-2a66fc154c56
CSeq: 41257383 INVITE
Contact: <sip:mod_sofia@10.226.41.11:11000>
User-Agent: 2600hz
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
Supported: path, replaces
Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 268
X-FS-Support: update_display,send_info
Remote-Party-ID: "Zenilton M M Soares" <sip:186@10.226.41.11>;party=calling;screen=yes;privacy=off

v=0
o=FreeSWITCH 1631605453 1631605454 IN IP4 10.226.41.11
s=FreeSWITCH
c=IN IP4 10.226.41.11
t=0 0
m=audio 16898 RTP/AVP 8 0 101 13
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:13 CN/8000
a=ptime:20

Can you help me detail about 11000 rport in the INVITE, that my provider have received.?
I thiks that port must 5060

Thanks.

That rport doesn’t need to be strictly 5060 unless your provider request it as mandatory, I assume that 10.226.41.11 is your Asterisk server IP, so if that is the case change the listening port for that particular channel driver if is pjsip or chan_sip

The purpose of a rport is

“rport”,

Thanks for your information,

I just test with my provider. I send an INVITE with:

INVITE sip:+67076689999@10.226.2.2 SIP/2.0
Via: SIP/2.0/UDP 10.226.39.49:5060;branch=z9hG4bK62ac808d
Max-Forwards: 70
From: "Test" <sip:199@10.226.39.49>;tag=as1ce98585
To: <sip:+67076689999@10.226.2.2>
Contact: <sip:199@10.226.39.49:5060>
Call-ID: 0813f7cc6360205e3066b15e14393e7e@10.226.39.49
CSeq: 102 INVITE
User-Agent: Asterisk PBX 16.20.0
Date: Wed, 15 Sep 2021 07:03:06 GMT
Session-Expires: 1800
Min-SE: 90
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Remote-Party-ID: "Test" <sip:199@10.226.39.49>;party=calling;privacy=off;screen=no
Content-Type: application/sdp
Content-Length: 287

But my provider received

SIP/2.0 500 Server Internal Error
Via: SIP/2.0/UDP 10.226.27.44:65476;branch=z9hG4bK15ab433b
Call-ID: 00c55ecd38ae782f6255d1f17ab980a4@10.226.39.49
From: "Test"<sip:199@10.226.27.44:65476>;tag=as2489ae02
To: <sip:+67076689999@10.226.2.2>;tag=cpwtpute
CSeq: 102 INVITE
Content-Length: 0

The IP have change: 10.226.39.49:5060 → 10.226.27.44:65476 (So their sysmte return to my asterisk 500 err)
They don’t know, and I am too.

Do you have any suggestions about this error?

Thanks.

I’m confused. I thought Asterisk always set rport. (force-rport is about pretending it was set in the inbound request, not about what is sent over the wire.)

Have you got application level gateway enabled on your router. That is a well known way of breaking things. What is 10.226.27.44?

I, eventually had to read this as “But my provider sent”.

Dear Mr,

10.226.27.44 is a node of firewall device.
my asterisk-UAC(10.226.39.49) —>Firewall (node: 10.226.27.44) → UAS(10.226.2.2)
That mean, my asterisk is located in the firewall, it has to go through the firewall device to get to uas

You are right, that is errcode, that my provider return to my asterisk when send INVITE.