[Freeswitch-users] Overriding hangup cause in CDR logs

Martin Paterson martin at pattersong.co.uk
Thu Dec 2 10:58:43 UTC 2021


Rahman,

If it's any consolation, I do exactly the same with the initial
destination. As soon as the call arrives, I store the
destination_number in a variable initial_destination. I also have a
history variable that gets appended to each time something interesting
happens in the dialplan. Both go in the CDR.

Martin.

Martin Paterson, Pattersong Music
Reduced orchestrations of G&S

On Tue, 9 Nov 2021 at 09:57, Rahman Duran <rahman.duran at erzurum.edu.tr> wrote:
>
> Martin,
>
> I was looking for a way to reduce cdr vars :) So I can search or generate reports on the logging server with the same fields. But know I have to consider two separate fields and it does not aggregate nicely on the log server. I also export some variables for "destination_number" as it changes when I do dialplan transfers, and I want to see the original destination number and the reason it changed with exporting lots of other variables. I hopped if I find a way in the cdr template I can combine many of them too.
>
> But I see there is no way to do what I want csv_cdr so I will focus on the log parsing side to generate accurate CDRs.
>
> Regards,
>
> Rahman
>
> Martin Paterson <martin at pattersong.co.uk>, 9 Kas 2021 Sal, 12:43 tarihinde şunu yazdı:
>>
>> Rahman,
>>
>> CDRs don't have a mechanism like you describe, but variables do. You
>> can put any variable into the CDR and looking back at your original
>> post, you are doing exactly the right thing here by setting a variable
>> (cdr_hata anonsu) with the information you require and putting it in
>> the CDR. Your request was for a real solution - but I think you have
>> it already.
>>
>> Martin.
>>
>> Martin Paterson, Pattersong Music
>> Reduced orchestrations of G&S
>>
>> On Mon, 8 Nov 2021 at 23:20, David Villasmil
>> <david.villasmil.work at gmail.com> wrote:
>> >
>> > I’ve never tried actually manually setting the reason after hangup, you may want to try that.
>> >
>> > On Mon, 8 Nov 2021 at 19:03, Rahman Duran <rahman.duran at erzurum.edu.tr> wrote:
>> >>
>> >> Hi David,
>> >>
>> >> You are right but I don't want or need to change any freeswitch internals. All I need is to fiddle with cdr. So I wonder if the CSV CDR template has any dynamic mechanism to use on variables. For example can I say "if variable A is not empty use A, else use variable B" in the CDR template?
>> >>
>> >> Regards,
>> >>
>> >> Rahman
>> >>
>> >> David Villasmil <david.villasmil.work at gmail.com>, 6 Kas 2021 Cmt, 05:07 tarihinde şunu yazdı:
>> >>>
>> >>> The fact is A is hanging up the call. I don’t think you can actually change this without changing FS source code to override it.
>> >>>
>> >>>
>> >>> On Sat, 6 Nov 2021 at 01:20, Rahman Duran <rahman.duran at erzurum.edu.tr> wrote:
>> >>>>
>> >>>> Hi,
>> >>>>
>> >>>> Bump. Any hints on this?
>> >>>>
>> >>>> Regards,
>> >>>>
>> >>>> Rahman
>> >>>>
>> >>>> Rahman Duran <rahman.duran at erzurum.edu.tr>, 26 Eki 2021 Sal, 09:14 tarihinde şunu yazdı:
>> >>>>>
>> >>>>> Hi,
>> >>>>>
>> >>>>> I am using announcements for fail hungup causes like busy, no_answer etc. Here is my dial plan
>> >>>>>
>> >>>>> <extension name="local_accounts_freeswitch">
>> >>>>>       <condition regex="all">
>> >>>>>         <regex field="destination_number" expression="^[0-9]{4}$"/>
>> >>>>>         <regex field="${local_user_exists}" expression="^true$|^TRUE$|^True$"/>
>> >>>>>         <regex field="${santral_kontrol}" expression="^freeswitch$"/>
>> >>>>>         <action application="set" inline="true" data="call_pickup_group=${user_data(${destination_number}@${domain_name} var call_pickup_group)}"/>
>> >>>>>         <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/>
>> >>>>>         <action application="hash" data="insert/${domain_name}-group_pickup_last_uuid/${call_pickup_group}/${uuid}"/>
>> >>>>>         <action application="hash" data="insert/${domain_name}-pickup_last_uuid/${destination_number}/${uuid}"/>
>> >>>>>         <action application="log" data="ep_codec_string -- ${ep_codec_string}" />
>> >>>>>         <action application="set" data="inherit_codec=true"/>
>> >>>>>         <action application="export" data="nolocal:absolute_codec_string=${ep_codec_string}"/>
>> >>>>>         <action application="set_profile_var" data="callee_id_name=${user_data(${destination_number}@${domain_name} var effective_caller_id_name)}"/>
>> >>>>>         <action application="set" data="hangup_after_bridge=true"/>
>> >>>>>         <action application="set" data="continue_on_fail=true"/>
>> >>>>>         <action application="set" data="call_timeout=30"/>
>> >>>>>         <action application="set" data="execute_on_answer=sched_hangup +21600 alloted_timeout" />
>> >>>>>         <action application="bridge" data="{origination_callee_id_name=${user_data(${destination_number}@${domain_name} var effective_caller_id_name)}}user/${destination_number}@${domain_name}"/>
>> >>>>>         <action application="execute_extension" data="hata-${originate_disposition} XML hata_anonslari"/>
>> >>>>>       </condition>
>> >>>>>     </extension>
>> >>>>>
>> >>>>> And here is announcements context that  I handle hangup causes:
>> >>>>>
>> >>>>> <include>
>> >>>>>   <!-- Burada iç çağrılarda alınan hata durumlarının anonsları işlenecek.
>> >>>>>     -->
>> >>>>>   <context name="hata_anonslari">
>> >>>>>     <!-- yerel dahili  -->
>> >>>>>     <extension name="error-causes-user_busy">
>> >>>>>       <condition field="destination_number" expression="^hata-USER_BUSY$">
>> >>>>>         <action application="export" data="cdr_hata_anonsu=USER_BUSY"/>
>> >>>>>         <action application="pre_answer"/>
>> >>>>>         <action application="playback" data="$${anons_dosya_yolu}/user_busy.wav"/>
>> >>>>>         <action application="sleep" data="1000"/>
>> >>>>>         <action application="hangup" data="${originate_disposition}"/>
>> >>>>>       </condition>
>> >>>>>     </extension>
>> >>>>>     <extension name="error-causes-no_answer">
>> >>>>>       <condition field="destination_number" expression="^hata-NO_ANSWER$">
>> >>>>>         <action application="export" data="cdr_hata_anonsu=NO_ANSWER"/>
>> >>>>>         <action application="pre_answer"/>
>> >>>>>         <action application="playback" data="$${anons_dosya_yolu}/no_answer.wav"/>
>> >>>>>         <action application="sleep" data="1000"/>
>> >>>>>         <action application="hangup" data="${originate_disposition}"/>
>> >>>>>       </condition>
>> >>>>>     </extension>
>> >>>>>     <extension name="error-causes-user_not_registered">
>> >>>>>       <condition field="destination_number" expression="^hata-USER_NOT_REGISTERED$">
>> >>>>>         <action application="export" data="cdr_hata_anonsu=USER_NOT_REGISTERED"/>
>> >>>>>         <action application="pre_answer"/>
>> >>>>>         <action application="playback" data="$${anons_dosya_yolu}/user_not_registered.wav"/>
>> >>>>>         <action application="sleep" data="1000"/>
>> >>>>>         <action application="hangup" data="${originate_disposition}"/>
>> >>>>>       </condition>
>> >>>>>     </extension>
>> >>>>>     <extension name="error-causes-any">
>> >>>>>       <condition field="destination_number" expression="^hata-(.*)$">
>> >>>>>         <action application="export" data="cdr_hata_anonsu=${originate_disposition}"/>
>> >>>>>         <action application="hangup" data="${originate_disposition}"/>
>> >>>>>       </condition>
>> >>>>>     </extension>
>> >>>>>   <!-- context hata_anonslari sonu -->
>> >>>>>   </context>
>> >>>>> </include>
>> >>>>>
>> >>>>>
>> >>>>> The problem is if the calling leg does not listen the announcement to the end and hangup, CDR logs shows "Originator Cancel" as hangup cause. As I already know the real hangup cause, how can I override the CDR hangup cause with the real one? For now I am setting another variable (cdr_hata_anonsu) and added it to CDR logs, but if possible I want to fix this with a real solution.
>> >>>>>
>> >>>>> Regards,
>> >>>>>
>> >>>>> Rahman Duran
>> >>>>
>> >>>> _________________________________________________________________________
>> >>>>
>> >>>> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> >>>> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
>> >>>> Build your next product on our scalable cloud platform.
>> >>>>
>> >>>> Join our online community to chat in real time https://signalwire.community
>> >>>>
>> >>>> Professional FreeSWITCH Services
>> >>>> sales at freeswitch.com
>> >>>> https://freeswitch.com
>> >>>>
>> >>>> Official FreeSWITCH Sites
>> >>>> https://freeswitch.com/oss
>> >>>> https://freeswitch.org/confluence
>> >>>> https://cluecon.com
>> >>>>
>> >>>> FreeSWITCH-users mailing list
>> >>>> FreeSWITCH-users at lists.freeswitch.org
>> >>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >>>> https://freeswitch.com
>> >>>
>> >>> --
>> >>> Regards,
>> >>>
>> >>> David Villasmil
>> >>> email: david.villasmil.work at gmail.com
>> >>> phone: +34669448337
>> >>> _________________________________________________________________________
>> >>>
>> >>> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> >>> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
>> >>> Build your next product on our scalable cloud platform.
>> >>>
>> >>> Join our online community to chat in real time https://signalwire.community
>> >>>
>> >>> Professional FreeSWITCH Services
>> >>> sales at freeswitch.com
>> >>> https://freeswitch.com
>> >>>
>> >>> Official FreeSWITCH Sites
>> >>> https://freeswitch.com/oss
>> >>> https://freeswitch.org/confluence
>> >>> https://cluecon.com
>> >>>
>> >>> FreeSWITCH-users mailing list
>> >>> FreeSWITCH-users at lists.freeswitch.org
>> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >>> https://freeswitch.com
>> >>
>> >> _________________________________________________________________________
>> >>
>> >> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> >> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
>> >> Build your next product on our scalable cloud platform.
>> >>
>> >> Join our online community to chat in real time https://signalwire.community
>> >>
>> >> Professional FreeSWITCH Services
>> >> sales at freeswitch.com
>> >> https://freeswitch.com
>> >>
>> >> Official FreeSWITCH Sites
>> >> https://freeswitch.com/oss
>> >> https://freeswitch.org/confluence
>> >> https://cluecon.com
>> >>
>> >> FreeSWITCH-users mailing list
>> >> FreeSWITCH-users at lists.freeswitch.org
>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> >> https://freeswitch.com
>> >
>> > --
>> > Regards,
>> >
>> > David Villasmil
>> > email: david.villasmil.work at gmail.com
>> > phone: +34669448337
>> > _________________________________________________________________________
>> >
>> > The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> > Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
>> > Build your next product on our scalable cloud platform.
>> >
>> > Join our online community to chat in real time https://signalwire.community
>> >
>> > Professional FreeSWITCH Services
>> > sales at freeswitch.com
>> > https://freeswitch.com
>> >
>> > Official FreeSWITCH Sites
>> > https://freeswitch.com/oss
>> > https://freeswitch.org/confluence
>> > https://cluecon.com
>> >
>> > FreeSWITCH-users mailing list
>> > FreeSWITCH-users at lists.freeswitch.org
>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> > https://freeswitch.com
>>
>> _________________________________________________________________________
>>
>> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
>> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
>> Build your next product on our scalable cloud platform.
>>
>> Join our online community to chat in real time https://signalwire.community
>>
>> Professional FreeSWITCH Services
>> sales at freeswitch.com
>> https://freeswitch.com
>>
>> Official FreeSWITCH Sites
>> https://freeswitch.com/oss
>> https://freeswitch.org/confluence
>> https://cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> https://freeswitch.com
>
> _________________________________________________________________________
>
> The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
> Build your next product on our scalable cloud platform.
>
> Join our online community to chat in real time https://signalwire.community
>
> Professional FreeSWITCH Services
> sales at freeswitch.com
> https://freeswitch.com
>
> Official FreeSWITCH Sites
> https://freeswitch.com/oss
> https://freeswitch.org/confluence
> https://cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com



More information about the FreeSWITCH-users mailing list