Browse code

core: Updated Via and Record-Route generation for WebSockets

Peter Dunkley authored on 01/07/2012 21:20:36
Showing 1 changed files
... ...
@@ -648,7 +648,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
648 648
 				break; \
649 649
 			case SUBST_RCV_PROTO: \
650 650
 				if (msg->rcv.bind_address){ \
651
-					switch(msg->rcv.bind_address->proto){ \
651
+					switch(msg->rcv.proto){ \
652 652
 						case PROTO_NONE: \
653 653
 						case PROTO_UDP: \
654 654
 						case PROTO_TCP: \
... ...
@@ -681,7 +681,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
681 681
 						new_len+=1+recv_port_str->len; \
682 682
 					}\
683 683
 						/*add;transport=xxx*/ \
684
-					switch(msg->rcv.bind_address->proto){ \
684
+					switch(msg->rcv.proto){ \
685 685
 						case PROTO_NONE: \
686 686
 						case PROTO_UDP: \
687 687
 								break; /* udp is the default */ \
... ...
@@ -727,7 +727,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
727 727
 				break; \
728 728
 			case SUBST_SND_PROTO: \
729 729
 				if (send_sock){ \
730
-					switch(send_sock->proto){ \
730
+					switch(send_info->proto){ \
731 731
 						case PROTO_NONE: \
732 732
 						case PROTO_UDP: \
733 733
 						case PROTO_TCP: \
... ...
@@ -762,7 +762,7 @@ static inline int lumps_len(struct sip_msg* msg, struct lump* lumps,
762 762
 						new_len+=1+send_port_str->len; \
763 763
 					}\
764 764
 					/*add;transport=xxx*/ \
765
-					switch(send_sock->proto){ \
765
+					switch(send_info->proto){ \
766 766
 						case PROTO_NONE: \
767 767
 						case PROTO_UDP: \
768 768
 								break; /* udp is the default */ \
... ...
@@ -1042,7 +1042,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1042 1042
 							recv_port_str->len); \
1043 1043
 					offset+=recv_port_str->len; \
1044 1044
 				}\
1045
-				switch(msg->rcv.bind_address->proto){ \
1045
+				switch(msg->rcv.proto){ \
1046 1046
 					case PROTO_NONE: \
1047 1047
 					case PROTO_UDP: \
1048 1048
 						break; /* nothing to do, udp is default*/ \
... ...
@@ -1137,7 +1137,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1137 1137
 							send_port_str->len); \
1138 1138
 					offset+=send_port_str->len; \
1139 1139
 				}\
1140
-				switch(send_sock->proto){ \
1140
+				switch(send_info->proto){ \
1141 1141
 					case PROTO_NONE: \
1142 1142
 					case PROTO_UDP: \
1143 1143
 						break; /* nothing to do, udp is default*/ \
... ...
@@ -1182,7 +1182,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1182 1182
 			break; \
1183 1183
 		case SUBST_RCV_PROTO: \
1184 1184
 			if (msg->rcv.bind_address){ \
1185
-				switch(msg->rcv.bind_address->proto){ \
1185
+				switch(msg->rcv.proto){ \
1186 1186
 					case PROTO_NONE: \
1187 1187
 					case PROTO_UDP: \
1188 1188
 						memcpy(new_buf+offset, "udp", 3); \
... ...
@@ -1217,7 +1217,7 @@ static inline void process_lumps(	struct sip_msg* msg,
1217 1217
 			break; \
1218 1218
 		case  SUBST_SND_PROTO: \
1219 1219
 			if (send_sock){ \
1220
-				switch(send_sock->proto){ \
1220
+				switch(send_info->proto){ \
1221 1221
 					case PROTO_NONE: \
1222 1222
 					case PROTO_UDP: \
1223 1223
 						memcpy(new_buf+offset, "udp", 3); \
... ...
@@ -2437,7 +2437,9 @@ char* via_builder( unsigned int *len,
2437 2437
 	}else if (send_info->proto==PROTO_SCTP){
2438 2438
 		memcpy(line_buf+MY_VIA_LEN-4, "SCTP ", 5);
2439 2439
 	}else if (send_info->proto==PROTO_WS){
2440
-		memcpy(line_buf+MY_VIA_LEN-4, "WS ", 2);
2440
+		memcpy(line_buf+MY_VIA_LEN-4, "WS ", 3);
2441
+	}else if (send_info->proto==PROTO_WSS){
2442
+		memcpy(line_buf+MY_VIA_LEN-4, "WSS ", 4);
2441 2443
 	}else{
2442 2444
 		LOG(L_CRIT, "BUG: via_builder: unknown proto %d\n", send_info->proto);
2443 2445
 		return 0;