[asterisk-dev] [Code Review] 4585: res_pjsip: Refactor endpt_send_request to include transaction timeout
George Joseph
reviewboard at asterisk.org
Fri Apr 10 19:34:53 CDT 2015
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4585/
-----------------------------------------------------------
(Updated April 10, 2015, 6:34 p.m.)
Review request for Asterisk Developers, Joshua Colp and Mark Michelson.
Changes
-------
Removed ast_sched in favor of pj_timer. This should address Josh's comments and it's a lot easier to implement than ast_sched.
Re-ran all pjsip testsuite tests. 145 of 145 passed.
Repository: Asterisk
Description (updated)
-------
This is the first follow-on to https://reviewboard.asterisk.org/r/4572/ and the discussion at http://lists.digium.com/pipermail/asterisk-dev/2015-March/073921.html
Since we currently have no control over pjproject transaction timeout, this patch pulls the pjsip_endpt_send_request function out of pjproject and into res_pjsip/endpt_send_transaction in order to implement that capability.
Now when the transaction is initiated, we also schedule our own pj_timer with our own desired timeout.
If the transaction completes before either timeout, pjproject cancels its timer, and calls our tsx callback where we cancel our timer and run the app callback.
If the pjproject timer times out first, pjproject calls our tsx callback where we cancel our timer and run the app callback.
If our timer times out first, we terminate the transaction which causes pjproject to cancel its timer and call our tsx callback where we run the app callback.
Regardless of the scenario, pjproject is calling the tsx callback inside the group_lock and there are checks in the callback to make sure it doesn't run twice.
As part of this patch ast_sip_send_out_of_dialog_request was created to replace its similarly named private function. It takes 2 new arguments... A timeout in milliseconds (<= 0 to disable the timeout) and a ** to a pjsip_transaction structure in case the caller wants to do something else with the transaction.
I'll be working on a pjproject patch in my spare (!) time.
Diffs (updated)
-----
branches/13/res/res_pjsip.c 434672
branches/13/include/asterisk/res_pjsip.h 434672
Diff: https://reviewboard.asterisk.org/r/4585/diff/
Testing
-------
Tested that both of the pjsip timeout and asterisk timeout scenarios work and clean up properly.
All pjsip testsuite tests that worked before the change still work after the change. A new testsuite test will be written when the companion pjsip_options work is done.
Thanks,
George Joseph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150411/f7b0d745/attachment-0001.html>
More information about the asterisk-dev
mailing list