signalwire / freeswitch

FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device.
https://freeswitch.com/#getting-started
Other
3.46k stars 1.4k forks source link

api_hangup_hook does not work when use with mod_callcenter #1847

Open nikkadim opened 1 year ago

nikkadim commented 1 year ago

Describe the bug api_hangup_hook does not work when use in mod_callcenter

To Reproduce Steps to reproduce the behavior:

  1. Start freeswitch
  2. Dial into callcenter number
  3. hangup
  4. script from api_hangup_hook not called

Expected behavior api_hangup_hook works in all other extensions with just bridge

Package version or git hash

<extension name="support-plan">
    <condition field="destination_number" expression="^22299999999$" break="on-false">
        <action application="set" data="ignore_sdp_ice=true"/>
        <action application="export" data="session_in_hangup_hook=true"/>
        <action application="export" data="nolocal:api_hangup_hook=lua hangup.lua"/>
        <action application="set" data="record_sample_rate=8000"/>
        <action application="mkdir" data="/mnt/voice/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/"/>
        <action application="export" data="execute_on_answer=record_session /mnt/voice/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${strftime(%Y%m%d)}_${caller_id_number}_${destination_number}_${uuid}.wav"/>
        <action application="answer"/>
        <action application="set" data="media_bug_answer_req=true"/>.
        <action application="set" data="ignore_early_media=false"/>.
        <action application="export" data="nolocal:absolute_codec_string=PCMU,PCMA"/>
        <action application="playback" data="/usr/share/freeswitch/sounds/en_blabla.wav"/>
        <action application="playback" data="ivr/ivr-one_moment_please.wav"/>
        <action application="set" data="hangup_after_bridge=true"/>
        <action application="set" data="result=${luarun(callcenter-announce-position.lua ${uuid} support@default 10000)}"/>
        <action application="callcenter" data="support@default"/>.
        <action application="bridge"  data="[origination_caller_id_number=2231231312]sofia/gateway/fs0321321/82131231123121"/>
    </condition>
</extension>
greenbea commented 1 year ago

You're trying to export the hangup hook for the agent leg? To export the variables to the agent legs you'll need to set cc_export=api_hangup_hook

nikkadim commented 1 year ago

Need hangup hook for both, when agent hangup and when caller hangup too.

greenbea commented 1 year ago

so remove the nolocal from the export, and use cc_export

nikkadim commented 1 year ago
 <action application="export" data="cc_export:api_hangup_hook=lua hangup_redis.lua"/>

did not change anything

greenbea commented 1 year ago
<action application="set" data="api_hangup_hook=lua hangup_redis.lua"/>
<action application="set" data="cc_export=api_hangup_hook"/>
nikkadim commented 1 year ago

if I do so, hangup_redis.lua not getting agent phone number of who is actually answered the call