Summary:ASTERISK-00005: [patch] DTMF CLIP not supported by Asterisk (DE,SW,NL)
Reporter:armand (armand)Labels:
Date Opened:2003-07-21 20:57:03Date Closed:2008-06-07 10:44:17
Versions:Frequency of
Environment:Attachments:( 0) 01_Part2-PSTN_V32.pdf
( 1) ast-UK-and-DTMF-pol-CID.diff
( 2) cid-ast-v3.diff
( 3) cid-ast-v4.diff
( 4) cidfxo-v2-chan_zap.c.diff
( 5) cidfxo-v2-wcfxo.c.diff
( 6) cidfxo-v2-zaptel.h.diff
( 7) cid-zap-v2.diff
( 8) TS_900-301-1E2.pdf
( 9) wcfxo.c.diff
Description:Asterisk does not support DTMF style callerid receiving (from pstn) and sending (to phone).
At least Denmark, Sweden and The Netherlands use DTMF style CLIP (I think Poland as well). This will obstruct certification of the WildCard hardware (even though I think it is software issue, not hardware)


dutch specification can be found at:
http://www.kpn.com/common/downloads/01_Part2-PSTN_V32.pdf (paragraph 6.2.3)

swedish specification are at:
(in swedish :-( seems to be mostly identical to the dutch protocol)

description of the danish specs is at:
difference to the above seems to be that start signal is DTMF 'A' instead of 'D' and end signal is '#' instead of 'C'.
Comments:By: scaredycat (scaredycat) 2003-07-30 13:02:33

I'd like to see this one too :D

By: armand (armand) 2003-08-07 18:45:58

from http://lists.digium.com/pipermail/asterisk-users/2003-August/017588.html :

1) the UK protocol is different to the US system.
I have downloaded the specs and coding it would not be too difficult.

2) in the US the callerid is sent between the first and second rings. In the
UK the callerid is sent before the first ring.
I have been unable to determine if we can get a zaptel event when a line
reversal is received which happens before the UK callerid is sent. Without
this function or continuously monitoring the line for the tones we don't know
when to enter the callerid routine.  

This line reversal detection is also needed for implementation of the DTMF style  CLIP detection.

By: scaredycat (scaredycat) 2003-08-09 10:57:07

Probably not what you want but this may solve the problem...



By: Mark Spencer (markster) 2003-08-16 11:17:45

I will need to be able to ssh in to implement the CLIP via DTMF.  Do you have a machine available?

By: scaredycat (scaredycat) 2003-08-16 12:34:46


You can ssh into my box if you want..


edited on: 08-16-03 12:25

By: armand (armand) 2003-08-16 13:51:23

The X100P is on a machine where I have access, but I am not free to give access to others. I'll put out a request to allow access for this. In the meantime, could you mail your ssh public key to armand@nl.envida.net?



By: pcheng (pcheng) 2003-09-05 02:04:00

DTMF CLIP is supported by Asterisk via SIP devices that can send DTMF ETSI specs such as the Cisco ATA 186. However, note that even European devices don't always support the right specs and the specs can vary widely even within the same country. DECT phones work great with the Ciscos and can be programmed to access many of the special features such as MWI, etc. It's just a pain in the ass to configure...

The Ciscos pretty much support any device as long as you have the specs. John Todd's suggestions on SIP config file changes are much welcome in this regard...

By: scaredycat (scaredycat) 2003-09-07 05:55:30


this may be true, but we are talking about the X100P pstn interface and getting caller id from that....

just thought I'd clear that up..


By: John Todd (jtodd) 2003-10-16 04:18:03

Any activity on this in the last month or so?  I see an offer from mark to log into a box and run some tests... ScaredyCat, can you follow up?

By: scaredycat (scaredycat) 2003-10-16 07:49:51

Yeah, sorry..

Mark did ssh in and do some wonderous stuff, but although I could hear the dtmf when he monitored the line it didn't get pulled into *....

Mark said he needed to talk to someone about it...but I've heard nothing since... (I know he's a busy guy)...


By: Brian West (bkw918) 2003-12-06 12:11:18.000-0600

any news on this?  bug mark about it lately?

By: zoa (zoa) 2004-01-11 21:21:43.000-0600

any news on this ?

By: scaredycat (scaredycat) 2004-01-11 21:40:30.000-0600

*sniff* *sniff*

By: Olle Johansson (oej) 2004-03-21 10:15:56.000-0600

Need support for Swedish DTMF on X100... Any update, anyone that can remind Mark?

By: Brian West (bkw918) 2004-03-21 11:07:05.000-0600

This is how you get marks attention: Scardycat find him and see if you can get him to look at this again.  When he does we will reopen.

By: jrollyson (jrollyson) 2004-06-23 14:33:28

Reopen to add information from duplicate bug 1265 http://bugs.digium.com/bug_view_advanced_page.php?bug_id=0001265

By: jrollyson (jrollyson) 2004-06-23 14:36:13

Per http://bugs.digium.com/bug_view_advanced_page.php?bug_id=0001265 and http://voip-info.org/tiki-editpage.php?page=Asterisk+bounty+non-Bellcore-CLID there is a small bounty on this.

By: scaredycat (scaredycat) 2004-07-13 10:16:06

If anyone had the foresight to download the .pdf from the KPN site about could they please upload it here... KPN appear to have removed it ... :(

By: armand (armand) 2004-07-13 11:02:41

scaredbycat: I just uploaded the pdf. KPN is reliable and predictable when it comes to being a pain in the ass ;-)

By: scaredycat (scaredycat) 2004-07-13 11:17:31

Thanks :D

By: egnarf (egnarf) 2004-07-19 06:00:15

For all you people that can't wait until it's done properly, my experimental patches for DTMF-cid are at http://evil.gnarf.org/creativity/asterisk
Please read the README.txt (it should be displayed at the bottom of the page.

Note also that these patches were made in an attempt to learn more about asterisk and implement dtmf-cid for me. There are issues with them and
I know they are all wrong =)
I'll try to fix that soon.

I'm posting them here for all you that, like me, can't live without callerid and don't mind playing around with your boxes.

By: scaredycat (scaredycat) 2004-07-19 06:04:37

I can confirm that eGnarf's patches are working for me in .nl (TDM card not X100p)

edited on: 07-19-04 05:54

By: Olle Johansson (oej) 2004-07-19 09:17:10

egnarf: We need a disclaimer from you - pls confirm you have sent a disclaimer so we can add your patches to this bug report and build on them.

By: jrollyson (jrollyson) 2004-07-19 10:12:30

Also. Please attach that patch as a file attachment to this bug if you don't mind, and check the Wiki, there may still be some bounty money out there!

Mark, could you look the patch over and make sure it doesn't break anything too badly?

By: Mark Spencer (markster) 2004-07-19 12:17:24

Actually egnarf's comments aside, it's a great start.  My first priority is the zap side, and i'd like to make a few minor mods.  Before I do anything though I'll need a disclaimer.  Is that going to be possible?

By: egnarf (egnarf) 2004-07-19 17:19:55

I don't want to post these patches here yet.
I want to get mark to do the zaptel-driver first, and make it really work.
There are some kinks to iron out.
I also want to rewrite the cid-patch before I post it. I've learned more now and want to do it (more) right. I'll try to post it this week.

I will also send a disclaimer as soon as I can. Unfortunately I have neither fax nor printer so I have to at least hunt down a printer.

By: egnarf (egnarf) 2004-07-20 15:10:19

I just uploaded version 1 of the reversal detector and DTMF callerid.
The patches are also available from http://evil.gnarf.org/creativity/asterisk
The patches are:
 Apply to zaptel driver.
 You will get some debug-messages in the kernel-log.
 There are still some issues with the detector.

 The DTMF-callerid parser and stuff.
 You need to specify usecallerid=dtmf for it to work.
 You must activate debug-output to see what it does. Please also send the
 debug-output if it doesn't work for you.

Thanks to ScaredyCat for helping me test this.

I have faxed a disclaimer, and have gotten confirmation that it arrived.

edited on: 07-20-04 14:55

edited on: 07-20-04 16:51

By: srathje (srathje) 2004-07-30 06:20:42

Based on egnarf's excellent job I had a minor brain melt-down yesterday and finally got DTMF CLIP working on my X101P card connected to TeleDanmark (yep, Denmark).

Basically the procedure is to listen for the first occurence of a high powered BLIP on the line (DK is not using polarity reversal), then the CLIP is sent followed by RING.. I found this doing a recording with ztmonitor to figure out what actually was sent over the phone line. If anyone is interrested in the recording, mail me on asterisk@lolle.org

Anyway, it's an ugly hack (barely considered a POC), it works for me, I'm not entirely sure I will disclaim it as it is just too ugly but it will serve as an example for how to do it and anyone is free to use it as they see fit.

Note: You will need to add egnarf's patches for this to work as it calls the DTMF decoding procedures from these patches.

Asterisk, Zaptel etc. match "CVS 27.07.2004 14.50 GMT+2"

[10 Aug. 2004 - content uploaded as wcfxo.c.diff]

edited on: 07-30-04 06:14

edited on: 07-30-04 06:18

edited on: 08-09-04 17:33

By: egnarf (egnarf) 2004-07-30 06:24:23

Are you entirely sure DK doesn't do reversals?
The X100P is not capable of detecting them as far as I know, and my patch is only for the TDM400P

In either case, your work will probably benefit people that want dtmf-cid with X100P. Good work =) Keep em coming =)

By: srathje (srathje) 2004-07-30 06:43:49

According to http://www.blichfeldt.dk/faq/clipdk.htm, no. Maybe someone i DK using a TDM400P could comment on this.

I will see if I can get access to document TDK-TS 900 216 from TeleStyrelsen.

By: srathje (srathje) 2004-07-30 07:50:01

I have uploaded "TS 900-301-1E2.PDF" which according to TDC is the current standard for "Public Switched Telephone Network (PSTN) Calling Line Identification Presentation (CLIP) supplementary service Specification of the NTP" in Denmark.

By: egnarf (egnarf) 2004-08-03 15:20:52

Just uploaded version 2 of the DTMF-cid patch.
* Forgot to free frames read from the card. FIXED.
* Added some stuff for parsing .dk callerid. More specifically,
  added parsing of the codes that indicate if a number was withheld.

Please note: The cid-zap patch is only for the TDM400P. Users of the X100P might try the patch above posted by srathje

By: egnarf (egnarf) 2004-08-09 15:54:23

Mark has integrated the zaptel-side of this patch.
So all you need now is to patch asterisk with cid-ast-v2.diff.
I'm deleting the zaptel-patch because of this.

Please note:
* The polarity-detection only works on TDM400P-cards. X100P users might try
 srathje's patch above.
* Although the parser supports .DK callerid, .DK doesn't send polarity-reversals
 so currently .DK only works with srathje's patch and X100P.

By: srathje (srathje) 2004-08-09 17:55:23

Seems like something is missing in zaptel.c and zaptel.h so I have uploaded cid-zap-v2.diff.

For use of X100P in Denmark apply cid-ast-v2.diff, cid-zap-v2.diff and wcfxo.c.diff

If ppl can live with the rare occurence of false triggering of the DTMF engine I will gladly disclaim it.


By: egnarf (egnarf) 2004-08-10 02:27:24

Actually, Mark replaced the sending of ZT_RXSIG_POLARITY by just queueing
the polarity event directly in wcfxs.c.
On line 1484:
zt_qevent_lock(&wc->chans[card], ZT_EVENT_POLARITY);

So the part left out, should be left out.

By: srathje (srathje) 2004-08-10 10:56:48

New version (cidfxo-v2-*.diff uploaded) for X100P's as per egnarf's comment.

"modprobe/insmod/(preferred method) wcfxo" now require parameter 'dtmf=1'.

New event (ZT_EVENT_DTMFCLIP) so not to get confused with Polarity Reversals, Which by the way appear not to exist on the X100P..

Apply cid-ast-v2.diff first, then cidfxo-v2-*.diff's in random order.


edited on: 08-10-04 10:59

By: egnarf (egnarf) 2004-08-19 12:35:30

Uploaded version 3 of the cid-ast patch.
It has been updated to work with current cvs head.

Mark, could you look it over and see if it's worthy of inclusion?

By: Brian West (bkw918) 2004-08-22 23:14:20

ScaredyCat please bug kram to get this in so we can close this old bug out.

bkw :P

By: egnarf (egnarf) 2004-08-31 11:20:14

Uploaded new version of DTMF-cid patch: cid-ast-v4.diff
* Fixed: Forgot to clear cidnumber buffer if callerid is not received
* Added short comment to zapata.conf describing the new options.

By: dant (dant) 2004-08-31 19:57:33

Fixed the event strings and sort of merged in my UK caller ID changes (which were originally based on Tony Hoyles) (see bug 1719)

By: egnarf (egnarf) 2004-09-01 02:33:15

Maybe we should change the summary to something more appropriate now.
And start bugging Mark together to get this applied. =)

If you don't mind I'll dump my patch and all future enhancements I make will be to the combined. (saves us the trouble of merging back and forth).

I like the cidstart/cidsignalling part. Wish I thought about it first though. =)
Should simplify adding support for .dk CID.

For the record, I have a disclaimer on file.

The patch to apply for people wanting dtmf/uk cid is now ast-UK-and-DTMF-pol-CID.diff . That's the only one you need. Unless you are in .dk, in that case look at sratjhes bugnotes for instructions.

By: Mark Spencer (markster) 2004-09-20 21:47:38

Added to CVS, thanks!

By: Digium Subversion (svnbot) 2008-06-07 10:44:17

Repository: dahdi
Revision: 447

U   trunk/wcfxs.c
U   trunk/wctdm.c
U   trunk/zaptel.h

r447 | markster | 2008-06-07 10:44:16 -0500 (Sat, 07 Jun 2008) | 2 lines

Merge polarity reversal detection (bug ASTERISK-5)