]> 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:48:46 +0000 (14:48 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 8 Apr 2014 14:48:46 +0000 (14:48 +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

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

res/res_pjsip.c

index 091663a743db07bb9ab9003c8938dff3c73d78fd..76ebd53ad78d260cc14342bbb39c65eff7514093 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;
        }