[Freeswitch-users] Overriding hangup cause in CDR logs

Rahman Duran rahman.duran at erzurum.edu.tr
Tue Oct 26 06:14:00 UTC 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20211026/095c27ed/attachment-0003.html>


More information about the FreeSWITCH-users mailing list