Systems Recordings Module

miller357's picture

Not sure if this is the correct place or not to post some code for a fix the Systems Recordings Module. I hope not to get bashed to much but I do use Trixbox and maybe this is more there problem....don't know just wanted it fixed and wanted to give back.

The up and down arrows in the Systems Recordings (v-5.3.8.9) wasn't working correctly. While editing a recording with several child recordings if you clicked the down / up arrows to move the recordings it wouldn't move the record but would create and empty recording. I narrowed the problem down to some sting manipulations problems. I have attached some updated code that might prove useful.

foreach ($_REQUEST as $key => $val) {
		if (strpos($key,"_x") != 0) {
	      	$up = strpos($key, "up");
			$down = strpos($key, "down");
			$del = strpos($key, "del");
			
			if ($up !== false ) {
				$up = substr(substr($key,2), 0, strpos(substr($key,2), "_"));
				recordings_move_file_up($id, $up);
			}
			if ($del !== false ) {
				$del = substr(substr($key,3), 0, strpos(substr($key,3), "_"));
				recordings_delete_file($id, $del);
			}
			if ($down !== false ) {
				$down = substr(substr($key,4), 0, strpos(substr($key,4), "_"));
				recordings_move_file_down($id, $down);
			}
		}		
	}

__________________


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Please post this as a ticket

mickecarlsson's picture

Please post this as a ticket in the ticket tracker: http://freepbx.org/trac/newticket

Check the version in Module Administration for Recordings as the version that you posted does not exist (v-5.3.8.9), the current version for FreePBX is 3.3.8.8.

And when you are at it, please post as a .diff file so that we can track the actual file that you patched.


__________________

Mikael Carlsson
(I am off-line, tinkering with my Chevy and my radios, don't know when I will be back)


Will do.... Looks like a

miller357's picture

Will do....

Looks like a something is jacked up in the trixbox module list. The module lists version 5.3.8.9 but the changelog is 3.3.8.9

Thanks I will post a ticket. I just didn't know where to do that at.


actually - please confirm

p_lindheimer's picture

actually - please confirm this is an issue in FreePBX first, v-5.3.8.9 is from the trixbox fork, which means, even if it is broken and we do address it, you won't see the fix until they choose to bring it in.

And you won't be able to bring in ours through module admin because it will say you have a newer version, even if we have an update. (It's why trixbox bumped the number up to 5.x so that you can't pull in new FreePBX modules, you have to pull it when they are ready unless you manually do it and get around the versioning).


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


Good to know. I tried to

miller357's picture

Good to know. I tried to create a ticket but I get...

TICKET_CREATE_SIMPLE privileges are required to perform this operation

I will look at try to take a look at the latest FreePBX source and see if the problem exist.


you have to be authenticated

p_lindheimer's picture

you have to be authenticated to create a ticket, but see my message above before doing such, want to make sure it is a bug on ours. (And I checked on my system and can move them around - but I've got the 2.6 version loaded which has other changes in it).


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


Yes, just looked at the

miller357's picture

Yes, just looked at the source. Looks like the current code is....

	foreach ($_REQUEST as $key => $val) {
		if (strpos($key,"_") == 0) {
	      		$up = strpos($key, "up");

			$down = strpos($key, "down");
			$del = strpos($key, "del");
		}
		if ( $up !== false ) {
			$up = substr($key, 2);
			recordings_move_file_up($id, $up);
		}
		if ($del !== false ) {
			$del = substr($key,3);
			recordings_delete_file($id, $del);
		}
		if ($down !== false ) {
			$down = substr($key,4);
			recordings_move_file_down($id, $down);
		}
	}

After modification ....

	foreach ($_REQUEST as $key => $val) {
		if (strpos($key,"_x") != 0) {
	      	$up = strpos($key, "up");
			$down = strpos($key, "down");
			$del = strpos($key, "del");
			$del = strpos($key, "ins");
			
			if ($up !== false ) {
				$up = substr(substr($key,2), 0, strpos(substr($key,2), "_"));
				recordings_move_file_up($id, $up);
			}
			if ($del !== false ) {
				$del = substr(substr($key,3), 0, strpos(substr($key,3), "_"));
				recordings_delete_file($id, $del);
			}
			if ($down !== false ) {
				$down = substr(substr($key,4), 0, strpos(substr($key,4), "_"));
				recordings_move_file_down($id, $down);
			}
		}		
	}

For my last comment the

miller357's picture

For my last comment the "current" code was pulled from ...

http://freepbx.org/trac/browser/modules/release/2.6/recordings-3.3.8.8.t...


As this is a trixbox issue

mickecarlsson's picture

As this is a trixbox issue with their patched version of recording I think that your best shot will be by posting it as a bug in their tracker.


__________________

Mikael Carlsson
(I am off-line, tinkering with my Chevy and my radios, don't know when I will be back)


Will do thanks guys.

miller357's picture

Will do thanks guys.


miller357, normally I would

p_lindheimer's picture

miller357,

normally I would say to do an "svn log" to see why they put the change in their code. Problem is, trixbox does not give anyone access to their svn repository (assuming they even use one) last time I checked, so you are at their mercy as to why the change.


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here


Just to be clear, the new

miller357's picture

Just to be clear, the new code is a modification I made to get it working. The code for the functions.inc.php file from both trixbox and freepbx seems to be the same for the system recording module. I suppect this might have something to do with a web server, php or browser configuration.

No biggie, I submitted a request to the trixbox bug site.


thanks for the

p_lindheimer's picture

thanks for the clarification.

From a quick check, that code has not been changed since it was first introduced (r4147) so you may want to make sure there is not something weird in your environment.


__________________

Philippe Lindheimer - FreePBX Project Leader
FreePBX Training Opportunities - Click Here
Get Official Paid Support - Click Here