Skip to content

Commit 5f2f7d1

Browse files
authored
Fix BLF (presence) in FreeSWITCH via wss (#10)
Source for this patch Giovanni Maruzzelli gmaruzz/saraphone@2955e10
1 parent d8481a9 commit 5f2f7d1

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

src/mod/endpoints/mod_sofia/sofia_presence.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,6 +2234,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
22342234
sofia_transport_t transport = sofia_glue_str2transport(tp);
22352235

22362236
switch (transport) {
2237+
char * colon;
2238+
char * at;
2239+
char * username;
2240+
int username_lenght;
2241+
2242+
case SOFIA_TRANSPORT_WSS:
2243+
switch_strdup(username, full_from);
2244+
colon = strchr(username, ':');
2245+
at = strchr(username, '@');
2246+
username_lenght = at - colon;
2247+
username = colon;
2248+
username[username_lenght] = '\0';
2249+
contact = switch_mprintf("sip%s@%s:%s;transport=wss", username, remote_ip, remote_port);
2250+
2251+
contact_str = profile->public_url;
2252+
2253+
break;
22372254
case SOFIA_TRANSPORT_TCP:
22382255
contact_str = profile->tcp_public_contact;
22392256
break;
@@ -2249,6 +2266,23 @@ static void _send_presence_notify(sofia_profile_t *profile,
22492266
} else {
22502267
sofia_transport_t transport = sofia_glue_str2transport(tp);
22512268
switch (transport) {
2269+
char * colon;
2270+
char * at;
2271+
char * username;
2272+
int username_lenght;
2273+
2274+
case SOFIA_TRANSPORT_WSS:
2275+
switch_strdup(username, full_from);
2276+
colon = strchr(username, ':');
2277+
at = strchr(username, '@');
2278+
username_lenght = at - colon;
2279+
username = colon;
2280+
username[username_lenght] = '\0';
2281+
contact = switch_mprintf("sip%s@%s:%s;transport=wss", username, remote_ip, remote_port);
2282+
2283+
contact_str = profile->url;
2284+
2285+
break;
22522286
case SOFIA_TRANSPORT_TCP:
22532287
contact_str = profile->tcp_contact;
22542288
break;

0 commit comments

Comments
 (0)