Module: sip-router Branch: tirpi/script_callbacks Commit: 6a690d16f8ba2db8ae4123248589128ddfb25bf1 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6a690d16...
Author: Miklos Tirpak miklos@iptel.org Committer: Miklos Tirpak miklos@iptel.org Date: Mon Jun 1 16:33:59 2009 +0200
script callbacks: onsend_route correction
- The pre-script callbacks are executed only if the onsend_route is defined. - The callbacks can access the socket info.
---
onsend.h | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/onsend.h b/onsend.h index efb07df..867161b 100644 --- a/onsend.h +++ b/onsend.h @@ -63,22 +63,22 @@ static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst, int ret; struct run_act_ctx ra_ctx;
- 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); + 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); + if (exec_pre_script_cb(orig_msg, ONSEND_CB_TYPE)>0) { 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; /* drop the message */ } - exec_post_script_cb(orig_msg, ONSEND_CB_TYPE); - } else { - ret = 0; + p_onsend=0; /* reset it */ } return ret; }