Summary:ASTERISK-12051: serious problems in VAD and CNG support
Reporter:Denes Dolhay (denke)Labels:
Date Opened:2008-05-20 06:03:24Date Closed:2011-06-07 14:02:57
Versions:Frequency of
Description:I know that CNG is in development state ... for a long time ago, but a bug makes asterisk almost completly unuseable with a cisco voip router vad and cng enabled.

1. At the beginning, sip and rtp connections are built correctly, but somewhy the cisco router does not care about the rtp packets we send to it (could be some protocol handleing error?) then after a while, the cisco sends us a packet about now he stops sending rtp packets, we should generate the confort noise ourselves. It that precise monent everything normalises, and the other end can hear what we are telling.

2. But if we dial() an extension then, (within a few secounds) asterisk seems to send an event to the cisco router ... something about confort noise again, and it stops sending rtp packets. Then everthing goes wrong again, and we can not be heared. BUT if the other side speaks (or makes some noise), (makeing the other side send rtp packets, keeping the asterisk's CNG off) asterisk starts sending the rtp packets again ... so when the other side es knocking the microphone, they can hear us.
Comments:By: Joshua C. Colp (jcolp) 2008-05-20 09:00:56

Outgoing audio is timed off of incoming audio UNLESS you have a Zaptel timing source and enable internal_timing in asterisk.conf - we also send a line in the SDP to tell the other side not to use silence suppression.

I don't know if there's anything else we can do... we can't force the other side not to use CNG and silence suppression.

By: Denes Dolhay (denke) 2008-05-21 04:33:06

I do have a digium card, and I have just corrected a config error, and now issue 1 is solved, but still, if asterisk sends out ringtone or moh, it still stops sending rtp packets at the moment when the other side stops sending us.

By: Denes Dolhay (denke) 2008-05-21 05:07:18

I have an asterisk.conf:
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run
;astlogdir => /var/log

internal_timing = yes

and I still get

[May 21 12:11:09] DEBUG[7698]: channel.c:2342 ast_internal_timing_enabled: Internal timing is disabled (option_internal_timing=0 chan->timingfd=21)
Sent RTP packet to (type 00, seq 035363, ts 197432, len 000160)
Got  RTP packet from (type 00, seq 022141, ts 963011835, len 000160)

By: Joshua C. Colp (jcolp) 2008-05-21 12:24:18

You restarted once you changed that setting? I just confirmed that it does indeed work.

By: Denes Dolhay (denke) 2008-05-21 13:45:17

yes, I have restarted many times the whole asterisk, even reloaded the modules, restarted the server, etc. Is there any connection between the timing source and if the zap channel is configured?

By: Joshua C. Colp (jcolp) 2008-05-21 13:49:01

It's not the zaptel timing source that is the issue. It's this:

[May 21 12:11:09] DEBUG[7698]: channel.c:2342 ast_internal_timing_enabled: Internal timing is disabled (option_internal_timing=0 chan->timingfd=21)

The 0 beside option_internal_timing means Asterisk does not know that internal_timing is set to yes, which points to asterisk.conf being the cause.

By: Denes Dolhay (denke) 2008-05-21 13:51:45

I have copied my whole asterisk.conf in my prevouse note (without the commented out lines) ... If I can help anything else, please let me know

By: Joshua C. Colp (jcolp) 2008-05-21 13:55:08

Did you install from source or from a package? When asterisk starts up does it say it is parsing the file you modified?

By: Denes Dolhay (denke) 2008-05-21 13:58:11

It is from the latest soutce, but it seems that I found the problem
the zaptel channel was not loaded. Since it is loaded, and there is a configured channel on it, it works just fine

By: Joshua C. Colp (jcolp) 2008-05-21 13:59:39

So it works now?

By: Denes Dolhay (denke) 2008-05-21 14:02:12

yes, it works ... I do not know if it should be that way or not, but asterisk can only use the timing interface while the call is on hold or the channel is ringing, if the zaptel module is loaded.

By: Joshua C. Colp (jcolp) 2008-05-21 14:04:09

Closed, configuration issue.

By: Denes Dolhay (denke) 2008-05-21 14:09:15

Sorry, it does not work again ... Zaptel is loaded, configured, etc, no other conf modifies, just an asterisk reload ... the same error ... I get again:

channel.c:2342 ast_internal_timing_enabled: Internal timing is disabled (option_internal_timing=0 chan->timingfd=21)

By: Denes Dolhay (denke) 2008-05-21 14:12:33

to be more precise:

[May 21 21:13:39] DEBUG[12951]: channel.c:2342 ast_internal_timing_enabled: Internal timing is disabled (option_internal_timing=0 chan->timingfd=23)

and the first line while loading is:
 == Parsing '/etc/asterisk/asterisk.conf': Found

By: Joshua C. Colp (jcolp) 2008-05-21 14:16:24

Did you confirm what I asked previously about the asterisk.conf file, checking to make sure the one it parses at startup is the one you modified?

By: Denes Dolhay (denke) 2008-05-21 14:17:16

yes it does. The first line is:
 == Parsing '/etc/asterisk/asterisk.conf': Found

By: Joshua C. Colp (jcolp) 2008-05-21 14:25:28

Can you provide SSH access? I can be reached at jcolp@digium.com

By: Denes Dolhay (denke) 2008-05-21 14:34:27

i need a few minutes to do that, please wait

By: Denes Dolhay (denke) 2008-05-21 14:51:13

email sent

By: Joshua C. Colp (jcolp) 2008-05-21 15:01:09

It should be working fine now. Go ahead and try.

By: Denes Dolhay (denke) 2008-05-21 15:06:59

no, it does not, At the moment we reach the dial command, we stop sending rtp packets unless there are incoming rtp packets. ... but the error log has disappeared :)

By: Joshua C. Colp (jcolp) 2008-05-21 15:08:44

Now I'm slightly confused, of the two from the initial report - which are we talking about?

By: Denes Dolhay (denke) 2008-05-21 15:51:56


The problem is confirmed, during a ringtone, or while listening to MOH asterisk /seems like/ to act as it would use external timing. If when one packet comes in, one goes out. If VAD is active and no packet comes in, then no goes out.
But not always ... a restart and it works, an other and it does not.
The problem still exists. :(

By: Leif Madsen (lmadsen) 2008-10-07 13:42:29

Looks like some work was going on here, but then stopped. Any updates on this issue? Still an issue in latest version of Asterisk?

By: Denes Dolhay (denke) 2008-10-07 16:06:32

Hello Blitzrage!
I have noinformation about any updates in this issue, but I will try to reproduce the problem tomorrow, bechause it is too late now here (hungary GMT+1) to do any debugging :)
Good night for now! :)

By: Denes Dolhay (denke) 2008-10-09 14:33:41

So, I have recompiled and installed the whole asterisk with the most recent svn sources (asterisk, addons, libpri, dahdi) set the internal timing on (both the switches on ... the "official" and the undocumented, which File was useing) and I can say that yes, the problem stil exists, and reproduceable.

By: Denes Dolhay (denke) 2008-10-20 05:16:35

So Blitzrage, is there any way how I can help solve the problem?

By: Leif Madsen (lmadsen) 2008-10-21 14:35:43

At this point I don't think there is much we can do until a developer wishes to take on this issue. I know 'file', who was originally working on this issue is exteremly busy with some other tasks, so we may just need to be patient for now. Thanks for your quick acknowledgement of the issues!

By: Denes Dolhay (denke) 2008-10-22 08:39:10

it was no problem at all, I wish to get rid of the proglem as much as you.
in the case of any updates, keep me posted ;)

By: Joshua C. Colp (jcolp) 2009-02-19 15:25:23.000-0600

I am now back and looking at this issue. I'm going to be trying various scenarios to see if I can reproduce and ultimately solve some of this. If you can provide console output, dialplan logic, configuration, rtp debug, anything, that will be most useful.

By: Denes Dolhay (denke) 2009-02-21 14:27:40.000-0600

Hello File!

Im happy to hear that you picked up the issue once again.
By ultimately, you mean to develop the VAD/CNG feature to
asterisk? ... That would be the ultimate goal, and I'm
happy to help in it.

I think that I documented the issue pretty well in the description,
and my in prevous posts. The problem was 100% reproducable with a
cisco voip device with the setting cng forced on.
(I have never configured such dev. so, I do not know anything about
it, just the obvious things)

The dialplan was totally irrelevant, if Asterisk Answered a call
and reached a Dial() order (does not metter that ringtone, or moh was set)
it stopped sending rtp data when the far end stopped it too.

so in the rtp debug, you saw that then the other end stopped transmitting, we stopped it too. The metter was not solved by setting timeing to internal.
(you confirmed it ypurself)

If I can be any more help, please tell me, what can I do exactly.

Have a nice day:


By: Joshua C. Colp (jcolp) 2009-02-23 10:50:38.000-0600

Properly implementing VAD/CNG inside of Asterisk would take an enormous amount of effort and would only be applicable to a future 1.6 release. Unfortunately I do not have the time to take on a project as large as that. What I can do is figure out why internal timing is not allowing such things as playback to work and why bridged calls also do not seem to work correctly.

By: Denes Dolhay (denke) 2009-02-23 12:51:44.000-0600

All right, I looking forward to.
Keep me posted!

By: Joshua C. Colp (jcolp) 2009-02-25 09:05:41.000-0600

denke: The console output and RTP debug would be helpful on here though, I do not have copies previously from before.

By: Leif Madsen (lmadsen) 2009-03-18 08:29:15

denke: ping?

Hoping you can attach the requested information.  Thanks!

By: Denes Dolhay (denke) 2009-03-18 08:35:58

I will, ASAP. I just have a lot of work to do, but I will real soon.

By: Leif Madsen (lmadsen) 2009-03-18 09:04:25

Great thanks!

By: Denes Dolhay (denke) 2009-03-27 07:29:29

Sorry for the long delay, but I am back now.

Update on the issue: all the stuff's seems to work properely.
To be mor precise, asterisk sends out rtp packets all the time to the channel
so the sound is coutinous, (it sends them even if there is no voice to send, it sends silence too)
Do you still need the console output?
asterisk version is the most current in 1.4, compiled a half an hour ago.

By: Joshua C. Colp (jcolp) 2009-03-27 08:32:15

Closed per reporter, everything is happy.