[sr-dev] more on asynchronous processing in config

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 5 12:04:37 CEST 2011


Hello,

over the weekend I exported to config file the two main functions from 
tm that allow to suspend the execution of a SIP request and resume it in 
another place. They are exported through tmx module:
- t_suspend() - will suspend the execution of current sip request and 
then you can do something else (like processing the next request)
- t_continue(tindex, tlabel, rtname) - continue the processing of SIP 
request suspended in the transaction identified by tupple 
(tindex,tlable) with the actions in route[rtname]

After t_suspend() you can get the transaction identifier (tindex, 
tlable) via pseudo-variables $T(id_index) and $T(id_label), e.g.:

if(t_suspend()) {
    xlog("sip request suspended in transaction 
[$T(id_index)/$T(id_label)]\n");
    exit;
}

One example of usage can be passing the $T(id_index) and $T(id_label) 
via mqueue to another process for further handling.

So, besides the new additions, now following cfg tools can be used to do 
asynchronous operations directly via config:
- the mqueue + rtimer module - pass a task via mqueue and get it in 
rtimer specific processes to run it further
- async module - intended to collect asynchronous specific 
implementation, for now able to sleep and execute a specific route after 
a time interval

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-dev mailing list