Browse Source

Merge pull request #38 from bmac901/patch-1

Fix for secure websocket registrations.

lazedo, understood regarding the upcoming chances but this is still very relevant to 3.19 :)

Thank you bmac901! This was a good catch and I can confirm this does resolve an issue with 3.19!
3.20
bitbashing 11 years ago
parent
commit
b0892be279
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      kamailio/registrar-role.cfg

+ 12
- 3
kamailio/registrar-role.cfg View File

@ -151,13 +151,22 @@ route[ATTEMPT_AUTHORIZATION]
$var(Expires) = REGISTRAR_MAX_EXPIRES; $var(Expires) = REGISTRAR_MAX_EXPIRES;
} }
if($(proto{s.tolower}) == "udp" || $(proto{s.tolower}) == "tcp" || $(proto{s.tolower}) == "tls") {
## Fix for wss websockets.
## RFC 7118 says transport MUST be "ws" not "wss"
## http://tools.ietf.org/html/rfc7118#section-5.2
if ($(proto{s.tolower}) == 'wss') {
$var(transport) = "ws";
} else {
$var(transport) = $(proto{s.tolower});
}
if($var(transport) == "udp" ||$var(transport) == "tcp" || $var(transport) == "tls") {
$var(return_port) = $Rp; $var(return_port) = $Rp;
} else { } else {
$var(return_port) = "5060"; $var(return_port) = "5060";
} }
$var(params) = "fs_path=<sip:" + $Ri + ":" + $var(return_port) + ";lr;received='" + $rz + ":" + $si + ":" + $sp + ";transport=" + $proto + "'>";
$var(params) = "fs_path=<sip:" + $Ri + ":" + $var(return_port) + ";lr;received='" + $rz + ":" + $si + ":" + $sp + ";transport=" + $var(transport) + "'>";
## TODO: fix escaping, some phones send us -- reg-id=1;+sip.instance="urn:uuid:9b8bd513-0e6e-4660-ad5e-5e35d88cc68f"; ## TODO: fix escaping, some phones send us -- reg-id=1;+sip.instance="urn:uuid:9b8bd513-0e6e-4660-ad5e-5e35d88cc68f";
## and if we can store it but not use it because it looses the escapes (that weren't there...) ## and if we can store it but not use it because it looses the escapes (that weren't there...)
@ -168,7 +177,7 @@ route[ATTEMPT_AUTHORIZATION]
if ($avp(AVP_RECV_PARAM) == $null) { if ($avp(AVP_RECV_PARAM) == $null) {
$var(fs_contact) = "<" + $(ct{tobody.uri}) + ";" + $var(params) + ">"; $var(fs_contact) = "<" + $(ct{tobody.uri}) + ";" + $var(params) + ">";
} else { } else {
$var(fs_contact) = "<sip:" + $(ct{tobody.user}) + "@" + $si + ":" + $sp + ";transport=" + $proto + ";" + $var(params) + ">";
$var(fs_contact) = "<sip:" + $(ct{tobody.user}) + "@" + $si + ":" + $sp + ";transport=" + $var(transport) + ";" + $var(params) + ">";
} }
$var(register_contants) = ' "Presence-Hosts" : "n/a", "Profile-Name" : "sipinterface_1", "Status" : "Registered", "Event-Timestamp" : "' + $TS + '", "Expires" : ' + $var(expires); $var(register_contants) = ' "Presence-Hosts" : "n/a", "Profile-Name" : "sipinterface_1", "Status" : "Registered", "Event-Timestamp" : "' + $TS + '", "Expires" : ' + $var(expires);


Loading…
Cancel
Save