signalwire-community / signalwire-php

PHP Library for SignalWire APIs
https://signalwire-community.github.io/docs/php/
MIT License
22 stars 26 forks source link

DM42.NET, LLC [SF/4839] The connected call does not expose peer properly #101

Closed ShashiKumar-SignalWire closed 4 years ago

ShashiKumar-SignalWire commented 4 years ago

When a call is connected to another number using the $call->connect() method, the $call object has $call->peer set to the call object of the 2nd leg. But the peer parameter of the call retrieved using getCall() is not set to the original call. This means it is not possible to reference the original call object using the peer object.

Since it is a "bridged" call, it would seem that these should point to each other.

EXAMPLE CODE:

$action = yield $call->connect(...$devices); if ($action->isSuccessful()) { $connected = $action->getCall(); }

$digitdetect1 = yield $connected->detectDigitAsync(); $digitdetect2 = yield $call->detectDigitAsync();

$detectcb = function($call,$params) { $call->peer->playSilence(1); print_r($params); };

$call->on('detect.update',$detectcb);

$connected->on('detect.update', $detectcb);

RESULT: When digits are detected on $connected, the following error occurs:

PHP Fatal error: Uncaught Error: Call to a member function playSilence() on null