Browse code

VOICE_MAIL defs removed

Jiri Kuthan authored on 28/02/2003 23:46:26
Showing 2 changed files
... ...
@@ -28,6 +28,7 @@
28 28
  *
29 29
  * History:
30 30
  * --------
31
+ * 2003-03-01 VOICE_MAIL defs removed (jiri)
31 32
  * 2003-02-28 scratchpad compatibility abandoned (jiri)
32 33
  * 2003-01-20 bug_fix: use of return value of snprintf aligned to C99 (jiri)
33 34
  * 2003-01-23 added rport patches, contributed by 
... ...
@@ -829,7 +830,6 @@ error:
829 830
 char * build_res_buf_from_sip_req( unsigned int code, char *text,
830 831
 					char *new_tag, unsigned int new_tag_len,
831 832
 					struct sip_msg* msg, unsigned int *returned_len)
832
-#ifdef VOICE_MAIL
833 833
 {
834 834
     return build_res_buf_with_body_from_sip_req(code,text,new_tag,new_tag_len,
835 835
 						0,0, /* no body */
... ...
@@ -842,7 +842,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
842 842
 					     char *body, unsigned int body_len,
843 843
 					     char *content_type, unsigned int content_type_len,
844 844
 					     struct sip_msg* msg, unsigned int *returned_len)
845
-#endif
846 845
 {
847 846
 	char              *buf, *p;
848 847
 	unsigned int      len,foo;
... ...
@@ -859,10 +858,8 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
859 858
 	unsigned int      warning_len;
860 859
 	unsigned int	  text_len;
861 860
 	int r;
862
-#ifdef VOICE_MAIL
863
-	char content_len[27];
864 861
 	int content_len_len;
865
-#endif
862
+	char *content_len;
866 863
 	char *after_body;
867 864
 	str to_tag;
868 865
 
... ...
@@ -874,6 +871,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
874 871
 	buf=0;
875 872
 	/* make -Wall happy */
876 873
 	warning=0;
874
+	content_len=0;
877 875
 
878 876
 	text_len=strlen(text);
879 877
 
... ...
@@ -949,17 +947,19 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
949 947
 	if (server_signature) {
950 948
 		/*server header*/
951 949
 		len += SERVER_HDR_LEN + CRLF_LEN;
952
-#ifndef VOICE_MAIL
953
-		/*content length header*/
950
+	}
951
+
952
+	if (body_len) {
953
+		content_len=int2str(body_len, &content_len_len);
954
+		len += CONTENT_LENGTH_LEN + content_len_len + CRLF_LEN;
955
+	    len += body_len;
956
+	} else {
954 957
 		len +=CONTENT_LENGTH_LEN+1 + CRLF_LEN;
955
-#endif
956 958
 	}
957
-#ifdef VOICE_MAIL
958
-	content_len_len=snprintf(content_len, sizeof(content_len), "Content-Length: %d", body_len);
959
-	len += content_len_len + CRLF_LEN;
960
-	if(content_type_len)
959
+	if(content_type_len) {
961 960
 	    len += content_type_len + CRLF_LEN;
962
-#endif
961
+	}
962
+
963 963
 	if (sip_warning) {
964 964
 		warning = warning_builder(msg,&warning_len);
965 965
 		if (warning) len += warning_len + CRLF_LEN;
... ...
@@ -968,10 +968,6 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
968 968
 	/* end of message */
969 969
 	len += CRLF_LEN; /*new line*/
970 970
 
971
-#ifdef VOICE_MAIL
972
-	if(body_len)
973
-	    len += body_len;
974
-#endif
975 971
 	/*allocating mem*/
976 972
 	buf = (char*) pkg_malloc( len+1 );
977 973
 	if (!buf)
... ...
@@ -1068,27 +1064,27 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
1068 1064
 		p+=SERVER_HDR_LEN;
1069 1065
 		memcpy( p, CRLF, CRLF_LEN );
1070 1066
 		p+=CRLF_LEN;
1071
-#ifndef VOICE_MAIL
1072
-		/* content length header*/
1073
-		memcpy( p, CONTENT_LENGTH "0" , CONTENT_LENGTH_LEN+1 );
1074
-		p+=CONTENT_LENGTH_LEN+1;
1067
+	}
1068
+
1069
+	
1070
+	if (body_len) {
1071
+		memcpy(p, CONTENT_LENGTH, CONTENT_LENGTH_LEN );
1072
+		p+=CONTENT_LENGTH_LEN;
1073
+		memcpy( p, content_len, content_len_len );
1074
+		p+=content_len_len;
1075 1075
 		memcpy( p, CRLF, CRLF_LEN );
1076 1076
 		p+=CRLF_LEN;
1077
-#endif
1077
+	} else {
1078
+		/* content length header*/
1079
+		memcpy( p, CONTENT_LENGTH "0" CRLF, CONTENT_LENGTH_LEN+1+CRLF_LEN );
1080
+		p+=CONTENT_LENGTH_LEN+1+CRLF_LEN;
1078 1081
 	}
1079
-
1080
-#ifdef VOICE_MAIL
1081
-	memcpy( p, content_len, content_len_len );
1082
-	p+=content_len_len;
1083
-	memcpy( p, CRLF, CRLF_LEN );
1084
-	p+=CRLF_LEN;
1085 1082
 	if(content_type_len){
1086 1083
 	    memcpy( p, content_type, content_type_len );
1087 1084
 	    p+=content_type_len;
1088 1085
 	    memcpy( p, CRLF, CRLF_LEN );
1089 1086
 	    p+=CRLF_LEN;
1090 1087
 	}
1091
-#endif
1092 1088
 	if (sip_warning && warning) {
1093 1089
 		memcpy( p, warning, warning_len);
1094 1090
 		p+=warning_len;
... ...
@@ -1098,12 +1094,10 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
1098 1094
 	/*end of message*/
1099 1095
 	memcpy( p, CRLF, CRLF_LEN );
1100 1096
 	p+=CRLF_LEN;
1101
-#ifdef VOICE_MAIL
1102 1097
 	if(body_len){
1103 1098
 	    memcpy ( p, body, body_len );
1104 1099
 	    p+=body_len;
1105 1100
 	}
1106
-#endif
1107 1101
 	*(p) = 0;
1108 1102
 	*returned_len = len;
1109 1103
 	/* in req2reply, received_buf is not introduced to lumps and
... ...
@@ -23,6 +23,10 @@
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ *
27
+ * History:
28
+ * --------
29
+ * 2003-03-01 VOICE_MAIL defs removed (jiri)
26 30
  */
27 31
 
28 32
 
... ...
@@ -54,7 +58,6 @@ char * build_res_buf_from_sip_req(	unsigned int code ,
54 58
 				unsigned int new_tag_len ,
55 59
 				struct sip_msg* msg,
56 60
 				unsigned int *returned_len);
57
-#ifdef VOICE_MAIL
58 61
 char * build_res_buf_with_body_from_sip_req(	unsigned int code ,
59 62
 				char *text ,
60 63
 				char *new_tag ,
... ...
@@ -65,7 +68,6 @@ char * build_res_buf_with_body_from_sip_req(	unsigned int code ,
65 68
 				unsigned int content_type_len,
66 69
 				struct sip_msg* msg,
67 70
 				unsigned int *returned_len);
68
-#endif
69 71
 
70 72
 char* via_builder( unsigned int *len,
71 73
 	struct socket_info* send_sock,