]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
config: Improve documentation and behavior of outbound_proxy option. 83/5083/1
authorJoshua Colp <jcolp@digium.com>
Fri, 24 Feb 2017 17:49:59 +0000 (17:49 +0000)
committerJoshua Colp <jcolp@digium.com>
Fri, 24 Feb 2017 17:49:59 +0000 (17:49 +0000)
This change updates the documentation for the outbound_proxy option
to ensure it is consistently stated that a full SIP URI must be
provided for the option.

The res_pjsip_outbound_registration module has also been changed so
that the provided outbound_proxy value is checked to ensure it is a
URI and if not an error is output stating so.

ASTERISK-26782

Change-Id: I6c239a32274846fd44e65b44ad9bf6373479b593

configs/samples/pjsip.conf.sample
res/res_pjsip.c
res/res_pjsip_outbound_publish.c
res/res_pjsip_outbound_registration.c

index bb2ad94f82a55f5872dca51239d29163bacc43fb..337a89524e56a86277790c2d0b2518d8ff7459ec 100644 (file)
 ;moh_suggest=default    ; Default Music On Hold class (default: "default")
 ;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")
 ;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=========================
 ;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
index 9970d84f490c72b1379400d875b3acf8a5a18909..b3722a88a46a0b7b8d9743d74ffad414c08efdf1 100644 (file)
                                        </description>
                                </configOption>
                                <configOption name="outbound_proxy">
-                                       <synopsis>Proxy through which to send requests, a full SIP URI must be provided</synopsis>
+                                       <synopsis>Full SIP URI of the outbound proxy used to send requests</synopsis>
                                </configOption>
                                <configOption name="rewrite_contact">
                                        <synopsis>Allow Contact header to be rewritten with the source IP address-port</synopsis>
index 37f64481e9ca10c9f743e79f9b7ad7fff3d244eb..0273c6a68febef8a8f69015d45b95ae1248362c2 100644 (file)
@@ -68,7 +68,7 @@
                                        </description>
                                </configOption>
                                <configOption name="outbound_proxy" default="">
-                                       <synopsis>SIP URI of the outbound proxy used to send publishes</synopsis>
+                                       <synopsis>Full SIP URI of the outbound proxy used to send publishes</synopsis>
                                </configOption>
                                <configOption name="server_uri">
                                        <synopsis>SIP URI of the server and entity to publish to</synopsis>
index 122d5bb693a18f08f76f1ba6c67fff6137d12910..622df03f7721184cb1d048bb1eb3c7b6c3c0e9a2 100644 (file)
@@ -96,7 +96,7 @@
                                        </description>
                                </configOption>
                                <configOption name="outbound_proxy" default="">
-                                       <synopsis>Outbound Proxy used to send registrations</synopsis>
+                                       <synopsis>Full SIP URI of the outbound proxy used to send registrations</synopsis>
                                </configOption>
                                <configOption name="retry_interval" default="60">
                                        <synopsis>Interval in seconds between retries if outbound registration is unsuccessful</synopsis>
@@ -1210,6 +1210,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);