What is AMD and How is it internally work?

I am interested to implement AMD in my custom application, but before dive into that I have to know how everything work in AMD.

To clear my doubts, I looked amd.conf file from /etc/asterisk/, but there some variables with some values assigned to them and I couldn’t understand why those specific number assigned to them (I read comments but I couldn’t understand logic behind those).

Also, I referred to this but it won’t help that much. It is the same as amd.conf file’s contents.

So here are some of my questions,

  1. How AMD works (please provide any logical flow, it will be helpful)
  2. The variables declared and a value assigned them in /etc/asterisk/amd.conf are any global variable or are refer from anywhere else
  3. Is there any Machine Learning process invoke behind to process AMD?
  4. How silence is measures? (there are many silence references in amd.conf)

Note: I just refer original amd.conf file, I didn’t change anything in that.

Crudely. See

for details.

I don’t believe so.

No

Average signed linear absolute sample value less than the specified value. See

Although it is possible that there is some higher level documentation of the first code fragment, I very much doubt that there is for the second.

Thanks, @david551 , So we can say to detect Answer machine there is implementation in app_amd.c using some sort of Single Processing which written in dsp.c

So can we say that, while AMD() from dialplan we actually invoke an app_amd.c file?

I am not getting much from this github code snippet, Are they any good resource to read more on these

I probably wouldn’t have pointed you to the source code if I thought that there was any documentation at a level intermediate between the wiki and that.

1 Like

@Yash3120 from my experience and point of view the AMD listen to the channel and try to identify silence and number of words spoken in a short period of time.

Usually the AMD runs after the callee answer the call, you can setup the totalAnalysisTime that must not exceed 3 to 5 seconds. The greater the silence the greater the probability of the callee hangup, because during the analysis the callee doesn’t hear anything

If it’s a HUMAN that answer the call, normally it will say “hello” or “hi” or “yes” and then wait for a response, in this case the AMD will determine it’s a HUMAN because of maximumNumberOfWords won’t be excessed.

If the call is answer and the AMD “listen” to “the number five five five four eight one four zero isn’t available …” the detection will stop after maximumNumberOfWords is exceed or betweenWordSilence if lower than the defined value or other parameter is trigger. In this case it will assume it’s a MACHINE.

You can check the result of the analysis in the AMDSTATUS channel variable.

Be aware that some external sources of sound/noise near the callee can cause erroneous MACHINE detections. Like TV/radio sound in the background, answer the call in a street with cars passing or other people talking, etc.

1 Like

@aabreu thank you so much, you explained very simple way and It’s very easy to me to understand.

But one thing I can’t get,

How is this done in asterisk?

The same way as Read or Record would do it.

So the logic of Read audio (Record()) written in amd.conf ?

No.

You are asking very strange questions, which suggests you really don’t have a sufficient basic understanding of Asterisk to start asking deep questions.

I also noticed that whilst you were looking for detailed specifics of the algorithm, you seemed to accept an answer that provides less detail than the wiki entry for application does (or the VoIP or asteriskdocs.org one, all of which basically taken from the same source. I had a look at all of these yesterday, and the high level structure of the algorithm used was certainly clear enough for a typical end user.

What is the real world problem you are trying to solve by getting answers to these questions?

I’m analyzing the AMD to improve its performance but for that, I have to understand how AMD actually work and What are other components involved in this.

I asked this question because I breakdown my problem and according to the subproblem I am solving and asking questions regarding that.

And I really appreciate your all efforts to solve my doubts, yes I lagging behind some basic concepts but I improving them parallel.

Let’s try david551’s question another way. What exactly are you looking to improve in AMD? What performance issue are you seeing that you feel requires improvement?