Solved

How to Decode DTMF Tone to get Caller ID?

Posted on 2008-10-20
14
3,969 Views
Last Modified: 2013-12-21
hi,
   I need to decode the DTMF Tone Received from Telephone...Getting the tone from telephone and passing the input as wave stream...i have written code in C#.net...I have used Goertzel method to decode the DTMF Tone...This Method Returns a double value which is to be passed to another function and does some calculation and return double value again...All the Value returned are frequencies...Here comes the problem...i get lot of frequencies with that values how can i get the DTMF Tone...Here i  had attached  the Code that i am using to decode..Parameters Passed for Goertzel (Range of frequencies
(ie..For 1(697.00hz-1209.00hz)),Number of frequencies,Maximum frequncy for that number(1209.00hz),Sample Rate(44100))..Can anyone Guide me for this problem...  
double Goertzel(List<double> sngData, long N, double freq, long sampr)
{
double Skn=0;
double Skn1=0;
double Skn2;
double c;
double c2;
int i;
 
c = 2 * Math.PI * freq / sampr;
c2 = Math.Cos(c);
 
for (i = 0; i <= N - 1; i++)
{
Skn2 = Skn1;
Skn1 = Skn;
Skn = 2 * c2 * Skn1 - Skn2 + sngData[i];
}
 
return Skn - Math.Exp(-c) * Skn1;
}
 
Console.WriteLine(power(Goertzel(byteFrequencies,byteFrequencies.Count,maxHz,samples)).ToString());
 
double power(double value)
{
return 20 * Math.Log(Math.Abs(value)) / Math.Log(10);
}

Open in new window

0
Comment
Question by:godwindotnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
14 Comments
 
LVL 4

Expert Comment

by:palner
ID: 22775822
Any reason why you're doing it in this way? It feels to me like you're reinventing the wheel... To be able to detect DTMF, you must already me somehow connected to either the calling or the called party. In that case, it's much more efficient to do this within the dialplan using a background or Read statement.
0
 

Author Comment

by:godwindotnet
ID: 22777183
I wish it was that easy.I don't know what you mean by "within the dialplan using a background or Read statement."???
I'm totally new to this and just trying my best to accomplish detecting callerid through dtmf.
Please let me know how if there's an easier way.Thanks so much,.
0
 
LVL 4

Expert Comment

by:palner
ID: 22777203
Are you going to be sending the call or receiving the call?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:godwindotnet
ID: 22777236
I've converted the telephone line to plain sound through an adapter and given it through the line in of my soundcard.

Now,I can hear the DTMF tone when I receive a call through my pc speakers.
but,I just need a way to decode these tones and get the digits...

Thanks
0
 
LVL 4

Expert Comment

by:palner
ID: 22777464
Are you building your own pbx? (this was tagged as asterisk)
0
 

Author Comment

by:godwindotnet
ID: 22777728
not building an entire pbx...
Just developing a program in c# to detect callerid
0
 

Author Comment

by:godwindotnet
ID: 22777734
Can asterix detect DTMF from soundcard input?
0
 
LVL 4

Expert Comment

by:palner
ID: 22777819
I'm still trying to figure out why you would want to do it in this manner... as if Asterisk was involved it either (a) received the caller id from the call (whether pstn, sip, etc) or (b) you are making a call within asterisk in which case, Asterisk will already detect and process dtmf. Also, caller ID is generally never set by dtmf. It's set by setting... the called number is usually detected by dtmf... but not caller id. If you are using dtmf to change your caller id, I'd recommend using a read function within the Asterisk dialplan. so, Yes, Asterisk detects and processes dtmf. If you are new to Asterisk, please read the intro book (easy to find on google) and is a free download.
0
 

Author Comment

by:godwindotnet
ID: 22777870
I've heard of Asterix...but as far as I know,it works only with SIP or some specialized telephone card.

I don't have both. I'm simply converting the telephone line to plain sound input to the soundcard.
It's a very cheap solution.

Can ASTERIX detect the number from a the dtmf tones given as input through the soundcard?
If itcan,I'm ready to give asterix a try...
0
 
LVL 4

Expert Comment

by:palner
ID: 22777963
You could get a telephone ATA sip adapter for less than 30 bucks which will work much easier.
0
 

Author Comment

by:godwindotnet
ID: 22778122
A new hardware component will be difficult. :-(  I can try softwares though
0
 
LVL 25

Accepted Solution

by:
Ron Malmstead earned 500 total points
ID: 22801989
asterisk is a fully functional pbx.

I agree with Palner,....if asterisk is involved in the call, it will know what the caller id is.
i'm not sure why you have this going through a sound card anyway...

If you are running a phone line into a modem...most modems can receive caller id information as well.
0
 

Author Comment

by:godwindotnet
ID: 22801993
because the cost works out cheaper :)
Asterix with all the hardware costs much more.
0
 

Author Closing Comment

by:godwindotnet
ID: 31508167
thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: user_n
How Sip Phone (User Agent) works and communicates with sip servers 1.  There is a sip server and a sip registrar.  The sip server and sip registrar can be one server or two different servers. The sip registrar is the server on which it is record…
Hey there Heard about jingle, the add on for XMPP that enables point to point audio between two XMPP clients. No server config necessary. Actually quite a cool feature. However, how good is it if you can not use those voice capabilities to do a P…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question