Aricpp sample ChannelDtmfReceived not work

Hi. I tried the aricpp example ‘play_and_record’, dtmf event is not occur.
Removing dtmf part and playback on stasis start, it plays sound well.
I am using asterisk 18.12.1 with ubuntu 20.4 and chan_pjsip
I tried changing pjsip endpoint option dtmf_mode to each, but it is same.

I am new with asterisk, can anyone tell me what to check?

Enable DTMF logging in the logger.conf configuration file, and verify that DTMF is being detected and received. If it’s sent using RFC4733 you can also use “rtp set debug on” and see if it is received.

My logger.conf is this

[general]

[logfiles]
console = verbose,notice,warning,error,debug
;messages = notice,warning,error
full = verbose,notice,warning,error,debug,dtmf
;security = security

and there is nothing in CLI when I pushed a button.
this is CLI log from rtp set debug on to end of call.

xyz*CLI> rtp set debug on
RTP Packet Debugging Enabled
 Creating Stasis app 'test'
  == WebSocket connection from '127.0.0.1:56542' for protocol '' accepted using version '13'
    -- Executing [07076630135@incoming:1] Log("PJSIP/provider-00000000", "NOTICE") in new stack
[Jun 28 03:49:06] NOTICE[396474][C-00000001]: Ext. 07076630135:1 @ incoming:  
    -- Executing [07076630135@incoming:2] Stasis("PJSIP/provider-00000000", "test") in new stack
       > 0x7f9a5001ac50 -- Strict RTP learning after remote address set to: 211.233.26.249:20220
    -- Channel PJSIP/provider-00000000 joined 'simple_bridge' stasis-bridge <7f5920fe-20c5-4c09-8e24-94a4f4420ea4>
    -- Channel PJSIP/provider-00000000 left 'simple_bridge' stasis-bridge <7f5920fe-20c5-4c09-8e24-94a4f4420ea4>

If nothing shows up with “rtp set debug on” then that means Asterisk isn’t sending or receiving media. Have you answered the incoming call? Is Asterisk behind NAT? (If so, have you configured it to know it is behind NAT and also forwarded ports)

My extensions.conf is

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]

[incoming]
exten => _X.,1,Log(NOTICE, Dialing out from ${CALLERID(all)})
same => n, Stasis(test)
same => n,Hangup()
same => n,Log(NOTICE, ${CALLERID(all)} hanged up)

and aricpp sample source is

....
        model.OnStasisStarted(
            [&bridge](shared_ptr<Channel> ch, bool external)
            {
                if (external)
                {
                    cout << "Call answered. Press a digit:\n";
                    cout << "1 - start play\n";
                    cout << "2 - stop play\n";
                    cout << "3 - start recording\n";
                    cout << "4 - stop recording\n";
                    cout << "5 - pause recording\n";
                    cout << "6 - resume recording\n";
                    ch->Answer();
                    bridge->Add(*ch, false /* mute */, Bridge::Role::participant);
                }
                else
                {
                    cerr << "WARNING: should not reach this line" << endl;
                }
            });
....

I think aricpp answers on stasis started. Do I have to answer in dialplan?

And about NAT, my pjsip.conf is

....
[provider]
type = endpoint
context = incoming
dtmf_mode = auto
transport = transport-udp
disallow = all
allow = ulaw
allow = alaw
allow = g729
direct_media = no
from_domain = 211.233.26.247
;auth = provider_auth
outbound_auth = provider_auth
aors = provider
from_user = 07076630135
rtp_symmetric = yes
force_rport = yes
rewrite_contact = yes

and port forwarding 5060 tcp/udp set the asterisk running device.
Is there more things about NAT settings?

If Asterisk is behind NAT then the local_net, external_signaling_address, and external_media_address settings have to be set on the transport otherwise things may or may not work. Ports for media should also be forwarded to Asterisk (by default 10000 to 20000).

Thanks a lot!
It works well with ports 10000~30000 fowarded to asterisk.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.