diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample
index 4d7195f00a..b18fdb276e 100644
--- a/configs/samples/pjsip.conf.sample
+++ b/configs/samples/pjsip.conf.sample
@@ -642,7 +642,7 @@
; when placing on hold and sendrecv when taking off hold
;outbound_auth= ; Authentication object used for outbound requests (default:
; "")
-;outbound_proxy= ; Proxy through which to send requests a full SIP URI
+;outbound_proxy= ; Proxy through which to send requests, a full SIP URI
; must be provided (default: "")
;rewrite_contact=no ; Allow Contact header to be rewritten with the source
; IP address port (default: "no")
@@ -877,8 +877,8 @@
;qualify_timeout=3.0 ; Qualify timeout in fractional seconds (default: "3.0")
;authenticate_qualify=no ; Authenticates a qualify request if needed
; (default: "no")
-;outbound_proxy= ; Outbound proxy used when sending OPTIONS request
- ; (default: "")
+;outbound_proxy= ; Proxy through which to send OPTIONS requests, a full SIP URI
+ ; must be provided (default: "")
;==========================SYSTEM SECTION OPTIONS=========================
@@ -1044,8 +1044,8 @@
;max_retries=10 ; Maximum number of registration attempts (default: "10")
;outbound_auth= ; Authentication object to be used for outbound registrations
; (default: "")
-;outbound_proxy= ; Outbound Proxy used to send registrations (default:
- ; "")
+;outbound_proxy= ; Proxy through which to send registrations, a full SIP URI
+ ; must be provided (default: "")
;retry_interval=60 ; Interval in seconds between retries if outbound
; registration is unsuccessful (default: "60")
;forbidden_retry_interval=0 ; Interval used when receiving a 403 Forbidden
diff --git a/res/res_pjsip.c b/res/res_pjsip.c
index 9782cc9976..810b6d3297 100644
--- a/res/res_pjsip.c
+++ b/res/res_pjsip.c
@@ -349,7 +349,7 @@
- Proxy through which to send requests, a full SIP URI must be provided
+ Full SIP URI of the outbound proxy used to send requests
Allow Contact header to be rewritten with the source IP address-port
diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index 53eb6aca78..a19a9bb244 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -69,7 +69,7 @@
- SIP URI of the outbound proxy used to send publishes
+ Full SIP URI of the outbound proxy used to send publishes
SIP URI of the server and entity to publish to
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 137f3a8328..3b635a159c 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -96,7 +96,7 @@
- Outbound Proxy used to send registrations
+ Full SIP URI of the outbound proxy used to send registrations
Interval in seconds between retries if outbound registration is unsuccessful
@@ -1209,6 +1209,17 @@ static int sip_outbound_registration_regc_alloc(void *data)
return -1;
}
+ if (!ast_strlen_zero(registration->outbound_proxy)) {
+ pj_strdup2_with_null(pool, &tmp, registration->outbound_proxy);
+ uri = pjsip_parse_uri(pool, tmp.ptr, tmp.slen, 0);
+ if (!uri) {
+ ast_log(LOG_ERROR, "Invalid outbound proxy URI '%s' specified on outbound registration '%s'\n",
+ registration->outbound_proxy, ast_sorcery_object_get_id(registration));
+ pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
+ return -1;
+ }
+ }
+
pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);