]> git.ipfire.org Git - thirdparty/asterisk.git/commit
res_pjsip: Refactor endpt_send_request to include transaction timeout 43/43/8
authorGeorge Joseph <george.joseph@fairview5.com>
Sat, 11 Apr 2015 21:39:29 +0000 (15:39 -0600)
committerGeorge Joseph <george.joseph@fairview5.com>
Thu, 16 Apr 2015 17:31:31 +0000 (12:31 -0500)
commitbf46799f0e9836fc6c84b9c814faef4156e625d9
treec621bd3e1137817fc56bff57a3fc1838a3a9529f
parent5d218cde872ed3fa2dc5ad92ed3a17b413ce8203
res_pjsip: Refactor endpt_send_request to include transaction timeout

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 a new timeout argument in
milliseconds (<= 0 to disable the timeout).

ASTERISK-24863 #close
Reported-by: George Joseph <george.joseph@fairview5.com>
Tested-by: George Joseph <george.joseph@fairview5.com>
Change-Id: I0778dc730d9689c5147a444a04aee3c1026bf747
include/asterisk/res_pjsip.h
res/res_pjsip.c