summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2014-11-06 18:21:12 +0000
committerJoshua Colp <jcolp@digium.com>2014-11-06 18:21:12 +0000
commit47074f4bfd290b65e242f1aea767d85e39c5ea71 (patch)
tree18816581fca5cb119860cface4f313c683234fa8 /res/res_pjsip
parent4d80f223af2c3b46b3c9417ed66a4439070ac580 (diff)
res_pjsip: Ensure in-dialog responses have an endpoint associated.
When handling incoming messages we determine if it is associated with a dialog. If so we use that to determine what serializer and endpoint to use for the message. Previously this would pass the endpoint to the endpoint lookup module to actually place the endpoint completely on the message. For in-dialog responses, however, this did not occur as dialog processing took over and the endpoint lookup did not occur. This change just places the endpoint in the expected spot immediately instead of relying on the endpoint lookup module. In-dialog responses thus have the expected endpoint. AST-1459 #close Review: https://reviewboard.asterisk.org/r/4146/ ........ Merged revisions 427490 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 427491 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@427492 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/pjsip_distributor.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index c829db787..90744fdf0 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -153,6 +153,14 @@ static pjsip_dialog *find_dialog(pjsip_rx_data *rdata)
return dlg;
}
+static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata);
+
+static pjsip_module endpoint_mod = {
+ .name = {"Endpoint Identifier", 19},
+ .priority = PJSIP_MOD_PRIORITY_TSX_LAYER - 3,
+ .on_rx_request = endpoint_lookup,
+};
+
static pj_bool_t distributor(pjsip_rx_data *rdata)
{
pjsip_dialog *dlg = find_dialog(rdata);
@@ -178,7 +186,7 @@ static pj_bool_t distributor(pjsip_rx_data *rdata)
pjsip_rx_data_clone(rdata, 0, &clone);
if (dist) {
- clone->endpt_info.mod_data[distributor_mod.id] = dist->endpoint;
+ clone->endpt_info.mod_data[endpoint_mod.id] = ao2_bump(dist->endpoint);
}
ast_sip_push_task(serializer, distribute, clone);
@@ -191,14 +199,6 @@ end:
return PJ_TRUE;
}
-static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata);
-
-static pjsip_module endpoint_mod = {
- .name = {"Endpoint Identifier", 19},
- .priority = PJSIP_MOD_PRIORITY_TSX_LAYER - 3,
- .on_rx_request = endpoint_lookup,
-};
-
static struct ast_sip_auth *artificial_auth;
static int create_artificial_auth(void)
@@ -261,15 +261,13 @@ static pj_bool_t endpoint_lookup(pjsip_rx_data *rdata)
struct ast_sip_endpoint *endpoint;
int is_ack = rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD;
- endpoint = rdata->endpt_info.mod_data[distributor_mod.id];
+ endpoint = rdata->endpt_info.mod_data[endpoint_mod.id];
if (endpoint) {
- /* Bumping the refcount makes refcounting consistent whether an endpoint
- * is looked up or not */
- ao2_ref(endpoint, +1);
- } else {
- endpoint = ast_sip_identify_endpoint(rdata);
+ return PJ_FALSE;
}
+ endpoint = ast_sip_identify_endpoint(rdata);
+
if (!endpoint && !is_ack) {
char name[AST_UUID_STR_LEN] = "";
pjsip_uri *from = rdata->msg_info.from->uri;