Closed smallmountains closed 6 years ago
I thought this was working for my previous Asterisk system, but while troubleshooting my current install the Debug/Test Run Scheme was failing the same on both boxes. A mystery to me, but I think this problem can easily be fixed.
The file that needs editing is /var/www/html/admin/modules/superfecta/sources/source-Send_to_XBMC.module
The first line I modified was
$my_dharma_params.="$my_xbmc_title,$my_xbmc_mess,$my_xbmc_time,$my_xbmc_icon";
to
$my_dharma_params ="$my_xbmc_title,$my_xbmc_mess,$my_xbmc_time,$my_xbmc_icon";
I believe the first line attempts to append the right side to itself, but it has not yet been defined and causes the error.
The second thing I needed was a check that the index "Pause_Playback" was set, as this too was throwing an error for me. An isset was added to ensure the index exists.
if (isset($run_param['Pause_PlayBack'])) {
$this->DebugPrint("Pausing Media on $host...",DEBUG_INFO);
$this->DebugPrint('<code>Pause URL: ' . $url2 . '</code>',DEBUG_ALL);
$value = $this->get_url_contents($url2);
}
I would add the isset check to all 3 of those conditions at the end of the original source, although the Pause_PlayBox is probably the only one that needs it because it's type of CheckBox. This was a quick fix to get the test to function. I am not familiar with the module, and a proper fix would require a bit more investigative work on my part to understand the code better. There could very well be additional fixes that are needed. I didn't trace the code back far enough to know if/when each index might be created,
My current install is using PHP 5.3.3.. I am wondering if handling of Undeclared Variables and indexes changed at some point, similar to how 7.2 breaks code with undefined constants.
Something else I learned while looking into all of this, was how to set my own icon to be displayed for the notifications.. This is controlled by the line
$my_xbmc_icon = "DefaultActor.png";
This value can be an absolute path to the image such as /tmp/images/picture.png, an http URL like http://www.cnn.com/logo.png or a "special://" format (see details on the Kodi site on its use) which I need since I run Kodi on multiple platforms. A neat thing you can do here is that you can do something like $my_xbmc_icon = "special://userdata/Thumbnails/".$phonestring.".png"; and have a different icon for each caller. Just place a file in the Thumbnails directory for each phone number... As the comment in the original code suggests, I actually added it as a $source_param so it is user-defined value in the UI.
I not really a developer so not terribly familiar with git and checking out code, merging/branching/forking or whatever is needed to post my changes, but I would be more than happy to share what I have if needed.
Hi @ffejtable
Your first fix was added back in April, but still hasn't been published. I added your second fix just now, which you can test by downloading from here:
If you run into any issues let me know, preferably by a note on the ticket here: https://issues.freepbx.org/browse/FREEPBX-17185
Great to hear. I have some improvements to add as well. I'll submit those as a feature request I suppose?
Hi @ffejtable:
Yes new feature requests at issues.freepbx.org
BTW, the required fromat for this has changed. First, this an extremely useful function. To let this die would be a shame. They have moved to a JSON method.
Error as follows.
Executing Send to XBMC Searching Send to XBMC ... result took 0.0008 seconds.
Converting result to UTF-8 Post CID retrieval processing Executing Superfecta Cache Caller ID data added to Superfecta_Cache. {"error":{"type":"Whoops\Exception\ErrorException","message":"Undefined variable: my_dharma_params","file":"\/var\/www\/html\/admin\/modules\/superfecta\/sources\/source-Send_to_XBMC.module","line":142}}