summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_distributor.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-02-04 16:00:14 -0600
committerRichard Mudgett <rmudgett@digium.com>2017-02-20 16:28:28 -0600
commiteb9ae4f7cba333c4cd188c741a71c1f244071929 (patch)
tree540fe93f204a2156c1801a2aa7a55dfeb5bfd0e4 /res/res_pjsip/pjsip_distributor.c
parentd7433aa796e686e05d280c5343f0c8b2b7d32458 (diff)
res_pjsip: Record the serializer earlier on the tdata.
When PJPROJECT needs to do a DNS resolution and there is not a cached entry available, the SIP request message goes out on the PJSIP monitor thread instead of the original serializer thread. Thus when the response comes back it does not get processed by the original sending serializer. This patch records the serializer on tdata before passing a request message to PJPROJECT where it can in Asterisk code. There are several places in PJPROJECT for outbound registration and publishing support that would need to record the serializer. Unfortunately, without replacing the PJPROJECT DNS resolver as was done in v14 we cannot fix those without modifying PJPROJECT. Even if we backported the DNS resolver from v14, the outbound registration refresh timer does not go out on a serializer thread but the PJSIP monitor thread. Fortunately, Asterisk's outbound publish support doesn't use the auto refresh timer that would also not go out under the serializer thread. This patch is v13 only. ASTERISK-26669 ASTERISK-26738 Change-Id: I9997b9ed6dbcebd2c37d6a67dc6dcee9c78914a4
Diffstat (limited to 'res/res_pjsip/pjsip_distributor.c')
-rw-r--r--res/res_pjsip/pjsip_distributor.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index 82ca184d3..e076db3b8 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -29,12 +29,11 @@
static int distribute(void *data);
static pj_bool_t distributor(pjsip_rx_data *rdata);
-static pj_status_t record_serializer(pjsip_tx_data *tdata);
static pjsip_module distributor_mod = {
.name = {"Request Distributor", 19},
.priority = PJSIP_MOD_PRIORITY_TSX_LAYER - 6,
- .on_tx_request = record_serializer,
+ .on_tx_request = ast_sip_record_request_serializer,
.on_rx_request = distributor,
.on_rx_response = distributor,
};
@@ -65,16 +64,7 @@ struct unidentified_request{
/*! Pool of serializers to use if not supplied. */
static struct ast_taskprocessor *distributor_pool[DISTRIBUTOR_POOL_SIZE];
-/*!
- * \internal
- * \brief Record the task's serializer name on the tdata structure.
- * \since 14.0.0
- *
- * \param tdata The outgoing message.
- *
- * \retval PJ_SUCCESS.
- */
-static pj_status_t record_serializer(pjsip_tx_data *tdata)
+pj_status_t ast_sip_record_request_serializer(pjsip_tx_data *tdata)
{
struct ast_taskprocessor *serializer;