[Home]

Summary:ASTERISK-18279: on-demand recording (*1) filename not being generated correctly due to incorrect uniqueid in filename
Reporter:John Knight (classiccitytelco)Labels:
Date Opened:2011-08-16 23:07:04Date Closed:2011-09-20 16:33:02
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Features
Versions:1.8.5.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:CentOS 6.0 OpenVZ containerAttachments:
Description:Made outbound call from extension through SIP trunk to cell phone.   The file name is being created as follows (from the asterisk CLI):

' > User hit '*1' to record call. filename: wav,auto-1313553322-7065551212-17065559203,m'

The actual uniqueid being generated in the cdr database is "1313553311.73" which does not match "1313553322".

FreePBX 2.8 is being used to write the asterisk configuration files with mysql hosting its database.

Asterisk Add-on's has been set to compile in the Asterisk build process (as is a new in 1.8).

The recording's filename is being written as "auto-1313553322-7065551212-17065559203.wav".
Comments:By: John Knight (classiccitytelco) 2011-08-16 23:11:06.781-0500

I'm pulling out the latest in the 1.8 svn trunk to determine if this issue has been resolved in the svn and will report shortly.

By: John Knight (classiccitytelco) 2011-08-16 23:25:46.670-0500

save issue with Asterisk SVN-branch-1.8-r332176 :

from the cli:
" > User hit '*1' to record call. filename: wav,auto-1313554898-7065550201-17065559203,m"

the real uniqueid in the cdr database is "1313554889.0", not "1313554898" as shown when Asterisk is writing the call.  

By: Michael L. Young (elguero) 2011-08-17 11:26:44.378-0500

This should be filed under Features instead of resources/res_monitor.

I just looked at the current code and it uses the current system time() when it sets up the filename for the recording.  It is not based on the uniqueid that is in the cdr.  So, there is no bug here from what I can see.

If you would like to have the filename contain the uniqueid you can check into setting the variable TOUCH_MONITOR or TOUCH_MIXMONITOR depending one which app you are using to record.

By: John Knight (classiccitytelco) 2011-08-17 17:53:07.911-0500

If this is working as intended, this is inconsistent with all other forms of Asterisk writing call recordings to disk.  

For example, if 'automon => *1' is set in features.conf, ondemand recording writes the filename with what you're saying is current system time(), however all other instances of asterisk writing a recording to file use the uniqueid when writing out the filename of the call recording.

Example:

1313621245.21 is the uniqueid generated and stored in the cdr for a call recording that was not created with the *1 automon configuration set.   It is stored with the filename 'OUT100-20110817-184725-1313621245.21.wav' which included the uniqueid.  

Relying on a single way to tie call recordings to their respective cdr entries using uniqueid is broken in this case for call recordings set off by the 'automon => *1' option for a naming convention that isn't used by any other type of call recording.

By: Rob Bosch (ip-rob) 2011-08-22 07:30:11.487-0500

The TOUCH_MONITOR and TOUCH_MIXMONITOR options do not have anything that will allow the unique ID of the call to be inserted into the file name unless the entire file name is specified...which I would agree is inconsistent with all the other file recording methods used by asterisk.  I think the file name should be consistent with other recordings to allow matching with the CDR records without a large amount of dialplan scripting to manually define the file name.

By: Leif Madsen (lmadsen) 2011-09-15 11:02:16.133-0500

I think I see part of the reason why the time is used instead of unique ID -- the problem is, whose uniqueID do you use? Do you use the caller or the callee? Because the function can be called on either the caller or callee channel, the common denominator is to the current epoch instead of a uniqueid. That is what the code is doing anyways (inserting the time it was called, not the channel uniqueid).

I'm of the opinion no change needs to be made here.

By: Leif Madsen (lmadsen) 2011-09-15 11:03:08.353-0500

Additionally, if we make this change, it is a change of functionality which can make it difficult for people who are upgrading. Because there are methods of writing out the filename in the format you want using the channel variables, I think we should close this issue as Won't Fix.

By: John Knight (classiccitytelco) 2011-09-20 14:19:43.820-0500

"Additionally, if we make this change, it is a change of functionality which can make it difficult for people who are upgrading"

This change was made from what I can tell somewhere between 1.8 beta and 1.8.5.0.  I don't think you're going to be running into cases of an upgrade where the behavior is made consistent thereby breaking installations as opposed people that are just now moving to 1.8 from 1.4 or 1.6 and realizing that this is broken outright in an LTS release after 1.4 was laid to rest.   Just telling us to get around it by making an exception in the dialplan for an inconsistent feature in Asterisk, in my opinion, is not the better of both choices.  

In any case, this behavior wasn't present in previous versions of Asterisk so if anything 1.8 has made it difficult for people upgrading.

By: Michael L. Young (elguero) 2011-09-20 15:54:48.208-0500

In case someone comes across this later, to clarify, I do not see anywhere that the uniqueid was ever used as a filename for one-touch recording.

1.4:
{noformat}
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor);
snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
} else {
caller_chan_id = ast_strdupa(S_OR(caller_chan->cid.cid_num, caller_chan->name));
callee_chan_id = ast_strdupa(S_OR(callee_chan->cid.cid_num, callee_chan->name));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "auto-%ld-%s-%s", (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s|%s|m", S_OR(touch_format, "wav"), touch_filename);
}
{noformat}


It looks like the ability to define a prefix instead of the default of "auto" was added between 1.4 and 1.6.2.

1.6.2:
{noformat}
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
} else {
caller_chan_id = ast_strdupa(S_OR(caller_chan->cid.cid_num, caller_chan->name));
callee_chan_id = ast_strdupa(S_OR(callee_chan->cid.cid_num, callee_chan->name));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
}
{noformat}


Between 1.6.2 and 1.8, the only change was to use S_COR in setting the variables caller_chan_id and callee_chan_id.  Still using the same data (caller_id number or channel name).

1.8:
{noformat}
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
} else {
caller_chan_id = ast_strdupa(S_COR(caller_chan->caller.id.number.valid,
caller_chan->caller.id.number.str, caller_chan->name));
callee_chan_id = ast_strdupa(S_COR(callee_chan->caller.id.number.valid,
callee_chan->caller.id.number.str, callee_chan->name));
       len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
}
{noformat}

So, I am not sure where the change would be that is being mentioned.  If there are any other details that can be provided to pin-point when Asterisk used the uniqueid as a filename, we will have something to look into further than what I just did.  Right now, based on the code and the description on this issue, I do not see any functionality changes between different versions.

If what is being asked for is to try and make things consistent out of the box across all modules that create an audio file without any need to configure it, then that should go in as a feature request for future versions of Asterisk instead of a bug report.  Then someone can take a look and see if it is possible to add this.

Personally, I agree with Leif, the file name can be set by using channel variables (one of them being ${UNIQUEID}) in order to get the job done based on this original report.

By: Leif Madsen (lmadsen) 2011-09-20 16:33:02.831-0500

I'm closing this based on the evaluation by Michael L. Young. This is technically a feature request and not a bug, since it has been this way since 1.4.

If you want to bring up a discussion on the asterisk-dev mailing list, then that is the appropriate venue to discuss changes like this rather than the issue tracker.

You may reopen this issue if you have a patch to contribute to the discussion though.

Thanks!

By: John Knight (classiccitytelco) 2011-09-21 03:26:59.761-0500

Apologies, I should have checked with the 1.4 branch before making the claim.  I suppose the frameworks in the past that I've used have fixed this issue by writing a dialplan around Asterisk behaving this way.  I will re-submit as a feature request.  

Thank you Leif and Michael!