Module: kamailio Branch: master Commit: 700261dff422693fb78dbe5062998bed3eddb397 URL: https://github.com/kamailio/kamailio/commit/700261dff422693fb78dbe5062998bed...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-06-18T18:45:58+02:00
sl: execute core event SREV_SIP_REPLY_OUT
---
Modified: src/modules/sl/sl_funcs.c
---
Diff: https://github.com/kamailio/kamailio/commit/700261dff422693fb78dbe5062998bed... Patch: https://github.com/kamailio/kamailio/commit/700261dff422693fb78dbe5062998bed...
---
diff --git a/src/modules/sl/sl_funcs.c b/src/modules/sl/sl_funcs.c index c832f4fb09..e6f643c861 100644 --- a/src/modules/sl/sl_funcs.c +++ b/src/modules/sl/sl_funcs.c @@ -214,7 +214,8 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag) mhomed=backup_mhomed;
keng = sr_kemi_eng_get(); - if (_sl_evrt_local_response >= 0 || keng!=NULL) + if (_sl_evrt_local_response >= 0 || keng!=NULL + || sr_event_enabled(SREV_SIP_REPLY_OUT)) { if (likely(build_sip_msg_from_buf(&pmsg, buf.s, buf.len, inc_msg_no()) == 0)) @@ -226,10 +227,8 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag) onsnd_info.send_sock=dst.send_sock; onsnd_info.buf=buf.s; onsnd_info.len=buf.len; - p_onsend=&onsnd_info;
- if (unlikely(!IS_SIP(msg))) - { + if (unlikely(!IS_SIP(msg))) { /* This is an HTTP reply... So fudge in a CSeq into * the parsed message message structure so that $rm will * work in the route */ @@ -293,6 +292,20 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag) } }
+ if(IS_SIP(msg) && sr_event_enabled(SREV_SIP_REPLY_OUT)) { + sr_event_param_t evp; + memset(&evp, 0, sizeof(sr_event_param_t)); + evp.obuf = buf; + evp.rcv = &msg->rcv; + evp.dst = &dst; + evp.req = msg; + evp.rpl = &pmsg; + evp.rplcode = code; + evp.mode = 1; + sr_event_exec(SREV_SIP_REPLY_OUT, &evp); + } + + p_onsend=&onsnd_info; backup_rt = get_route_type(); set_route_type(LOCAL_ROUTE); init_run_actions_ctx(&ctx);