[Asterisk-code-review] Fix issue when user runs Dial(PJSIP/ext@) without an endpoin... (asterisk[master])

snuffy asteriskteam at digium.com
Thu May 14 22:12:54 CDT 2015


snuffy has uploaded a new change for review.

  https://gerrit.asterisk.org/475

Change subject: Fix issue when user runs Dial(PJSIP/ext@) without an endpoint specified.
......................................................................

Fix issue when user runs Dial(PJSIP/ext@) without an endpoint specified.

This could happen when the dialplan variable for endpoint is not set.
Ensure we have an endpoint before asking for its aors.

Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e
---
M res/res_pjsip_session.c
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/75/475/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 98450109..9c48fd6 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -1442,9 +1442,12 @@
 	struct pjsip_inv_session *inv_session;
 	RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup);
 
-	/* If no location has been provided use the AOR list from the endpoint itself */
+	/* If no location has been provided use the AOR list from the endpoint itself if it exists */
 	if (location || !contact) {
-		location = S_OR(location, endpoint->aors);
+		location = S_OR(location, endpoint ? endpoint->aors : NULL);
+		if (ast_strlen_zero(location)) {
+			return NULL;
+		}
 
 		ast_sip_location_retrieve_contact_and_aor_from_list(location, &found_aor, &found_contact);
 		if (!found_contact || ast_strlen_zero(found_contact->uri)) {

-- 
To view, visit https://gerrit.asterisk.org/475
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9de76c2935a1f4e3f0cffe97a670106f5605e89e
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: snuffy <snuffy22 at gmail.com>



More information about the asterisk-code-review mailing list