Summary:ASTERISK-10143: DTMFs passing only in part between two asterisk machines with an IAX2 connection
Reporter:xmarksthespot (xmarksthespot)Labels:
Date Opened:2007-08-22 11:30:45Date Closed:2008-02-18 17:55:11.000-0600
Versions:Frequency of
Environment:Attachments:( 0) dtmfsoveriax.txt
( 1) file-secondtest-asterisk1side.txt
( 2) file-secondtest-mypbxside.txt
( 3) gatewayside.txt
( 4) localdtmfdetection.txt
( 5) pbxside.txt
Description:Note: I am unable to pinpoint the exact location of the problem, be it SIP, IAX or something else. To the best of my knowledge the fault lies with IAX, but I may be incorrect.

Here are the network setups:
Setup 1: PSTN <-- PRI --> Asterisk1 <-- IAX2 --> MyPBX <-- SIP --> MyPolycomPhone
Setup 2: PSTN <-- Analog Lines --> OtherPBX <-- SIP --> MyPolycomPhone

The network setup between all these setups is always the same, only a single switch separates these machines.

When a call is initiated (I usually test with the call being initiated from MyPolycomPhone out to the PSTN), the passing of the DTMFs becomes very incomplete, even if seems to depend on the length of the keypresses.

For example, I use MyPolycomPhone and call out to one of my Dialogic machines. The Dialogic machine answers me and awaits that I enter something. If I dial very fast, usually a sequence like 1234567890, only a very small part of the dtmfs actually make it through. The others seem to be simply missing. It's as if they never made it, or were never pressed, at least it seems that way to the Asterisk1 machine.

However, the local dtmf detection on MyPBX is flawless, which leads me to believe it might be some issue with IAX2 instead of SIP. I made an extensions that uses the Read() command and waits for the user to enter 10 digits. Everytime I tried it, as fast as I could, it worked flawlessly.

On the PSTN, it is totally the opposite. The majority of the DTMFs do not pass. It usually seems to depend on the length of the keypresses. If the keypresses are done in a slow, controlled manner they pass. If I use "setup 2", knowing that the OtherPBX is an Asterisk 1.2 machine with analog lines, the same test, the DTMFs on the PSTN work flawlessly, just like locally on "setup 1".

Then I decided to hook up OtherPBX in the same way as MyPBX is hooked, that is to create setup 3, which would be like so:

Setup 3: PSTN <-- PRI --> Asterisk1 <-- IAX2 --> OtherPBX <-- SIP --> MyPolycomPhone

This Setup 3 works flawlessly. I haven't submitted any debug of it, because everything is dandy.

So there's something weird going on when MyPBX (SVN Branch 1.4 rev 79747) talks DTMFs to Asterisk1 (1.4.6).

****** STEPS TO REPRODUCE ******

I'd imagine you'd need two asterisk 1.4 machines with an IAX2 connection on a local area network.

I didn't try to exit through analog phone lines, as I don't have any other than those connected to the OtherPBX machine.

You'd also need a sip hardphone, I only tried with polycoms 501s. I have a cisco 7960 lying around but I haven't tried it yet, if you need it I'll test.

Calling out through the IAX2 trunk, call another machine which can answer through the PSTN, and dial a sequence as fast as you can, then check the logs of the called machine and see what got entered. I see a bunch of DTMFs missing.


I am submitting a couple logs from three different tries.

gatewayside: Taken from the CLI of the Asterisk1 machine
pbxside: Taken from the CLI of the MyPBX machine

The first one (the one without "try" in the file names), shows something odd when it adds dtmfs to queue? Only a very small part of the dtmfs are received gateway side. Also, we see dtmfs with a duration of 0ms all the time on the gatewayside, which happens even with the perfectly working "Setup 3".

The other two seem successful tries, but you can still observe the 0ms durations.

I will carry on more tests and debug as requested.

The debug submitted here is very small and probably insufficient to diagnose the problem properly. However I can do other tests, but I don't know what.

Keep in mind "MyPBX" and "Asterisk1" are production machines when making requests please.
Comments:By: xmarksthespot (xmarksthespot) 2007-08-23 10:37:31

I haven't added the two other tries, as it's sort of pointless, they both look the same, replicate (or seem to) all the dtmfs on the Asterisk1 machine. Everything seems okay besides the fact that they are all 0ms.

HOWEVER! I am adding two debug files, that contain channel debug info for two tries (core set debug channel).

The one called localdtmfdetection.txt shows how the dtmfs are caught by the system when pressed fast. What I do is call an extensions which just uses the Read() function and says back the digits pressed. It works perfectly all the time.

Now the one called dtmfsoveriax.txt is how the system catches the dtmfs and sends them over IAX to the Asterisk1 machine, which sends it out the PRI onto the PSTN back on the PRI of a Dialogic machine. What's interesting is that at the end of the dtmfs, the core set debug channel starts looping endlessly. It just pastes the same thing over and over. I'll let you be the judge of what's happening, or if it's normal. To end the infinite loop I just hang up the channel.

Of course, I'm adding just for safety, this is all taken on the MyPBX machine directly.

By: Jared Smith (jsmith) 2007-08-23 13:35:04

I've seen a similar issue, and Josh Colp was looking into it for me.  I just got back from vacation, so I'll ping him and we'll try a few things out and see if we can't get this problem solved once and for all.

By: Phoebe Anderson (phoebe) 2007-10-03 07:28:48

This issues still persists in 1.4.12.  Any news?

By: xmarksthespot (xmarksthespot) 2007-10-03 10:42:33

I upgraded the MyPBX machine to latest SVN (as of last week), SVN 83976, because of a bunch of horrible deadlocks (unrelated to this bug) that happened because of the IAX2 link.

So I changed it all to SIP, so my setup becomes like this:

Setup 1: PSTN <-- PRI --> Asterisk1 <-- SIP --> MyPBX <-- SIP --> MyPolycomPhone

Notice the SIP between Asterisk1 and MyPBX. It used to be IAX2.

Well I thought that, if I figured correctly, switching to SIP would fix the problem.

WRONG! The problem is still present!

So that means two things:
1. It's not IAX2's fault.
2. Back to square one: I don't know whatever the hell's fault it is.

Anyone has any ideas?

By: pj (pj) 2007-10-03 13:27:37

I have suspicion, that this issues appears after vldtmf (variable lenght dtmf) was added to asterisk, from this point, I can also say, that dtmf is not 100% realiable, mainly in cases, sending digits quickly, without pauses.
my setup:
skinny-->asteriskA--iax--->asteriskB(dejitter)--->asteriskA-(Waitexten/IVR here)

By: xmarksthespot (xmarksthespot) 2007-10-09 15:33:10

Narrowing it down some more.

Right so as I mentioned before, I changed from IAX2 to SIP but to no avail.

I received a new Cisco 7960 which I upgraded to the latest sip firmware.

I initially configured it as dtmfmode info (sip-info). Lo and behold it worked! The dtmfs went right through as fast as I could type them. I switched it to rfc2833 and it didn't work anymore. So I went back to sip-info, and it still worked!

I switched a polycom 501 from rfc2833 to info, but it remained not functional.

In mode info however, voicemail does not work for some reason. I'll look into that.

By: Joshua C. Colp (jcolp) 2007-11-28 10:07:54.000-0600

INFO works because DTMF is a single "this button was pressed for this long"... as for RFC2833, I wonder if rfc2833compensate would make things work... and as for without it, I'll see if I can lab it up and find a solution.

By: xmarksthespot (xmarksthespot) 2007-11-29 10:41:49.000-0600

file: Please contact me if you need additional info, help, a sip account on my machine or something else, I will do everything in my power to make this as easy as possible.

By: xmarksthespot (xmarksthespot) 2007-11-30 15:31:48.000-0600

Just a confirmation:

This issue also exists in trunk, at least as of revision 90351, which I checked out today.

By: Digium Subversion (svnbot) 2008-02-18 17:53:40.000-0600

Repository: asterisk
Revision: 103801

U   branches/1.4/main/channel.c

r103801 | file | 2008-02-18 17:53:22 -0600 (Mon, 18 Feb 2008) | 10 lines

Ensure that emulated DTMFs do not get interrupted by another begin frame.
(closes issue ASTERISK-11209)
Reported by: gserra
     v1-11740.patch uploaded by dimas (license 88)
(closes issue ASTERISK-11403)
Reported by: tsearle
(closes issue ASTERISK-10143)
Reported by: xmarksthespot



By: Digium Subversion (svnbot) 2008-02-18 17:55:11.000-0600

Repository: asterisk
Revision: 103802

_U  trunk/
U   trunk/main/channel.c

r103802 | file | 2008-02-18 17:55:10 -0600 (Mon, 18 Feb 2008) | 18 lines

Merged revisions 103801 via svnmerge from

r103801 | file | 2008-02-18 19:56:48 -0400 (Mon, 18 Feb 2008) | 10 lines

Ensure that emulated DTMFs do not get interrupted by another begin frame.
(closes issue ASTERISK-11209)
Reported by: gserra
     v1-11740.patch uploaded by dimas (license 88)
(closes issue ASTERISK-11403)
Reported by: tsearle
(closes issue ASTERISK-10143)
Reported by: xmarksthespot