Module: sip-router Branch: tirpi/script_callbacks Commit: 6d3d94baa88351df76600d3c832dd0aca9ad3e2c URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6d3d94ba...
Author: Miklos Tirpak miklos@iptel.org Committer: Miklos Tirpak miklos@iptel.org Date: Mon Jun 1 15:50:37 2009 +0200
script callbacks: onsend route
- pre- and post-script callbacks are executed also for onsend route
---
onsend.h | 31 +++++++++++++++++++------------ 1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/onsend.h b/onsend.h index ffec9f2..efb07df 100644 --- a/onsend.h +++ b/onsend.h @@ -28,6 +28,7 @@ * History: * ------- * 2005-12-11 created by andrei + * 2009-06-01 Pre- and post-script callbacks of onsend route are executed (Miklos) */
@@ -38,6 +39,7 @@ #include "ip_addr.h" #include "action.h" #include "route.h" +#include "script_cb.h"
struct onsend_info{ union sockaddr_union* to; @@ -60,18 +62,23 @@ static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst, struct onsend_info onsnd_info; int ret; struct run_act_ctx ra_ctx; - - ret=1; - if (onsend_rt.rlist[DEFAULT_RT]){ - onsnd_info.to=&dst->to; - onsnd_info.send_sock=dst->send_sock; - onsnd_info.buf=buf; - onsnd_info.len=len; - p_onsend=&onsnd_info; - set_route_type(ONSEND_ROUTE); - init_run_actions_ctx(&ra_ctx); - ret=run_actions(&ra_ctx, onsend_rt.rlist[DEFAULT_RT], orig_msg); - p_onsend=0; /* reset it */ + + if (exec_pre_script_cb(orig_msg, ONSEND_CB_TYPE)>0) { + ret=1; + if (onsend_rt.rlist[DEFAULT_RT]){ + onsnd_info.to=&dst->to; + onsnd_info.send_sock=dst->send_sock; + onsnd_info.buf=buf; + onsnd_info.len=len; + p_onsend=&onsnd_info; + set_route_type(ONSEND_ROUTE); + init_run_actions_ctx(&ra_ctx); + ret=run_actions(&ra_ctx, onsend_rt.rlist[DEFAULT_RT], orig_msg); + p_onsend=0; /* reset it */ + } + exec_post_script_cb(orig_msg, ONSEND_CB_TYPE); + } else { + ret = 0; } return ret; }