Browse Source

Fix the Jingle call rejection (on both sides)

Send the Jingle MessageRinging event when receiving a call
master
Timothée Jaussoin 1 week ago
parent
commit
59ab24cfdc
  1. 6
      app/Widgets/Visio/Visio.php
  2. 2
      app/Widgets/Visio/_visio_lobby.tpl
  3. 14
      src/Moxl/Stanza/Jingle.php
  4. 18
      src/Moxl/Xec/Action/Jingle/MessageRinging.php
  5. 3
      src/Moxl/Xec/Payload/JingleReject.php

6
app/Widgets/Visio/Visio.php

@ -22,6 +22,7 @@ use Moxl\Xec\Action\Jingle\MessageProceed;
use Moxl\Xec\Action\Jingle\MessagePropose;
use Moxl\Xec\Action\Jingle\MessageReject;
use Moxl\Xec\Action\Jingle\MessageRetract;
use Moxl\Xec\Action\Jingle\MessageRinging;
use Moxl\Xec\Action\Jingle\SessionInitiate;
use Moxl\Xec\Action\Jingle\SessionMute;
use Moxl\Xec\Action\Jingle\SessionTerminate;
@ -182,6 +183,11 @@ class Visio extends Base
Wrapper::getInstance()->iterate('jingle_message', (new Packet)->pack($message));
$ringing = new MessageRinging;
$ringing->setTo($packet->from)
->setId($packet->content['id'])
->request();
$this->ajaxGetLobby($packet->from, false, $packet->content['withVideo'], $packet->content['id']);
}

2
app/Widgets/Visio/_visio_lobby.tpl

@ -111,7 +111,7 @@
{$c->__('button.call')}
</button>
{else}
<button onclick="Visio_ajaxReject('{$contact->id|echapJS}', '{$id}'); MovimVisio.clear(); Dialog_ajaxClear()" class="button color red">
<button onclick="Visio_ajaxReject('{$fullJid|echapJS}', '{$id}'); MovimVisio.clear(); Dialog_ajaxClear()" class="button color red">
<i class="material-symbols">call_end</i>
{$c->__('button.refuse')}
</button>

14
src/Moxl/Stanza/Jingle.php

@ -46,6 +46,20 @@ class Jingle
\Moxl\API::sendDom($dom);
}
public static function messageRinging(string $to, string $id)
{
$dom = new \DOMDocument('1.0', 'UTF-8');
$message = $dom->createElementNS('jabber:client', 'message');
$message->setAttribute('to', $to);
$dom->appendChild($message);
$ringing = $dom->createElementNS('urn:xmpp:jingle-message:0', 'ringing');
$ringing->setAttribute('id', $id);
$message->appendChild($ringing);
\Moxl\API::sendDom($dom);
}
public static function messageProceed(string $to, string $id)
{
$dom = new \DOMDocument('1.0', 'UTF-8');

18
src/Moxl/Xec/Action/Jingle/MessageRinging.php

@ -0,0 +1,18 @@
<?php
namespace Moxl\Xec\Action\Jingle;
use Moxl\Xec\Action;
use Moxl\Stanza\Jingle;
class MessageRinging extends Action
{
protected $_to;
protected $_id;
public function request()
{
$this->store();
Jingle::messageRinging($this->_to, $this->_id);
}
}

3
src/Moxl/Xec/Payload/JingleReject.php

@ -9,9 +9,6 @@ class JingleReject extends Payload
{
public function handle(?\SimpleXMLElement $stanza = null, ?\SimpleXMLElement $parent = null)
{
// We can only reject the current session
if (!CurrentCall::getInstance()->hasId((string)$stanza->attributes()->id)) return;
$from = (string)$parent->attributes()->from;
if (!$stanza->muji) {

Loading…
Cancel
Save