Hi I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator " not equal" or "!=". What should I do? With best regards, Shumaev DA, KBR Ltd.
Not necessarily the best answer, but you can use negative lookahead, e.g.: (?!399|400)^(\d{3,16})$ See it here: http://www.rubular.com/r/XVTB40DPZZ Alternatives... 1) A different extension that sets a variable record=false for 400, 399, and an anti-action sets it to true. (not sure that's exactly the same though) 2) a short lua script that sets the variable or actually starts the recording. 3) I'm sure there are other options... -Avi Marcus On Tue, Feb 26, 2013 at 10:01 AM, Dmitriy Shumaev <pm_zefman_r@mail.ru>wrote:
Hi
I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator "not equal" or "!=". What should I do?
With best regards, Shumaev DA, KBR Ltd.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks, it works. But. how can I do it in multiple conditions (for example, if I want to check fo not equal some other field like "caller_id_name", ...)? I.e. Something like: <condition field="caller_id_name" expression!="^!Extension 1001$"/> <!--NOT EQUAL--> <condition field="destination_number" expression!="^!400$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^!399$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> Вторник, 26 февраля 2013, 10:53 +02:00 от Avi Marcus <avi@avimarcus.net>:
Not necessarily the best answer, but you can use negative lookahead, e.g.: (?!399|400)^(\d{3,16})$
See it here: http://www.rubular.com/r/XVTB40DPZZ
Alternatives... 1) A different extension that sets a variable record=false for 400, 399, and an anti-action sets it to true. (not sure that's exactly the same though) 2) a short lua script that sets the variable or actually starts the recording. 3) I'm sure there are other options...
-Avi Marcus
On Tue, Feb 26, 2013 at 10:01 AM, Dmitriy Shumaev < pm_zefman_r@mail.ru > wrote:
Hi
I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator " not equal" or "!=". What should I do?
With best regards, Shumaev DA, KBR Ltd. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Fri, Mar 1, 2013 at 8:01 AM, Dmitriy Shumaev <pm_zefman_r@mail.ru> wrote:
But. how can I do it in multiple conditions (for example, if I want to check fo not equal some other field like "caller_id_name", ...)? I.e. Something like: <condition field="caller_id_name" expression!="^!Extension 1001$"/> <!--NOT EQUAL--> <condition field="destination_number" expression!="^!400$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^!399$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$">
Would this work? <condition field="caller_id_name" expression="^Extension 1001$" break="on-true"/> <condition field="destination_number" expression="^400$" break="on-true"/> <condition field="destination_number" expression="^399$" break="on-true"/> -- Steve
<!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="destination_number" expression="^399|400$" break="never"> <action application="set" data="record_me=false" inline="true"/> <anti-action application="set" data="record_me=true" inline="true"/> </condition> <condition field="${is_already_recording}" expression="^$"/> <condition field="${record_me}" expression="^true$"/> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/ archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${ caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> try that and report back... -MC On Tue, Feb 26, 2013 at 12:01 AM, Dmitriy Shumaev <pm_zefman_r@mail.ru>wrote:
Hi
I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator "not equal" or "!=". What should I do?
With best regards, Shumaev DA, KBR Ltd.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
<!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression="(?!^399|400$)^\d{3,16}?$"
<!-- regex#2 --> <action ... /> </condition>
"regex#2", as written, returns TRUE providing that dest_num matches a '\d{3,16} pattern but is NOT 399 or 400. Therefore, 399 = false 400 = false 4001 = true 4005551212 = true 416 = true 4165551212 = true 1234 = true ANONYMOUS = false There is very, very little that CANNOT be done with native regex. If you need me to "explain" the regex construction, let me know. Cheers, /Scott On 26 February 2013 03:01, Dmitriy Shumaev <pm_zefman_r@mail.ru> wrote:
Hi
I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator "not equal" or "!=". What should I do?
With best regards, Shumaev DA, KBR Ltd.
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks, that is work. Can U explain? Can U do the same but with the help of several conditions with AND logic (!a & !b & d) and with separate ^(\d{3,16})? - condition? Среда, 27 февраля 2013, 5:33 -05:00 от Scott <8f27e956@gmail.com>:
<!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording} " expression="^$"/> <condition field="destination_number" expression="(?!^399|400$)^\d{3,16}?$" > <!-- regex#2 --> <action ... /> </condition>
"regex#2", as written, returns TRUE providing that dest_num matches a '\d{3,16} pattern but is NOT 399 or 400. Therefore,
399 = false 400 = false 4001 = true 4005551212 = true 416 = true 4165551212 = true 1234 = true ANONYMOUS = false
There is very, very little that CANNOT be done with native regex.
If you need me to "explain" the regex construction, let me know.
Cheers, /Scott
On 26 February 2013 03:01, Dmitriy Shumaev < pm_zefman_r@mail.ru > wrote:
Hi
I want to record all sessions, except calls to group numbers and to IVR. So I need something like: <!-- eavesdrop --> <extension name="record_3..16_digits" continue="true"> <condition field="${is_already_recording}" expression="^$"/> <condition field="destination_number" expression!="^(400)$"/> <!--NOT EQUAL--><!-- IVR --> <condition field="destination_number" expression!="^(399)$"/> <!--NOT EQUAL--><!-- Group number --> <condition field="destination_number" expression="^(\d{3,16})$"> <action application="set" data="RECORD_TITLE=Recording ${caller_id_name} ${caller_id_number} to ${destination_number} at ${strftime(%Y-%m-%d %H:%M)}"/> <action application="set" data="RECORD_STEREO=true"/> <action application="export" data="ignore_early_media=true"/> <action application="set" data="media_bug_answer_req=true"/> <action application="record_session" data="$${base_dir}/recordings/archive/${strftime(%Y-%m-%d-%H-%M-%S)}_${caller_id_name}_${caller_id_number}_2_${destination_number}.mp3"/> <action application="export" data="is_already_recording=true"/> </condition> </extension> . But the syntax of condition does not allow the operator " not equal" or "!=". What should I do?
With best regards, Shumaev DA, KBR Ltd. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (5)
-
Avi Marcus
-
Dmitriy Shumaev
-
Michael Collins
-
Scott
-
Steven Schoch