Hi,
I'm working on a jsonrpc (client) module that we would like to make async, using t_suspend and t_continue from the tm module. I have a couple questions related to this.
The way I understand these functions, t_suspend will freeze the transaction in shared memory and immediately return and t_continue will unfreeze the transaction. What I'm not clear on here is whether t_continue will continue processing of the transaction within the process that calls t_continue, or will it delegate to a worker process?
I assume I should spawn an io process in child_init which will be responsible for sending/receiving on the socket(s), but what is the best way to communicate between processes? Is there a way to get a fd from fork_process (that can be written to by any child and read from using select() in the io thread)?
This is my first attempt at a real module, so any pointers are greatly appreciated.
Regards, Matthew WIlliams
Hello,
just to close this thread. A new module named async has been introduced in GIT master, showing how to use the tm functions for asynchronous sip request processing.
It should answer the questions posted in this message.
Cheers, Daniel
On 6/24/11 1:00 PM, Matthew Williams wrote:
Hi,
I'm working on a jsonrpc (client) module that we would like to make async, using t_suspend and t_continue from the tm module. I have a couple questions related to this.
The way I understand these functions, t_suspend will freeze the transaction in shared memory and immediately return and t_continue will unfreeze the transaction. What I'm not clear on here is whether t_continue will continue processing of the transaction within the process that calls t_continue, or will it delegate to a worker process?
I assume I should spawn an io process in child_init which will be responsible for sending/receiving on the socket(s), but what is the best way to communicate between processes? Is there a way to get a fd from fork_process (that can be written to by any child and read from using select() in the io thread)?
This is my first attempt at a real module, so any pointers are greatly appreciated.
Regards, Matthew WIlliams
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
2011/6/27 Daniel-Constantin Mierla miconda@gmail.com:
just to close this thread. A new module named async has been introduced in GIT master, showing how to use the tm functions for asynchronous sip request processing.
Hi Daniel, good addition. Let me a question, the module description says:
-------------------- Note that after invoking the an asyncronous operation, the processing will continue later, in another application process. Therefore, do not rely on variables stored in private memory, used shared memory if you want to get values after the processing is resumend (e.g., $shv(...) of htable $sht(...)). ---------------------
I assume that using AVP's is also valid (as AVP's are stored within the transaction), perhaps the doc could also mention them?
On 6/27/11 11:44 AM, Iñaki Baz Castillo wrote:
2011/6/27 Daniel-Constantin Mierlamiconda@gmail.com:
just to close this thread. A new module named async has been introduced in GIT master, showing how to use the tm functions for asynchronous sip request processing.
Hi Daniel, good addition. Let me a question, the module description says:
Note that after invoking the an asyncronous operation, the processing will continue later, in another application process. Therefore, do not rely on variables stored in private memory, used shared memory if you want to get values after the processing is resumend (e.g., $shv(...) of htable $sht(...)).
I assume that using AVP's is also valid (as AVP's are stored within the transaction), perhaps the doc could also mention them?
Hi Inaki,
yes, transaction avps and xavps should be also available when resuming the processing. You can add a phrase to explain that at your convenience.
Thanks, Daniel
2011/6/27 Daniel-Constantin Mierla miconda@gmail.com:
Hi Inaki,
yes, transaction avps and xavps should be also available when resuming the processing. You can add a phrase to explain that at your convenience.
Ok, added.
Thanks a lot.