An example is event_route[htable:mod-init] which is executed by htable module when it is initialized. Practically, the event_route is executed once, when Kamailio (OpenSER) starts. The main goal for event_route[htable:mod-init] is to allow initializations at startup -- can be variables from htable or other modules.
...
event_route[htable:mod-init] {
$sht(a=>x) = 1;
$shv(counter) = 0;
sql_query("insert into restarts (start_time) values ('$Tf')");
}
...
Another event_route is exported by tm module: event_route[tm:local-request] - which is executed when tm generates internally and sends a SIP request. Such cases are:
- SIP messages sent by msilo module
- SIP messages sent by presence server
- SIP messages sent by dialog module
- SIP messages sent via MI or CTL interfaces
- log details about local request
- account the local request
- apply filters to local generated requests
...Among the benefits of event_route:
event_route[tm:local-request] {
xlog("request [$rm] from [$fu] to [$ru]\n");
}
...
- new events can be exported and fired by any module
- no need to extend the config grammar when adding a new event
- various variables can be made available when the event is fired to be used inside the event_route
- no need to have SIP message to be processed
- when a location contact expires
- timer-based events (rtimer module to migrate from using route to using event_route blocks)
- when dialog module sends BYE on timeout
No comments:
Post a Comment