Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distorted early media in call recording when mod_dptools:wait_for_answer is used. #2454

Open
evgeniibuchnev opened this issue May 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@evgeniibuchnev
Copy link

Describe the bug

When native mod_dptools:wait_for_answer application is used - the call recording appears distorted in early media part of the overall call. When call is answered - clean and quality recording presented.

With a workaround in Lua both parts of the call(early media and answered media) recording appear OK.

This issue is easily reproducible with below. When real calls are made the issue persists.

To Reproduce

Dialplan snippet:

<include>
    <context name="testing">

        <extension name="leg_1">
            <condition field="destination_number" expression="^(leg_1)$">
                <action application="pre_answer" />
                <action application="playback" data="tone_stream://%(800,200,300);loops=2" />
                <action application="answer" />
                <action application="playback" data="tone_stream://%(800,200,300);loops=2" />
                <action application="hangup" data="busy" />
            </condition>
        </extension>

        <extension name="leg_21">
            <condition field="destination_number" expression="^(leg_21)$">
                <action application="answer" />
                <action application="record_session" data="/usr/local/freeswitch/recordings/distorted.wav" />
                <action application="wait_for_answer" />
                <action application="sleep" data="10000" />
                <action application="hangup" data="busy" />
            </condition>
        </extension>

        <extension name="leg_22">
            <condition field="destination_number" expression="^(leg_22)$">
                <action application="answer" />
                <action application="record_session" data="/usr/local/freeswitch/recordings/clean.wav" />
                <action application="lua" data="wait_for_answer.lua" />
                <action application="sleep" data="10000" />
                <action application="hangup" data="busy" />
            </condition>
        </extension>

    </context>
</include>

Workaround solution via wait_for_answer.lua:

function wait_for_answer(ses, sleep_interval_ms)
    local sleep_interval_ms = sleep_interval_ms or 20
    while not ses:answered() do
        ses:sleep(sleep_interval_ms)
    end
    ses:consoleLog("INFO", 'Session is in ANSWERED state.')
end

if session:ready() then
    wait_for_answer(session)
end

You can trigger these by:

bgapi originate {}loopback/leg_1/testing leg_21 XML testing
bgapi originate {}loopback/leg_1/testing leg_22 XML testing

Have a look into recordings:

image

Expected behavior

A clean recording (without distortion) is expected.

Package version or git hash

  • FREESWITCH Version 1.10.12-dev git 31cf32d 2024-04-26 13:37:10Z 64bit
  • FREESWITCH Version 1.10.11 -release-25-f24064f7c9 64bit
@evgeniibuchnev evgeniibuchnev added the bug Something isn't working label May 3, 2024
@evgeniibuchnev
Copy link
Author

#413 looks related, although this ticket has clean and easy instruction for reproduction. Workaround included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant