When I use this code I am getting callbacks on outbound messages. Below is the error log:I found some code in the sms_email.php that has a little different syntax for array access. If the above doesn't work, try this:
PHP:if ($debug) { error_log('[SMS] REQUEST: ' . print_r($data, true)); if (gettype($data)=="array") { error_log('[SMS] data-type(from array): ' . print_r($data[0]->type)); //error_log('[SMS] data-type(from array): ' . print_r($data[0]['type'])); //error_log('[SMS] data-type: ' . print_r($data->type, true)); } }
PHP message: [SMS] REQUEST: Array
(
[0] => stdClass Object
(
[time] => 2021-03-31T23:44:16.875Z
[type] => message-delivered
[to] => +1XXXXXXXXX
[description] => ok
[message] => stdClass Object
(
[id] => 1617234255871xccipaw5tn6ey662
[owner] => +1XXXXXXXXX
[applicationId] => XXXXXXXXXXXX
[time] => 2021-03-31T23:44:15.871Z
[segmentCount] => 1
[direction] => out
[to] => Array
(
[0] => +1XXXXXXXXX
)
[from] => +1XXXXXXXXX
[text] =>
[tag] =>
)
)
)
PHP message: [SMS] data-type(from array): 1
PHP message: TO: 0
PHP message: FROM: 0
PHP me
Incoming messages I am getting blank. below is the incoming message error log:
2021/03/31 18:44:44 [error] 582#0: *185 FastCGI sent in stderr: "PHP message: [SMS] REQUEST: Array
(
[USER] => www-data
[HOME] => /var/www
[HTTP_CONTENT_TYPE] => application/json; charset=utf-8
[HTTP_USER_AGENT] => bandwidth-api
[HTTP_ACCEPT_ENCODING] => gzip
[HTTP_CONNECTION] => Keep-Alive
[HTTP_HOST] => call.teleprime.com
[HTTP_CONTENT_LENGTH] => 395
[SCRIPT_FILENAME] => /var/www/fusionpbx/app/sms/hook/sms_hook_bandwidth.php
[REDIRECT_STATUS] => 200
[SERVER_NAME] => fusionpbx
[SERVER_PORT] => 443
[SERVER_ADDR] => 158.69.31.48
[REMOTE_PORT] => 44680
[REMOTE_ADDR] => 52.72.24.132
[SERVER_SOFTWARE] => nginx/1.6.2
[GATEWAY_INTERFACE] => CGI/1.1
[HTTPS] => on
[SERVER_PROTOCOL] => HTTP/1.1
[DOCUMENT_ROOT] => /var/www/fusionpbx
[DOCUMENT_URI] => /app/sms/hook/sms_hook_bandwidth.php
[REQUEST_URI] => /app/sms/hook/sms_hook_bandwidth.php
[SCRIPT_NAME] => /app/sms/hook/sms_hook_bandwidth.php
[CONTENT_LENGTH] => 395
[CONTENT_TYPE] => application/json; charset=utf-8
[REQUEST_ME...
PHP message: [SMS] REQUEST: Array
(
[0] => stdClass Object
(
[time] => 2021-03-31T23:44:43.209Z
[type] => message-received
[to] => +1XXXXXXXXXXXXXXXXXXXX
[description] => Incoming message received
[message] => stdClass Object
(
[id] => 6eee7880-6b12-4cfa-b149-475a67ceda9f
[owner] => +1XXXXXXXXXXXXXXX
[applicationId] => XXXXXXXXXXXXXXXXX
[time] => 2021-03-31T23:44:43.112Z
[segmentCount] => 1
[direction] => in
[to] => Array
(
[0] => +XXXXXXXXXX
)
[from] => +1XXXXXX
[text] => Code 2 inbound
)
)
)
PHP message: [SMS] data-type(from array): 1
PHP message: TO: 0
PHP message: FR
2021/03/31 18:44:45 [error] 582#0: *180 FastCGI sent in stderr: "PHP message: SQL: select domain_name, extension, sms_message_uuid,start_stamp,from_number,to_number,message,direction from v_sms_messages, v_domains, v_extensions where v_sms_messages.domain_uuid = v_domains.domain_uuid and v_sms_messages.extension_uuid = v_extensions.extension_uuid and v_domains.domain_uuid = :domain_uuid order by start_stamp DESC" while reading response header from upstream, client: 49.204.180.26, server: fusionpbx, request: "GET /app/sms/sms_mdr.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "call.teleprime.com", referrer: "https://call.teleprime.com/app/sms/sms.php"