From: Joshua Colp Date: Sat, 15 Nov 2014 21:35:12 +0000 (+0000) Subject: chan_pjsip: Add additional log message when an AOR is specified when dialing and... X-Git-Tag: 12.8.0-rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=12ba2a7007383c7745b5c1234d5f618990b63da6;p=thirdparty%2Fasterisk.git chan_pjsip: Add additional log message when an AOR is specified when dialing and it does not exist. ASTERISK-24499 #close Reported by: Rusty Newton git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@428007 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index c5528a75b5..a682f4f532 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1710,6 +1710,7 @@ static int request(void *obj) struct ast_sip_session *session = NULL; char *tmp = ast_strdupa(req_data->dest), *endpoint_name = NULL, *request_user = NULL; RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup); + struct ast_sip_aor *aor = NULL; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(endpoint); @@ -1739,9 +1740,16 @@ static int request(void *obj) ast_log(LOG_ERROR, "Unable to create PJSIP channel - endpoint '%s' was not found\n", endpoint_name); req_data->cause = AST_CAUSE_NO_ROUTE_DESTINATION; return -1; + } else if (!ast_strlen_zero(args.aor) && (!(aor = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "aor", args.aor)))) { + ast_log(LOG_ERROR, "Unable to create PJSIP channel - AOR '%s' was not found\n", args.aor); + req_data->cause = AST_CAUSE_NO_ROUTE_DESTINATION; + return -1; } + ao2_cleanup(aor); + if (!(session = ast_sip_session_create_outgoing(endpoint, NULL, args.aor, request_user, req_data->caps))) { + ast_log(LOG_ERROR, "Failed to create outgoing session to endpoint '%s'\n", endpoint_name); req_data->cause = AST_CAUSE_NO_ROUTE_DESTINATION; return -1; }