Module: sip-router
Branch: jason.penton/tm_async_reply_support
Commit: 7199d849853dd89e2a1d7cc6415f83f8f1daae51
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7199d849853dd89e2a1d7cc6415f83f8f1daae51

Author: Jason Penton <[email protected]>
Committer: Jason Penton <[email protected]>
Date:   Thu Mar 14 16:48:29 2013 +0200

first work on async reply processing

---

 parser/msg_parser.h |    1 +
 receive.c           |   12 ++++++++++--
 route_struct.h      |    1 +
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index 79194e3..49d91f6 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -119,6 +119,7 @@ typedef enum request_method {
 #define FL_SDP_BODY     (1 << 12)  /*!< msg has SDP in body */
 #define FL_USE_UAC_FROM      (1<<13)  /* take FROM hdr from UAC instead of 
UAS*/
 #define FL_USE_UAC_TO        (1<<14)  /* take TO hdr from UAC instead of UAS */
+#define FL_RPL_SUSPENDED     (1<<15)  /* for async reply processing */
 
 /* WARNING: Value (1 << 28) is temporarily reserved for use in kamailio 
call_control
  * module (flag  FL_USE_CALL_CONTROL )! */
diff --git a/receive.c b/receive.c
index a4018ff..e107cfa 100644
--- a/receive.c
+++ b/receive.c
@@ -265,6 +265,12 @@ int receive_msg(char* buf, unsigned int len, struct 
receive_info* rcv_info)
                                STATS_RPL_FWD_DROP();
                                goto skip_send_reply; /* drop the message, no 
error */
                        }
+
+                       if (unlikely(ret==0 || msg->flags&FL_RPL_SUSPENDED)) {
+                               goto skip_send_reply;
+                               /* suspend the reply (async), no error */
+                       }
+
                }
                /* send the msg */
                forward_reply(msg);
@@ -277,8 +283,10 @@ int receive_msg(char* buf, unsigned int len, struct 
receive_info* rcv_info)
                DBG("successfully ran reply processing...(%d usec)\n", diff);
 #endif
 
-               /* execute post reply-script callbacks */
-               exec_post_script_cb(msg, ONREPLY_CB_TYPE);
+               if (likely(!(msg->flags&FL_RPL_SUSPENDED))) {
+                       /* execute post reply-script callbacks */
+                       exec_post_script_cb(msg, ONREPLY_CB_TYPE);
+               }
        }
 
 end:
diff --git a/route_struct.h b/route_struct.h
index e56f4c0..83d1eb0 100644
--- a/route_struct.h
+++ b/route_struct.h
@@ -147,6 +147,7 @@ typedef enum _operand_subtype action_param_type;
 #define RETURN_R_F 2
 #define BREAK_R_F  4
 #define DROP_R_F   8
+#define SUSPEND_R_F   16
 #define IGNORE_ON_BREAK_R_F 256
 
 


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to