[Freeswitch-users] Overriding hangup cause in CDR logs
Rahman Duran
rahman.duran at erzurum.edu.tr
Tue Nov 9 05:49:49 UTC 2021
I already tried to set hangup_cause in my "error anouncement" dialplan
extension. But as A leg hangup before playback ends, Freeswitch does not
execute remaining actions in the "error anouncement" dialplan extension so
it does not work.
In "freeradius" configuration, I can write dynamic templates for access and
accounting logs like this
"%{%{Aruba-Location-Id}:-%{%{Siemens-AP-Name}:-none}}" This will evaluates
first "Aruba-Location-Id" and use its value. If it is empty or not exists,
then it lookup for "Siemens-AP-Name". If it is empty than it uses string
"none".
I hoped for some dynamic markup language in Freeswitch csv_cdr module so I
can write a template for my needs. I don't want to use xml_cdr because all
I need is to key-value based cdr logs sent to syslog (graylog) and analysed
there. If this is not possible I will try to use xml_cdr but this will add
more complexity and I fear I will loose cdr records is http server is down
and Freeswitch continue to operate.
P.S. I already log both a and b legs so this is not about legs.
Rahman Duran
David Villasmil <david.villasmil.work at gmail.com>, 9 Kas 2021 Sal, 02:46
tarihinde şunu yazdı:
> 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
David Villasmil <david.villasmil.work at gmail.com>, 9 Kas 2021 Sal, 02:46
tarihinde şunu yazdı:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20211109/352b67af/attachment-0001.html>
More information about the FreeSWITCH-users
mailing list