Browse Source
Fix #480, implement XEP-0215: External Service Discovery and use it to provide STUN/TURN servers to Visio
Fix #480, implement XEP-0215: External Service Discovery and use it to provide STUN/TURN servers to Visio
Fallback to the public listpull/932/head
11 changed files with 180 additions and 26 deletions
-
1CHANGELOG.md
-
1app/MessageBuffer.php
-
14app/Session.php
-
19app/widgets/Presence/Presence.php
-
23app/widgets/Visio/Visio.php
-
55app/widgets/Visio/visio.js
-
4app/widgets/Visio/visio.tpl
-
21database/migrations/20200419103403_add_external_services_to_sessions_table.php
-
7doap.xml
-
17lib/moxl/src/Moxl/Stanza/ExternalServices.php
-
44lib/moxl/src/Moxl/Xec/Action/ExternalServices/Get.php
@ -0,0 +1,21 @@ |
|||
<?php |
|||
|
|||
use Movim\Migration; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
|
|||
class AddExternalServicesToSessionsTable extends Migration |
|||
{ |
|||
public function up() |
|||
{ |
|||
$this->schema->table('sessions', function (Blueprint $table) { |
|||
$table->text('externalservices')->nullable(); |
|||
}); |
|||
} |
|||
|
|||
public function down() |
|||
{ |
|||
$this->schema->table('sessions', function (Blueprint $table) { |
|||
$table->dropColumn('externalservices'); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
<?php |
|||
|
|||
namespace Moxl\Stanza; |
|||
|
|||
use Moxl\Utils; |
|||
|
|||
class ExternalServices |
|||
{ |
|||
public static function request($to) |
|||
{ |
|||
$dom = new \DOMDocument('1.0', 'UTF-8'); |
|||
$query = $dom->createElementNS('urn:xmpp:extdisco:2', 'services'); |
|||
|
|||
$xml = \Moxl\API::iqWrapper($query, $to, 'get'); |
|||
\Moxl\API::request($xml); |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<?php |
|||
|
|||
namespace Moxl\Xec\Action\ExternalServices; |
|||
|
|||
use Moxl\Xec\Action; |
|||
use Moxl\Stanza\ExternalServices; |
|||
|
|||
class Get extends Action |
|||
{ |
|||
protected $_to; |
|||
|
|||
public function request() |
|||
{ |
|||
$this->store(); |
|||
ExternalServices::request($this->_to); |
|||
} |
|||
|
|||
public function handle($stanza, $parent = false) |
|||
{ |
|||
\Utils::debug($stanza->asXML()); |
|||
|
|||
$services = []; |
|||
foreach ($stanza->services->service as $service) { |
|||
$item = [ |
|||
'host' => (string)$service['host'], |
|||
'port' => (string)$service['port'], |
|||
'transport' => (string)$service['transport'], |
|||
'type' => (string)$service['type'] |
|||
]; |
|||
|
|||
if ($service['username'] && $service['password']) { |
|||
$item['username'] = (string)$service['username']; |
|||
$item['password'] = (string)$service['password']; |
|||
} |
|||
|
|||
array_push($services, $item); |
|||
} |
|||
|
|||
if (!empty($services)) { |
|||
$this->pack($services); |
|||
$this->deliver(); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue