forked from gmaruzz/saraphone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch.diff
65 lines (64 loc) · 2.19 KB
/
patch.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c
index 72c654fe46..dc784c5ac6 100644
--- a/src/mod/endpoints/mod_sofia/sofia_glue.c
+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c
@@ -291,6 +291,8 @@ sofia_transport_t sofia_glue_str2transport(const char *str)
{
if (!strncasecmp(str, "udp", 3)) {
return SOFIA_TRANSPORT_UDP;
+ } else if (!strncasecmp(str, "wss", 3)) {
+ return SOFIA_TRANSPORT_WSS;
} else if (!strncasecmp(str, "tcp", 3)) {
return SOFIA_TRANSPORT_TCP;
} else if (!strncasecmp(str, "sctp", 4)) {
diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c
index be27121cd1..d73a26107e 100644
--- a/src/mod/endpoints/mod_sofia/sofia_presence.c
+++ b/src/mod/endpoints/mod_sofia/sofia_presence.c
@@ -2235,6 +2235,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
sofia_transport_t transport = sofia_glue_str2transport(tp);
switch (transport) {
+ char * colon;
+ char * at;
+ char * username;
+ int username_lenght;
+
+ case SOFIA_TRANSPORT_WSS:
+ switch_strdup(username, full_from);
+ colon = strchr(username, ':');
+ at = strchr(username, '@');
+ username_lenght = at - colon;
+ username = colon;
+ username[username_lenght] = '\0';
+ contact = switch_mprintf("sip%s@%s:%s;transport=wss", username, remote_ip, remote_port);
+
+ contact_str = profile->public_url;
+
+ break;
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_public_contact;
break;
@@ -2250,6 +2267,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
} else {
sofia_transport_t transport = sofia_glue_str2transport(tp);
switch (transport) {
+ char * colon;
+ char * at;
+ char * username;
+ int username_lenght;
+
+ case SOFIA_TRANSPORT_WSS:
+ switch_strdup(username, full_from);
+ colon = strchr(username, ':');
+ at = strchr(username, '@');
+ username_lenght = at - colon;
+ username = colon;
+ username[username_lenght] = '\0';
+ contact = switch_mprintf("sip%s@%s:%s;transport=wss", username, remote_ip, remote_port);
+
+ contact_str = profile->url;
+
+ break;
case SOFIA_TRANSPORT_TCP:
contact_str = profile->tcp_contact;
break;