[SR-Dev] git:janakj/kcore: Kamailio compatiblity: export last_retcode via a global variable

Jan Janak jan at iptel.org
Mon Mar 23 13:48:52 CET 2009


Module: sip-router
Branch: janakj/kcore
Commit: 68b7a89891c1391ce518d3684d5f813556786d6d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=68b7a89891c1391ce518d3684d5f813556786d6d

Author: Jan Janak <jan at iptel.org>
Committer: Jan Janak <jan at iptel.org>
Date:   Thu Mar 19 14:44:52 2009 +0100

Kamailio compatiblity: export last_retcode via a global variable

---

 action.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/action.c b/action.c
index 2baa6cb..75072dd 100644
--- a/action.c
+++ b/action.c
@@ -93,7 +93,7 @@
 #include <dmalloc.h>
 #endif
 
-
+int _last_returned_code  = 0;
 struct onsend_info* p_onsend=0; /* onsend route send info */
 
 /* ret= 0! if action -> end of list(e.g DROP),
@@ -461,6 +461,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 			/*ret=((ret=run_actions(rlist[a->val[0].u.number], msg))<0)?ret:1;*/
 			ret=run_actions(h, main_rt.rlist[a->val[0].u.number], msg);
 			h->last_retcode=ret;
+			_last_returned_code = h->last_retcode;
 			h->run_flags&=~(RETURN_R_F|BREAK_R_F); /* absorb return & break */
 			break;
 		case EXEC_T:
@@ -745,6 +746,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 									);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -762,6 +764,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 									);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -777,6 +780,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 									);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -793,6 +797,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 									);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -810,6 +815,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 									);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -823,6 +829,7 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 										);
 				if (ret==0) h->run_flags|=EXIT_R_F;
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 			} else {
 				LOG(L_CRIT,"BUG: do_action: bad module call\n");
 			}
@@ -1119,6 +1126,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 	if (h->rec_lev==1){
 		h->run_flags=0;
 		h->last_retcode=0;
+		_last_returned_code = h->last_retcode;
 #ifdef USE_LONGJMP
 		if (setjmp(h->jmp_env)){
 			h->rec_lev=0;
@@ -1142,6 +1150,7 @@ int run_actions(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 			if (h->run_flags & EXIT_R_F){
 #ifdef USE_LONGJMP
 				h->last_retcode=ret;
+				_last_returned_code = h->last_retcode;
 				longjmp(h->jmp_env, ret);
 #endif
 			}




More information about the sr-dev mailing list