]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip: Ignore explicit transport configuration if a WebSocket transport is specified.
authorJoshua Colp <jcolp@digium.com>
Tue, 8 Apr 2014 14:49:47 +0000 (14:49 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 8 Apr 2014 14:49:47 +0000 (14:49 +0000)
This change makes it so if a transport is configured on an endpoint that is a WebSocket
type the option will be ignored. In practice this is fine because the WebSocket
transport can not create outgoing connections, it can only reuse existing ones. By
ignoring the option the existing PJSIP logic for using the existing connection will
be invoked and stuff will proceed.

(closes issue ASTERISK-23584)
Reported by: Rusty Newton
........

Merged revisions 411927 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411928 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_pjsip.c

index 3ff60ee5b4b4d76f96bfb57911c9ab3da5a15a83..0cf162a2257fc434231d23306b1ea6a3aacddd02 100644 (file)
@@ -1494,6 +1494,12 @@ static int sip_get_tpselector_from_endpoint(const struct ast_sip_endpoint *endpo
        } else if (transport->state->factory) {
                selector->type = PJSIP_TPSELECTOR_LISTENER;
                selector->u.listener = transport->state->factory;
+       } else if (transport->type == AST_TRANSPORT_WS || transport->type == AST_TRANSPORT_WSS) {
+               /* The WebSocket transport has no factory as it can not create outgoing connections, so
+                * even if an endpoint is locked to a WebSocket transport we let the PJSIP logic
+                * find the existing connection if available and use it.
+                */
+               return 0;
        } else {
                return -1;
        }