Browse code

sip: b/f: added Content-Length-HF to non-200 ACK

this is necessary for TCP transport.

Raphael Coeffic authored on 11/12/2013 09:41:17
Showing 1 changed files
... ...
@@ -2204,10 +2204,14 @@ void _trans_layer::send_non_200_ack(sip_msg* reply, sip_trans* t)
2204 2204
 	+ copy_hdr_len(inv->callid);
2205 2205
     
2206 2206
     ack_len += cseq_len(get_cseq(inv)->num_str,method);
2207
-    ack_len += 2/* EoH CRLF */;
2208 2207
 
2209 2208
     if(!inv->route.empty())
2210 2209
  	ack_len += copy_hdrs_len(inv->route);
2210
+
2211
+    cstring content_len("0");
2212
+    ack_len += content_length_len(content_len);
2213
+
2214
+    ack_len += 2/* EoH CRLF */;
2211 2215
     
2212 2216
     char* ack_buf = new char [ack_len];
2213 2217
     char* c = ack_buf;
... ...
@@ -2216,14 +2220,16 @@ void _trans_layer::send_non_200_ack(sip_msg* reply, sip_trans* t)
2216 2220
     
2217 2221
     copy_hdr_wr(&c,inv->via1);
2218 2222
 
2219
-    if(!inv->route.empty())
2220
-	 copy_hdrs_wr(&c,inv->route);
2221
-
2222 2223
     copy_hdr_wr(&c,inv->from);
2223 2224
     copy_hdr_wr(&c,reply->to);
2224 2225
     copy_hdr_wr(&c,inv->callid);
2225 2226
     
2226 2227
     cseq_wr(&c,get_cseq(inv)->num_str,method);
2228
+
2229
+    if(!inv->route.empty())
2230
+	 copy_hdrs_wr(&c,inv->route);
2231
+
2232
+    content_length_wr(&c,content_len);
2227 2233
     
2228 2234
     *c++ = CR;
2229 2235
     *c++ = LF;