|
@@ -55,6 +55,7 @@ extern struct onsend_info* p_onsend;
|
|
|
|
|
|
/*
|
|
/*
|
|
* returns: 0 drop the message, >= ok, <0 error (but forward the message)
|
|
* returns: 0 drop the message, >= ok, <0 error (but forward the message)
|
|
|
|
+ * it also migh change dst->send_flags!
|
|
* WARNING: buf must be 0 terminated (to allow regex matches on it) */
|
|
* WARNING: buf must be 0 terminated (to allow regex matches on it) */
|
|
static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst,
|
|
static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst,
|
|
char* buf, int len)
|
|
char* buf, int len)
|
|
@@ -63,6 +64,8 @@ static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst,
|
|
int ret;
|
|
int ret;
|
|
struct run_act_ctx ra_ctx;
|
|
struct run_act_ctx ra_ctx;
|
|
int backup_route_type;
|
|
int backup_route_type;
|
|
|
|
+ snd_flags_t fwd_snd_flags_bak;
|
|
|
|
+ snd_flags_t rpl_snd_flags_bak;
|
|
|
|
|
|
ret=1;
|
|
ret=1;
|
|
if (onsend_rt.rlist[DEFAULT_RT]){
|
|
if (onsend_rt.rlist[DEFAULT_RT]){
|
|
@@ -74,8 +77,17 @@ static inline int run_onsend(struct sip_msg* orig_msg, struct dest_info* dst,
|
|
backup_route_type=get_route_type();
|
|
backup_route_type=get_route_type();
|
|
set_route_type(ONSEND_ROUTE);
|
|
set_route_type(ONSEND_ROUTE);
|
|
if (exec_pre_script_cb(orig_msg, ONSEND_CB_TYPE)>0) {
|
|
if (exec_pre_script_cb(orig_msg, ONSEND_CB_TYPE)>0) {
|
|
|
|
+ /* backup orig_msg send flags */
|
|
|
|
+ fwd_snd_flags_bak=orig_msg->fwd_send_flags;
|
|
|
|
+ rpl_snd_flags_bak=orig_msg->rpl_send_flags;
|
|
|
|
+ orig_msg->fwd_send_flags=dst->send_flags; /* intial value */
|
|
init_run_actions_ctx(&ra_ctx);
|
|
init_run_actions_ctx(&ra_ctx);
|
|
ret=run_actions(&ra_ctx, onsend_rt.rlist[DEFAULT_RT], orig_msg);
|
|
ret=run_actions(&ra_ctx, onsend_rt.rlist[DEFAULT_RT], orig_msg);
|
|
|
|
+ /* update dst send_flags */
|
|
|
|
+ dst->send_flags=orig_msg->fwd_send_flags;
|
|
|
|
+ /* restore orig_msg flags */
|
|
|
|
+ orig_msg->fwd_send_flags=fwd_snd_flags_bak;
|
|
|
|
+ orig_msg->rpl_send_flags=rpl_snd_flags_bak;
|
|
exec_post_script_cb(orig_msg, ONSEND_CB_TYPE);
|
|
exec_post_script_cb(orig_msg, ONSEND_CB_TYPE);
|
|
} else {
|
|
} else {
|
|
ret=0; /* drop the message */
|
|
ret=0; /* drop the message */
|