Hello 
In  the function ksr_tm_event_response_sent(evname),  header and body 
modifications are not applied.
**Example of modification:**
KSR.textops.set_body("application/test", "teststbody")
                KSR.textops.remove_hf("Contact")
                KSR.hdr.append("X-My-Hdr: testhdrappend \r\n")

In the Kamailio logs, we can see that the changes have been processed, but the 
response sent does not contain the changes.

BR
Juan


**Configuration  kamailio.cfg**
modparam("tm", "event_callback_lres_sent", "ksr_tm_event_response_sent")

**Configuration  kamailio.lua**
-----------------------
--Function ksr_tm_event_response_sent bug
-----------------------
function ksr_tm_event_response_sent(evname)
        log.debug("\27[36m --> Sending reply: $rs $rr \27[0m")
        log.debug("\27[35m Reply sent ",evname,"\27[0m")
        
                KSR.textops.set_body("application/test", "teststbody")
                KSR.textops.remove_hf("Contact")
                KSR.hdr.append("X-My-Hdr: testhdrappend \r\n")
                
end

**Traces debug KAMAILIO**

 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[0] for: xinfo is str: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:96:  --> Sending reply: $rs $rr

 4(260) DEBUG: <core> [core/pvapi.c:502]: pv_spec_lookup(): PV <$rs> is not in 
cache
 4(260) DEBUG: <core> [core/pvapi.c:386]: pv_cache_add(): pvar [$rs] added in 
cache
 4(260) DEBUG: <core> [core/pvapi.c:502]: pv_spec_lookup(): PV <$rr> is not in 
cache
 4(260) DEBUG: <core> [core/pvapi.c:386]: pv_cache_add(): pvar [$rr] added in 
cache
 4(260) INFO: <script>: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:96:  --> Sending reply: 200 OK
 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[0] for: xinfo is str: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:97:  Reply sent  tm:local-response-sent

 4(260) INFO: <script>: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:97:  Reply sent  tm:local-response-sent
 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[0] for: set_body is str: application/test
 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[1] for: set_body is str: teststbody
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [To] type 3
 4(260) DEBUG: <core> [core/parser/parse_addr_spec.c:185]: parse_to_param(): 
add param: tag=bb3c24ed793eec883784ff522b4e48d0
 4(260) DEBUG: <core> [core/parser/parse_addr_spec.c:904]: parse_addr_spec(): 
end of header reached, state=29
 4(260) DEBUG: <core> [core/parser/msg_parser.c:172]: get_hdr_field(): <To> 
[61]; uri=[sip:1...@sip.osp.com]
 4(260) DEBUG: <core> [core/parser/msg_parser.c:174]: get_hdr_field(): to body 
(22)[<sip:1...@sip.osp.com>], to tag (32)[bb3c24ed793eec883784ff522b4e48d0]
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [From] type 4
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [CSeq] type 5
 4(260) DEBUG: <core> [core/parser/msg_parser.c:152]: get_hdr_field(): cseq 
<CSeq>: <63723> <REGISTER>
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [Call-ID] type 6
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [Content-Type] type 11
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [Contact] type 7
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [Content-Length] type 12
 4(260) DEBUG: <core> [core/parser/msg_parser.c:187]: get_hdr_field(): 
content_length=6
 4(260) DEBUG: <core> [core/parser/msg_parser.c:91]: get_hdr_field(): found end 
of header
 4(260) DEBUG: textops [textops.c:2597]: ki_set_body(): new body: 
[application/test] 4(260) DEBUG: app_lua [app_lua_api.c:1023]: 
sr_kemi_lua_exec_func_ex(): param[0] for: remove_hf is str: Contact
 4(260) DEBUG: <core> [core/parser/parse_hname2.c:315]: 
parse_sip_header_name(): parsed header name [Contact] type 7
 4(260) DEBUG: <core> [core/kemi.c:2350]: sr_kemi_hdr_remove(): remove hf: 
Contact
 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[0] for: append is str: X-My-Hdr: testhdrappend

 4(260) DEBUG: <core> [core/kemi.c:2224]: sr_kemi_hdr_append(): append hf: 
X-My-Hdr: testhdrappend

 4(260) DEBUG: app_lua [app_lua_mod.c:166]: sr_kemi_config_engine_lua(): 
execution of route type 513 with name [ksr_tm_event_response_sent] returned 1
 4(260) DEBUG: tm [t_reply.c:634]: _reply_light(): reply sent out - 
buf=0x786b611bb9e0: SIP/2.0 200 OK
Via:... shmem=0x786b58ceea80: SIP/2.0 200 OK
Via:
 4(260) DEBUG: tm [t_funcs.c:133]: put_on_wait(): put T [0x786b58ceb770] on wait
 4(260) DEBUG: tm [t_reply.c:650]: _reply_light(): finished
 4(260) DEBUG: jsonrpcs [jsonrpcs_mod.c:443]: jsonrpc_send_mode(): sending 
response with body: (nil) - 200 OK
 4(260) DEBUG: app_lua [app_lua_api.c:1023]: sr_kemi_lua_exec_func_ex(): 
param[0] for: xinfo is str: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:36:  ksr_request_route: 23.11 ms

 4(260) INFO: <script>: 2024-10-10 10-18-10 [debug] 
/opt/kamailio/kamailio.lua:36:  ksr_request_route: 23.11 ms
 4(260) DEBUG: app_lua [app_lua_mod.c:169]: sr_kemi_config_engine_lua(): 
execution of route type 1 with no name returned 1
 4(260) DEBUG: <core> [core/receive.c:531]: receive_msg(): request-route 
executed in: 23343 usec
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/usr_avp.c:654]: destroy_avp_list(): destroying list 
(nil)
 4(260) DEBUG: <core> [core/xavp.c:630]: xavp_destroy_list(): destroying xavp 
list (nil)
 4(260) DEBUG: <core> [core/xavp.c:630]: xavp_destroy_list(): destroying xavp 
list (nil)
 4(260) DEBUG: <core> [core/xavp.c:630]: xavp_destroy_list(): destroying xavp 
list (nil)
 4(260) DEBUG: <core> [core/receive.c:635]: receive_msg(): cleaning up
18(274) DEBUG: tm [timer.c:642]: wait_handler(): finished transaction: 
0x786b58ce81a0 (p:0x786b58baa3c0/n:0x786b58baa3c0)
18(274) DEBUG: tm [h_table.c:133]: free_cell_helper(): freeing transaction 
0x786b58ce81a0 from timer.c:651
18(274) DEBUG: tm [timer.c:642]: wait_handler(): finished transaction: 
0x786b58ceb770 (p:0x786b58b729c0/n:0x786b58b729c0)
18(274) DEBUG: tm [h_table.c:133]: free_cell_helper(): freeing transaction 
0x786b58ceb770 from timer.c:651




-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3997
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3...@github.com>
_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org

Reply via email to