Hello,
I have Asterisk 15.1.2 server with pjsip stack and Kamailio SIP proxy (with very simple configuration only relay all to asterisk).
$du = “sip:“asterisk-ip”:5566;transport=tcp”; this is Kamailio configuration
My endpoints are "realtime: from Postgresql database:
id | transport | aors | auth | context | disallow | allow | direct_media |
71010 | transport-tcp | 71010 | 71010 | simple-pjsip | all | g722,ulaw,alaw,ilbc | no
And transport-tcp is:
[transport-tcp]
type = transport
protocol = tcp
bind = 0.0.0.0:5566
When client (71010) send SIP SUBSCRIBE to asterisk server (10.0.3.144):
SUBSCRIBE sip:71010@10.0.6.123:5566;transport=tcp SIP/2.0
Record-Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=52917bb71da8456a9471e5a20800f492>
Via: SIP/2.0/TCP 10.0.6.123:5566;branch=z9hG4bKe1d9.9f288534c48b91828f353ef2a15d1214.0;i=83
Via: SIP/2.0/TCP 10.0.8.249:51287;received=10.0.8.249;rport=51287;branch=z9hG4bKPj2cd56d39022a4ef6a2afe6e33ec5fb5e;alias
Max-Forwards: 69
From: <sip:61010@10.0.6.123>;tag=52917bb71da8456a9471e5a20800f492
To: <sip:71010@10.0.6.123>
Contact: <sip:61010@10.0.8.249:51287;transport=TCP;ob>
Call-ID: 6f2503cb7d31430f9ee2b95fa7114f22
CSeq: 26141 SUBSCRIBE
Event: presence
Expires: 600
Supported: replaces, 100rel, timer, norefersub
Accept: application/pidf+xml, application/xpidf+xml
Allow-Events: presence, message-summary, refer
User-Agent: MicroSIP/3.18.2
Content-Length: 0
Receive back only first NOTIFY:
NOTIFY sip:61010@10.0.8.249:51287;transport=TCP;ob SIP/2.0
Via: SIP/2.0/TCP 10.0.3.144:5566;rport;branch=z9hG4bKPj8e4471c0-c28f-4dec-8e8e-d2430ac725f3;alias
From: <sip:71010@10.0.6.123>;tag=b399ef59-1af2-4d86-aba8-6fbf50ea2d87
To: <sip:61010@10.0.6.123>;tag=cc062e3ea1714e1b9113d0ce4b03e340
Contact: <sip:10.0.3.144:5566;transport=TCP>
Call-ID: b6d4ab392c8341cfadac37f9ef70e9dc
CSeq: 9659 NOTIFY
Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=cc062e3ea1714e1b9113d0ce4b03e340>
Event: presence
Subscription-State: active;expires=595
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk PBX 15.1.2
Content-Type: application/pidf+xml
Content-Length: 498
<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:71010@10.0.3.144:60651;transport=TCP" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid">
<note>Ready</note>
<tuple id="71010">
<status>
<basic>open</basic>
</status>
<contact priority="1"><sip:61010@10.0.6.123></contact>
</tuple>
<dm:person>
<rpid:activities>
<rpid:on-the-phone />
</rpid:activities>
</dm:person>
</presence>
But after that, the following NOTIFY messages are without “transport=TCP” and Kamailio try to reach user from R-URI but
without “transport=TCP” so Kamailio assumed that is UDP.
How can I force asterisk always set “transport=TCP” in NOTIFY
jcolp
April 4, 2018, 3:57pm
2
It should continue to use the same. Do you have the other packets as well?
Hello,
Thank you for a quick response. Yes, I have call trace (I can’t upload files ) but I removed “unnecessary” SIP packets. (if necessary, I can upload file somewhere else and paste a link here)
<--- Received SIP request (1174 bytes) from TCP:10.0.6.123:5566 --->
SUBSCRIBE sip:71010@10.0.6.123:5566;transport=tcp SIP/2.0
Record-Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=-8930831>
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
CSeq: 3 SUBSCRIBE
From: <sip:61010@10.0.6.123:5566>;tag=-8930831
To: <sip:71010@10.0.6.123:5566>
Via: SIP/2.0/TCP 10.0.6.123:5566;branch=z9hG4bKb035.7a8175783d9bd2caa9f39469ef165eff.0;i=c31
Via: SIP/2.0/TCP 10.0.5.11:52216;received=10.0.5.11;branch=z9hG4bK-383131-2eed126ec9a1248afe3638dc5e0de267;rport=36292;alias
Max-Forwards: 69
Refer-Sub: false
Contact: <sip:61010@10.0.5.11:52216;transport=TCP>
Authorization: Digest username="61010",realm="asterisk",nonce="1522909831/594d06cf0f8d0f9bede2a9941ec12f92",uri="sip:71010@10.0.6.123:5566;transport=tcp",algorithm=md5,response="87ef2dd911a910d6d946980757984534",nc=00000001,cnonce="726d3f9d-7d18-47de-a994-3db5d22af085",qop=auth,opaque="48d654fe7341c965"
Expires: 180
Supported: replaces, 100rel, timer, norefersub, eventlist
Accept: application/pidf+xml, application/xpidf+xml
Allow-Events: presence, message-summary, refer
User-Agent: VING/1.0
Event: presence
Content-Length: 0
Path: <sip:10.0.6.123:5566;transport=tcp;lr>
<--- Transmitting SIP request (1090 bytes) to TCP:10.0.6.123:5566 --->
NOTIFY sip:61010@10.0.5.11:52216;transport=TCP SIP/2.0
Via: SIP/2.0/TCP 10.0.3.144:5566;rport;branch=z9hG4bKPjdc64cde6-3555-4d31-b3d3-baf1869156f2;alias
From: <sip:71010@10.0.6.123>;tag=cb04eaf1-adf0-4f0c-80b1-e747f85dd1e6
To: <sip:61010@10.0.6.123>;tag=-8930831
Contact: <sip:10.0.3.144:5566;transport=TCP>
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
CSeq: 23255 NOTIFY
Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=-8930831>
Event: presence
Subscription-State: active;expires=179
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk PBX 15.1.2
Content-Type: application/pidf+xml
Content-Length: 418
<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:71010@10.0.3.144:37438;transport=TCP" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid">
<note>Ready</note>
<tuple id="71010">
<status>
<basic>open</basic>
</status>
<contact priority="1"><sip:61010@10.0.6.123></contact>
</tuple>
<dm:person />
</presence>
<--- Transmitting SIP request (1163 bytes) to TCP:10.0.6.123:5566 --->
NOTIFY sip:61010@10.0.5.11:36292;id=sub SIP/2.0
Via: SIP/2.0/TCP 10.0.3.144:5566;rport;branch=z9hG4bKPj33a4f728-cd0e-4a58-836f-b3bef00716b7;alias
From: <sip:71010@10.0.6.123>;tag=cb04eaf1-adf0-4f0c-80b1-e747f85dd1e6
To: <sip:61010@10.0.6.123>;tag=-8930831
Contact: <sip:10.0.3.144:5566;transport=TCP>
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
CSeq: 23256 NOTIFY
Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=-8930831>
Event: presence
Subscription-State: active;expires=166
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk PBX 15.1.2
Content-Type: application/pidf+xml
Content-Length: 498
<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:71010@10.0.3.144:37438;transport=TCP" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid">
<note>Ringing</note>
<tuple id="71010">
<status>
<basic>open</basic>
</status>
<contact priority="1"><sip:61010@10.0.6.123></contact>
</tuple>
<dm:person>
<rpid:activities>
<rpid:on-the-phone />
</rpid:activities>
</dm:person>
</presence>
<--- Transmitting SIP request (1168 bytes) to TCP:10.0.6.123:5566 --->
NOTIFY sip:61010@10.0.5.11:36292;id=sub SIP/2.0
Via: SIP/2.0/TCP 10.0.3.144:5566;rport;branch=z9hG4bKPj6c67bf08-af29-4eef-93f4-97865e59be62;alias
From: <sip:71010@10.0.6.123>;tag=cb04eaf1-adf0-4f0c-80b1-e747f85dd1e6
To: <sip:61010@10.0.6.123>;tag=-8930831
Contact: <sip:10.0.3.144:5566;transport=TCP>
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
CSeq: 23257 NOTIFY
Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=-8930831>
Event: presence
Subscription-State: active;expires=165
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk PBX 15.1.2
Content-Type: application/pidf+xml
Content-Length: 503
<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:71010@10.0.3.144:37438;transport=TCP" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid">
<note>On the phone</note>
<tuple id="71010">
<status>
<basic>open</basic>
</status>
<contact priority="1"><sip:61010@10.0.6.123></contact>
</tuple>
<dm:person>
<rpid:activities>
<rpid:on-the-phone />
</rpid:activities>
</dm:person>
</presence>
<--- Transmitting SIP request (1083 bytes) to TCP:10.0.6.123:5566 --->
NOTIFY sip:61010@10.0.5.11:36292;id=sub SIP/2.0
Via: SIP/2.0/TCP 10.0.3.144:5566;rport;branch=z9hG4bKPjb735799e-77ea-46cf-bac6-b041aca45fc1;alias
From: <sip:71010@10.0.6.123>;tag=cb04eaf1-adf0-4f0c-80b1-e747f85dd1e6
To: <sip:61010@10.0.6.123>;tag=-8930831
Contact: <sip:10.0.3.144:5566;transport=TCP>
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
CSeq: 23258 NOTIFY
Route: <sip:10.0.6.123:5566;transport=tcp;lr;ftag=-8930831>
Event: presence
Subscription-State: active;expires=161
Allow-Events: presence, dialog, message-summary, refer
Max-Forwards: 70
User-Agent: Asterisk PBX 15.1.2
Content-Type: application/pidf+xml
Content-Length: 418
<?xml version="1.0" encoding="UTF-8"?>
<presence entity="sip:71010@10.0.3.144:37438;transport=TCP" xmlns="urn:ietf:params:xml:ns:pidf" xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid">
<note>Ready</note>
<tuple id="71010">
<status>
<basic>open</basic>
</status>
<contact priority="1"><sip:61010@10.0.6.123></contact>
</tuple>
<dm:person />
</presence>
Have a nice day,
jcolp
April 5, 2018, 9:58am
4
Did you remove the 200 OK to the initial INVITE that had “transport=TCP” in it? If so I need that. The Contact header from that will be used to update our own request URI, if it does not contain the transport parameter then you’d see exactly this behavior.
We added “transport=TCP” in “Contact” header field of the 200 OK response of the first NOTIFY messages, but again, second NOTIFY is without “transport=TCP”
Here is 200 OK of NOTIFY message (pasted previous):
<--- Received SIP response (392 bytes) from TCP:10.0.6.123:5566 --->
SIP/2.0 200 OK
To: <sip:61010@10.0.6.123>;tag=-8930831
Via: SIP/2.0/TCP 10.0.3.144:5566;received=10.0.3.144;rport=37438;branch=z9hG4bKPjdc64cde6-3555-4d31-b3d3-baf1869156f2;alias
Call-ID: f7d1a5f4031290494eef10d46f54bf88@10.0.5.11
From: <sip:71010@10.0.6.123>;tag=cb04eaf1-adf0-4f0c-80b1-e747f85dd1e6
CSeq: 23255 NOTIFY
Contact: <sip:61010@10.0.5.11:36292;id=sub>
Content-Length: 0
After insertion of “transport=TCP”
SIP/2.0 200 OK
To: <sip:61011@10.0.6.123>;tag=81301393
Via: SIP/2.0/TCP 10.0.3.144:5566;received=10.0.3.144;rport=45817;branch=z9hG4bKPj721562aa-4b6e-4aba-8357-e2c092d00359;alias
Call-ID: ec3570220bf1bd031d405ee2b385651d@10.0.15.17
From: <sip:71011@10.0.6.123>;tag=d2e35518-f964-40c4-b145-730f47698606
CSeq: 11320 NOTIFY
Contact: <sip:61011@10.0.15.17:37239;transport=TCP;id=sub>
Content-Length: 0
jcolp
April 5, 2018, 12:22pm
6
After making changes you need to provide the complete SIP trace again, so the differences can be seen.