Ticket #2796 (reopened Patches)

Opened 9 months ago

Last modified 9 months ago

Replace recordingcheck script with dialpaln

Reported by: lazytt Assigned to: p_lindheimer
Priority: minor Milestone: Cut Line
Component: Core Version: 2.4-branch
Keywords: Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Considering the in-efficiancy of running agi scripts for every call, especially when calling (local) members of a queue, here is the dialplan equivalence of the recordingcheck script. Just replace the entire macro record enable with the code below. This code also eliminates the need to run the archive_recordings script every night, as it stores the recording in the proper location!

[macro-record-enable]
exten => s,1,GotoIf($[${LEN(${BLINDTRANSFER})} > 0]?:stopm)
exten => s,n,ResetCDR(w)
exten => s,n(stopm),StopMonitor()
exten => s,n,Gotoif($[${DB(AMPUSER/${ARG1}/recording)} != ""]?${ARG2},1)
exten => s,n,Noop(No recording settings found for ${ARG1})

exten => OUT,1,Gotoif($[$["${DB(AMPUSER/${ARG1}/recording)}" : ".*out=([^|]+)"] = Always]?r,1)
exten => GROUP,1,Gotoif($[$["${DB(AMPUSER/${ARG1}/recording)}" : ".*out=([^|]+)"] = Always]?r,1)
exten => IN,1,Gotoif($[$["${DB(AMPUSER/${ARG1}/recording)}" : ".*in=([^|]*)"] = Always]?r,1)


exten => r,1,Set(TYPE=${IF($[${ARG2}=Group]?g:${TYPE})})
exten => r,n,Set(TYPE=${IF($[${ARG2}=OUT]?out:${TYPE})})
exten => r,n,Set(TYPE=${IF($[${ARG2}=IN]?in:${TYPE})})

exten => r,n,Set(CALLFILEPATH=${STRFTIME(${EPOCH},,%Y)}/${STRFTIME(${EPOCH},,%m)}/${STRFTIME(${EPOCH},,%d)}/${ARG1}/${TYPE})
exten => r,n,Set(CALLFILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}.${UNIQUEID})
exten => r,n,SYSTEM(mkdir -p ${astspooldir}/monitor/${CALLFILEPATH})
exten => r,n,MixMonitor(${CALLFILEPATH}/${CALLFILENAME}.WAV)

Change History

04/20/08 16:14:41 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to invalid.
  • confirmation changed from Unreviewed to Need Feedback.
  • component changed from - choose - to Core.

lazytt,

it's great to get inefficiency out of the dialplan, however from a quick glance, this seems to be quite a ways from a replacement. Have you tested this on a ringgroup or follow-me? It appears to be only geared at single extension dialing. Also - if you are shooting for efficiency, executing a system() call in the marco is probably going to give you about as much efficiency as an AGI script - you really don't want to do that if you can help it.

I'm going to close this for now since it seems far from a replacement - although if you want to throw something together that is a full replacement by all means do so and reopen it since you should have permission to re-open these tickets.

04/21/08 02:18:58 changed by lazytt

Good point (re: system call). However a. mixmonitor cant create folders and b. at least its only run when recordings are definitely needed.

I believe it works fine with follow-me (its extensions dependent); Ill reopen after checking out the ring-groups a bit more.

Can you give me an example of a ring-group that would require recordings?

04/21/08 07:11:33 changed by p_lindheimer

lazytt,

follow-me is just a form of ringgroup. Look at your macro, you assume a single extension. Here's an example of a call from follow-me:

exten => 220,n,Macro(record-enable,${DB(AMPUSER/220/followme/grplist)},${RecordMethod})                                         

Take a look a the agi script, it has a loop that goes through each of the list items separated by hyphens. A ringgroup or follow-me requires recording if one of the receiving extensions in the list has inbound recording always enabled.

(follow-up: ↓ 6 ) 04/21/08 09:28:37 changed by lazytt

hmm. So if ANY extension in the follow-me or ring group is record-enabled, than EVERY call to that follow-me or ring group will be recorded?

So if ext. 200 has FM to extension 201,202,203 (and 200 doesn not have recoding enabled); extension 202 has record-enabled: regardless of which extension answers the call, the call will be recorded when 200 is called??

04/21/08 10:27:30 changed by p_lindheimer

look in the agi script - I can't recall the details, or try it out and let us know what it does.

(in reply to: ↑ 4 ) 04/21/08 12:57:38 changed by lazytt

  • status changed from closed to reopened.
  • resolution deleted.

asked by lazytt:

hmm. So if ANY extension in the follow-me or ring group is record-enabled, than EVERY call to that follow-me or ring group will be recorded?


I havent tested for FM but it is definitely so for ring groups. I would like to suggest the following:

  • Regardless of which macro is called, it should be called using the M(x) option in dial so that the macro isnt called until after the call is answered. This will avoid running scripts needlessly on channels that might not ever be answered.
  • Recordings of ringroups should be dependent on the ring group as a whole - not based on which extensions are listed in it. This will provide much more flexibility in choosing which calls to record. For example:
    • if you have a ringgrouop of only cell phones - there currently is no simple way to record the calls.
    • if your 'work' extension (where all calls are recorded) is included in you personal ringgroup (which you dont need recordings), the calls should not be recorded unless you specificaly request the system to do so.
  • I have no interest in promoting alternative code that doesnt properly replace and improve the original. My only goal here is to increase FreePBX's scalablility by reducing the amount of scripts run.

04/21/08 13:45:58 changed by p_lindheimer

putting it in the M() has several issues.

Your suggestion on recording of ringgroups being independent should be filed as a feature request. I think we still need to record based on the individual extensions as well, but you are right that it would be good to specify that the ringgroup should be recorded just like we can with queues.

Concerning your last point, I'm glad to see code that increases the efficiency and this is one place that is less than ideal. What may make a lot more sense is to have dialparties.agi handle it for all inbound calls since that same script handles ringgroups, followme and extensions and the script is already running. For outbound calls we could use an even more simplified version of your macro since it is always an extnension making the outbound call and it would be easy to very quickly determine if the macro needed to be run.

The biggest initial bang for the buck would be to take what you have done and streamline it for the outbound calls only since right now we call that script for every outbound call.

04/22/08 01:54:05 changed by lazytt

one more thing:

  • regardless of which script/agi/dialplan is used, could it please take care of putting the files in the correct folders, so that the monitor directory doesnt get to full to manage?

04/22/08 01:58:35 changed by lazytt

BTW, what are the issues with M()?