[OpenSIPS-Users] Asynchronous processing in OpenSIPS 1.12
razvan at opensips.org
Tue Sep 2 18:26:06 CEST 2014
Among the last discussion of the last IRC meeting was related to
Asynchronous processing in OpenSIPS script - we want to add a new
mechanism that allows you to perform asynchronous operations (such as DB
, REST or exec operations) directly from the script. Using this feature
will increase the throughput of OpenSIPS, since the SIP processes will
no longer be stuck waiting for I/O responses.
When reaching an asynchronous operation, the SIP message processing will
be stopped, and resumed in a different script route. In the script, this
should be reflected something like this:
# other non I/O operations
avp_db_query("SELECT setid from subscribers where username =
# we never get here.
xlog("The set used by the callee is $avp(setid)\n");
# continue message processing
Only the functions that are used in an "async" block will be ran
asynchronously. If the function does not support async processing, it
will block waiting for the response and resume in the route indicated by
the "async" block - so the scripting experience will be the same even if
the async OP could not be done.
In order to resume the processing in a different route, we need to store
a context of the message. This will be done using the transaction
module. If this module is not used, the asynchronous mechanism will
lirakis suggested to have different processes that waits for the
asynchronous I/O responses and continues the processing. However, we
think having the SIP worker processes resume the operations will behave
better, since we'll have fewer processes and we won't loose time with
How do you see this feature? How would you like to use it? Feel free to
contribute with any input you find suitable!
More information about the Users