On Oct 07, 2010 at 12:53, Iñaki Baz Castillo ibc@aliax.net wrote:
2010/10/7 Andrei Pelinescu-Onciul andrei@iptel.org:
register_script_cb(callback, flags, callback_param)
where flags are a combination of POST_SCRIPT_CB or PRE_SCRIPT_CB and REQUEST_CB (request route), FAILURE_CB (failure route), ONREPLY_CB, BRANCH_CB, and ONSEND_CB. There are 3 more ERROR_CB, LOCAL_CB and EVENT_CB, but they are not used for now.
E.g. (from tm): /* register post-script clean-up function */ if (register_script_cb( w_t_unref, POST_SCRIPT_CB|REQUEST_CB, 0)<0 ) { LOG(L_ERR,"ERROR:tm:mod_init: failed to register POST request " "callback\n"); return -1; } if (register_script_cb( script_init, PRE_SCRIPT_CB|REQUEST_CB , 0)<0 ) { LOG(L_ERR,"ERROR:tm:mod_init: failed to register PRE request " "callback\n"); return -1; }
Great!
In my case the exported function can be invoked from any kind of route, and I don't want PV's to be cleaned when entering in branch_route so I expect that the callback should look as follows:
register_script_cb( clean_pvs, POST_SCRIPT_CB|REQUEST_CB|FAILURE_CB|ONREPLY_CB , 0 )
This is, I don't need to add BRANCH_CB or ONSEND_CB as I just want the PV to be cleaned after terminating the request/response process. branch_route and onsend_route run over the same process as request_route (or failure_route) so I don't need to include them, am I right?
Yes, you are.
Andrei