Created
September 21, 2019 09:20
-
-
Save alfredh/44a84c6e48d0574e446c21e0bc102958 to your computer and use it in GitHub Desktop.
baresip with SIP over Websockets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/reg.c b/src/reg.c | |
index 198164c..874a6aa 100644 | |
--- a/src/reg.c | |
+++ b/src/reg.c | |
@@ -48,6 +48,8 @@ static int sipmsg_af(const struct sip_msg *msg) | |
case SIP_TRANSP_TCP: | |
case SIP_TRANSP_TLS: | |
+ case SIP_TRANSP_WS: | |
+ case SIP_TRANSP_WSS: | |
err = tcp_conn_local_get(sip_msg_tcpconn(msg), &laddr); | |
break; | |
diff --git a/src/ua.c b/src/ua.c | |
index a05fecf..b5de856 100644 | |
--- a/src/ua.c | |
+++ b/src/ua.c | |
@@ -1286,6 +1286,23 @@ static int add_transp_af(const struct sa *laddr) | |
} | |
#endif | |
+ err = sip_transp_add_websock(uag.sip, SIP_TRANSP_WS, &local, | |
+ false, NULL); | |
+ if (err) { | |
+ warning("ua: could not add Websock transport (%m)\n", err); | |
+ return err; | |
+ } | |
+ | |
+#ifdef USE_TLS | |
+ err = sip_transp_add_websock(uag.sip, SIP_TRANSP_WSS, &local, | |
+ false, uag.cfg->cert); | |
+ if (err) { | |
+ warning("ua: could not add secure Websock transport (%m)\n", | |
+ err); | |
+ return err; | |
+ } | |
+#endif | |
+ | |
return err; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment