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 829
 char * build_res_buf_from_sip_req( unsigned int code, char *text,
830 830
 					char *new_tag, unsigned int new_tag_len,
831 831
 					struct sip_msg* msg, unsigned int *returned_len)
832
-#ifdef VOICE_MAIL
833 832
 {
834 833
     return build_res_buf_with_body_from_sip_req(code,text,new_tag,new_tag_len,
835 834
 						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 859
 	unsigned int      warning_len;
860 860
 	unsigned int	  text_len;
861 861
 	int r;
862
-#ifdef VOICE_MAIL
863
-	char content_len[27];
864 862
 	int content_len_len;
865
-#endif
863
+	char *content_len;
866 864
 	char *after_body;
867 865
 	str to_tag;
868 866
 
... ...
@@ -874,6 +871,7 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
874 874
 	buf=0;
875 875
 	/* make -Wall happy */
876 876
 	warning=0;
877
+	content_len=0;
877 878
 
878 879
 	text_len=strlen(text);
879 880
 
... ...
@@ -949,17 +947,19 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
949 949
 	if (server_signature) {
950 950
 		/*server header*/
951 951
 		len += SERVER_HDR_LEN + CRLF_LEN;
952
-#ifndef VOICE_MAIL
953
-		/*content length header*/
952
+	}
953
+
954
+	if (body_len) {
955
+		content_len=int2str(body_len, &content_len_len);
956
+		len += CONTENT_LENGTH_LEN + content_len_len + CRLF_LEN;
957
+	    len += body_len;
958
+	} else {
954 959
 		len +=CONTENT_LENGTH_LEN+1 + CRLF_LEN;
955
-#endif
956 960
 	}
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)
961
+	if(content_type_len) {
961 962
 	    len += content_type_len + CRLF_LEN;
962
-#endif
963
+	}
964
+
963 965
 	if (sip_warning) {
964 966
 		warning = warning_builder(msg,&warning_len);
965 967
 		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 1068
 		p+=SERVER_HDR_LEN;
1069 1069
 		memcpy( p, CRLF, CRLF_LEN );
1070 1070
 		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;
1071
+	}
1072
+
1073
+	
1074
+	if (body_len) {
1075
+		memcpy(p, CONTENT_LENGTH, CONTENT_LENGTH_LEN );
1076
+		p+=CONTENT_LENGTH_LEN;
1077
+		memcpy( p, content_len, content_len_len );
1078
+		p+=content_len_len;
1075 1079
 		memcpy( p, CRLF, CRLF_LEN );
1076 1080
 		p+=CRLF_LEN;
1077
-#endif
1081
+	} else {
1082
+		/* content length header*/
1083
+		memcpy( p, CONTENT_LENGTH "0" CRLF, CONTENT_LENGTH_LEN+1+CRLF_LEN );
1084
+		p+=CONTENT_LENGTH_LEN+1+CRLF_LEN;
1078 1085
 	}
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 1086
 	if(content_type_len){
1086 1087
 	    memcpy( p, content_type, content_type_len );
1087 1088
 	    p+=content_type_len;
1088 1089
 	    memcpy( p, CRLF, CRLF_LEN );
1089 1090
 	    p+=CRLF_LEN;
1090 1091
 	}
1091
-#endif
1092 1092
 	if (sip_warning && warning) {
1093 1093
 		memcpy( p, warning, warning_len);
1094 1094
 		p+=warning_len;
... ...
@@ -1098,12 +1094,10 @@ char * build_res_buf_with_body_from_sip_req( unsigned int code, char *text ,
1098 1098
 	/*end of message*/
1099 1099
 	memcpy( p, CRLF, CRLF_LEN );
1100 1100
 	p+=CRLF_LEN;
1101
-#ifdef VOICE_MAIL
1102 1101
 	if(body_len){
1103 1102
 	    memcpy ( p, body, body_len );
1104 1103
 	    p+=body_len;
1105 1104
 	}
1106
-#endif
1107 1105
 	*(p) = 0;
1108 1106
 	*returned_len = len;
1109 1107
 	/* 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 54
 				unsigned int new_tag_len ,
55 55
 				struct sip_msg* msg,
56 56
 				unsigned int *returned_len);
57
-#ifdef VOICE_MAIL
58 57
 char * build_res_buf_with_body_from_sip_req(	unsigned int code ,
59 58
 				char *text ,
60 59
 				char *new_tag ,
... ...
@@ -65,7 +68,6 @@ char * build_res_buf_with_body_from_sip_req(	unsigned int code ,
65 65
 				unsigned int content_type_len,
66 66
 				struct sip_msg* msg,
67 67
 				unsigned int *returned_len);
68
-#endif
69 68
 
70 69
 char* via_builder( unsigned int *len,
71 70
 	struct socket_info* send_sock,