<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
		<id>https://siprtc.azurewebsites.net/index.php?action=history&amp;feed=atom&amp;title=M8</id>
		<title>M8 - Versionsgeschichte</title>
		<link rel="self" type="application/atom+xml" href="https://siprtc.azurewebsites.net/index.php?action=history&amp;feed=atom&amp;title=M8"/>
		<link rel="alternate" type="text/html" href="https://siprtc.azurewebsites.net/index.php?title=M8&amp;action=history"/>
		<updated>2026-05-06T14:32:58Z</updated>
		<subtitle>Versionsgeschichte dieser Seite in sipRTC</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://siprtc.azurewebsites.net/index.php?title=M8&amp;diff=15&amp;oldid=prev</id>
		<title>Admin: Die Seite wurde neu angelegt: „== Umsetzung Variante 1 ==   === Server === Der untenstehende Code ist leicht abgeändert, da für die Konfiguration für einen sicheren WebSocket-Server noch…“</title>
		<link rel="alternate" type="text/html" href="https://siprtc.azurewebsites.net/index.php?title=M8&amp;diff=15&amp;oldid=prev"/>
				<updated>2018-03-06T21:18:39Z</updated>
		
		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „== Umsetzung Variante 1 ==   === Server === Der untenstehende Code ist leicht abgeändert, da für die Konfiguration für einen sicheren WebSocket-Server noch…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Umsetzung Variante 1 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Server ===&lt;br /&gt;
Der untenstehende Code ist leicht abgeändert, da für die Konfiguration für einen sicheren WebSocket-Server noch weiterer Code nötig ist.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot; line&amp;gt;&lt;br /&gt;
var calleeReady = false;&lt;br /&gt;
&lt;br /&gt;
var WebSocketServer = require('ws').Server&lt;br /&gt;
  , wss = new WebSocketServer({ port: 4001 });&lt;br /&gt;
&lt;br /&gt;
wss.on('connection', function connection(ws) {&lt;br /&gt;
  ws.on('message', function message(data) {&lt;br /&gt;
    if (data == 'calleeReady') {&lt;br /&gt;
      calleeReady = true;&lt;br /&gt;
    } else if (data == 'calleeBusy') {&lt;br /&gt;
      calleeReady = false;&lt;br /&gt;
    } else if (data == 'stateRequest') {&lt;br /&gt;
      if (calleeReady) {&lt;br /&gt;
        ws.send('calleeReady')&lt;br /&gt;
      } else {&lt;br /&gt;
        ws.send('calleeBusy')&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    // Broadcast to everyone else.&lt;br /&gt;
    wss.clients.forEach(function each(client) {&lt;br /&gt;
      if (client !== ws) {&lt;br /&gt;
        client.send(data);&lt;br /&gt;
      }&lt;br /&gt;
    });&lt;br /&gt;
  });&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Browser Apotheke ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot; line&amp;gt;&lt;br /&gt;
var connection = new WebSocket('wss://pbx.prbox.biz:4001');&lt;br /&gt;
	&lt;br /&gt;
// When the connection is open, send some data to the server&lt;br /&gt;
connection.onopen = function () {&lt;br /&gt;
  connection.send('Ping'); // Send the message 'Ping' to the server&lt;br /&gt;
};&lt;br /&gt;
	&lt;br /&gt;
connection.onclose = function() {&lt;br /&gt;
  connection.send('calleeBusy');&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var userAgent = new SIP.UA( {&lt;br /&gt;
  // ... configuration of SIP UA&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
userAgent.on('connected', function() {&lt;br /&gt;
  connection.send('calleeReady');&lt;br /&gt;
  // rest of code when UA is connected to WSS&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
userAgent.on('disconnected', function() {&lt;br /&gt;
  connection.send('calleeBusy');&lt;br /&gt;
  // rest of code when UA is disconnected to WSS&lt;br /&gt;
})&lt;br /&gt;
&lt;br /&gt;
userAgent.on('invite', function(session) {&lt;br /&gt;
  connection.send('calleeBusy');&lt;br /&gt;
  // rest of code when INVITE is received&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
window.onunload = function() {&lt;br /&gt;
  connection.send('calleeBusy');&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Browser Besucher===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot; line&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
  &amp;lt;input id=&amp;quot;calleeState&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
var connection = new WebSocket('wss://pbx.prbox.biz:4001');&lt;br /&gt;
	&lt;br /&gt;
connection.onopen = function () {&lt;br /&gt;
  connection.send('stateRequest'); // Request state of callee&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
connection.onmessage = function (e) {&lt;br /&gt;
  if (e.data == 'calleeReady') {&lt;br /&gt;
    $('#calleeState').val('Callee Ready');&lt;br /&gt;
    $('#calleeState').css(&amp;quot;background-color&amp;quot;, &amp;quot;#0F0&amp;quot;);&lt;br /&gt;
  } else if (e.data == 'calleeBusy') {&lt;br /&gt;
    $('#calleeState').val('Callee Busy');&lt;br /&gt;
    $('#calleeState').css(&amp;quot;background-color&amp;quot;, &amp;quot;#F00&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>