diff --git a/src/php/WhatsAppEvent.php b/src/php/WhatsAppEvent.php index 8e95b599..4787dd98 100644 --- a/src/php/WhatsAppEvent.php +++ b/src/php/WhatsAppEvent.php @@ -279,11 +279,12 @@ function fireGetAudio( } function fireGetError( - $phone, + $phone, + $id, $error ) { - $callbackEvent = function(WhatsAppEventListener $listener) use ($phone, $error) { - $listener->onGetError($phone, $error); + $callbackEvent = function(WhatsAppEventListener $listener) use ($phone, $id, $error) { + $listener->onGetError($phone, $id, $error); }; $this->fireCallback($callbackEvent); } diff --git a/src/php/events/WhatsAppEventListener.php b/src/php/events/WhatsAppEventListener.php index 3be8543c..613c20e5 100644 --- a/src/php/events/WhatsAppEventListener.php +++ b/src/php/events/WhatsAppEventListener.php @@ -116,6 +116,7 @@ function onGetAudio( function onGetError( $phone, // The user phone number including the country code. + $id, // The id of the request that caused the error $error // Array with error data for why request failed. ); diff --git a/src/php/events/WhatsAppEventListenerBase.php b/src/php/events/WhatsAppEventListenerBase.php index f43ef0fd..9212d3e8 100644 --- a/src/php/events/WhatsAppEventListenerBase.php +++ b/src/php/events/WhatsAppEventListenerBase.php @@ -121,7 +121,8 @@ function onGetAudio( ) {} function onGetError( - $phone, + $phone, + $id, $error ) {} diff --git a/src/php/events/WhatsAppEventListenerProxy.php b/src/php/events/WhatsAppEventListenerProxy.php index 4140346c..6f9b2e0c 100644 --- a/src/php/events/WhatsAppEventListenerProxy.php +++ b/src/php/events/WhatsAppEventListenerProxy.php @@ -144,7 +144,8 @@ function onGetAudio( } function onGetError( - $phone, + $phone, + $id, $error ) { $this->handleEvent(__FUNCTION__, func_get_args()); diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 0ea55eaa..28567e34 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -2172,6 +2172,7 @@ protected function processInboundDataNode(ProtocolNode $node, $autoReceipt = tru if ($node->getTag() == "iq" && $node->getAttribute('type') == "error") { $this->eventManager()->fireGetError( $this->phoneNumber, + $node->getAttribute( 'id' ), $node->getChild(0) ); }