Browse code

*** empty log message ***

Bogdan-Andrei Iancu authored on 13/02/2002 21:37:17
Showing 5 changed files
... ...
@@ -97,6 +97,9 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
97 97
       lump_chain = lump_chain->next;
98 98
    }
99 99
 
100
+   /**/
101
+
102
+
100 103
    p=(char *)sh_malloc(len);foo=p;
101 104
    if (!p)
102 105
    {
... ...
@@ -13,6 +13,7 @@
13 13
 #include "ut.h"
14 14
 #include "error.h"
15 15
 #include "dprint.h"
16
+#include "data_lump_rpl.h"
16 17
 #include "mem/mem.h"
17 18
 
18 19
 #ifdef DEBUG_DMALLOC
... ...
@@ -771,7 +772,16 @@ void free_uri(struct sip_uri* u)
771 771
 	}
772 772
 }
773 773
 
774
-
774
+void free_reply_lump( struct lump_rpl *lump)
775
+{
776
+	struct lump_rpl *foo, *bar;
777
+	for(foo=lump;foo;)
778
+	{
779
+		bar=foo->next;
780
+		free_lump_rpl(foo);
781
+		foo = bar;
782
+	}
783
+}
775 784
 
776 785
 void free_via_param_list(struct via_param* vp)
777 786
 {
... ...
@@ -855,6 +865,7 @@ void free_sip_msg(struct sip_msg* msg)
855 855
 	if (msg->headers)     free_hdr_field_lst(msg->headers);
856 856
 	if (msg->add_rm)      free_lump_list(msg->add_rm);
857 857
 	if (msg->repl_add_rm) free_lump_list(msg->repl_add_rm);
858
+	if (msg->reply_lump)   free_reply_lump(msg->reply_lump);
858 859
 	pkg_free(msg->orig);
859 860
 	/* don't free anymore -- now a pointer to a static buffer */
860 861
 #	ifdef DYN_BUF
... ...
@@ -199,6 +199,7 @@ struct sip_msg{
199 199
 
200 200
 	struct lump* add_rm;      /* used for all the forwarded messages */
201 201
 	struct lump* repl_add_rm; /* only for localy generated replies !!!*/
202
+	struct lump_rpl *reply_lump;
202 203
 
203 204
 	/* str add_to_branch; */ /* whatever whoever want to append to branch comes here */
204 205
 	char add_to_branch_s[MAX_BRANCH_PARAM_LEN];
... ...
@@ -10,6 +10,7 @@
10 10
 #include "dprint.h"
11 11
 #include "config.h"
12 12
 #include "md5utils.h"
13
+#include "data_lump_rpl.h"
13 14
 #include <netdb.h>
14 15
 
15 16
 
... ...
@@ -550,6 +551,7 @@ char * build_res_buf_from_sip_req(	unsigned int code ,
550 550
 	char                    *buf, *p;
551 551
 	unsigned int       len,foo;
552 552
 	struct hdr_field  *hdr;
553
+	struct lump_rpl  *lump;
553 554
 	int                       i;
554 555
 	str                        *tag_str;
555 556
 
... ...
@@ -579,6 +581,9 @@ char * build_res_buf_from_sip_req(	unsigned int code ,
579 579
 			case HDR_CSEQ:
580 580
 				len += ((hdr->body.s+hdr->body.len )-hdr->name.s )+CRLF_LEN;
581 581
 		}
582
+	/*lumps length*/
583
+	for(lump=msg->reply_lump;lump;lump=lump->next)
584
+		len += lump->text.len;
582 585
 	/*content length header*/
583 586
 	len +=CONTENT_LEN_LEN + CRLF_LEN;
584 587
 	/* end of message */
... ...
@@ -588,7 +593,8 @@ char * build_res_buf_from_sip_req(	unsigned int code ,
588 588
 	buf = (char*) malloc( len+1 );
589 589
 	if (!buf)
590 590
 	{
591
-		LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: out of memory\n");
591
+		LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: out of memory "
592
+			" ; needs %d\n",len);
592 593
 		goto error;
593 594
 	}
594 595
 
... ...
@@ -640,7 +646,12 @@ char * build_res_buf_from_sip_req(	unsigned int code ,
640 640
 					((hdr->body.s+hdr->body.len )-hdr->name.s ),msg);
641 641
 				append_str( p, CRLF,CRLF_LEN,msg);
642 642
 		}
643
-
643
+	/*lumps*/
644
+	for(lump=msg->reply_lump;lump;lump=lump->next)
645
+	{
646
+		memcpy(p,lump->text.s,lump->text.len);
647
+		p += lump->text.len;
648
+	}
644 649
 	/* content length header*/
645 650
 	memcpy( p, CONTENT_LEN , CONTENT_LEN_LEN );
646 651
 	p+=CONTENT_LEN_LEN;
... ...
@@ -5,7 +5,7 @@
5 5
 #
6 6
 
7 7
 
8
-debug=3          # debug level (cmd line: -dddddddddd)
8
+debug=9          # debug level (cmd line: -dddddddddd)
9 9
 #fork=yes          # (cmd. line: -D)
10 10
 fork=no
11 11
 log_stderror=yes # (cmd line: -E)
... ...
@@ -18,19 +18,22 @@ dns=off           # (cmd. line: -r)
18 18
 rev_dns=off      # (cmd. line: -R)
19 19
 #port=5070
20 20
 #listen=10.0.0.179
21
-listen=192.168.57.33
21
+#listen=192.168.57.33
22 22
 loop_checks=0
23 23
 # for more info: sip_router -h
24 24
 
25 25
 #modules
26 26
 #loadmodule "modules/print/print.so"
27
+loadmodule "modules/textops/textops.so"
27 28
 loadmodule "modules/tm/tm.so"
28 29
 #loadmodule "modules/rr/rr.so"
29 30
 loadmodule "modules/maxfwd/maxfwd.so"
30
-#loadmodule "modules/sl/sl.so"
31
+loadmodule "modules/sl/sl.so"
32
+loadmodule "modules/cpl/cpl.so"
31 33
 
32 34
 
33 35
 route{
36
+             sl_filter_ACK();
34 37
 
35 38
              if ( mf_is_maxfwd_present() )
36 39
              {
... ...
@@ -48,25 +51,25 @@ route{
48 48
              };
49 49
 
50 50
 
51
-             #if (method=="INVITE")
52
-             #{
53
-                 #sl_send_reply("404","Not found");
54
-                 #drop();
55
-              #  log("SER : runing CPL!! :)\n");
56
-              #  if ( !cpl_run_script() )
57
-               # {
58
-               #    log("SER : Error during running CPL script!\n");
59
-               # }else{
60
-                #   if ( cpl_is_response_reject() )
61
-                  # {
62
-                    #   t_add_transaction();
63
-                      # t_send_reply("486","I am not available!");
64
-                       #drop();
65
-                 #  }else if ( cpl_is_response_redirect() ) {
66
-                   #      log("SER : redirect\n");
67
-                  # };
68
-               # };
69
-             #};
51
+             if (method=="INVITE")
52
+             {
53
+                log("SER : runing CPL!! :)\n");
54
+                if ( !cpl_run_script() )
55
+                {
56
+                   log("SER : Error during running CPL script!\n");
57
+                }else{
58
+                   if ( cpl_is_response_reject() )
59
+                   {
60
+                       sl_send_reply("603","I am not available!");
61
+                       drop();
62
+                   }else if ( cpl_is_response_redirect() ) {
63
+                       log("SER : redirect\n");
64
+                       cpl_update_contact();
65
+                       sl_send_reply("302","Moved temporarily");
66
+                       drop();
67
+                   };
68
+                };
69
+             };
70 70
 
71 71
            #  if ( !rewriteFromRoute() )
72 72
             # {