AMD and StartMusicOnHold


#1

Hi everybody,

I’m trying to make an outbound call using AMD application to recognize Answering Machine, If it’s a machine I will hangup the channel, if it’s not I will Dial another extension (or place the channel in a queue).
The problem is that I need to play a MOH sound while AMD is executing. Starting a MOH sound on the same channel where I’m executing AMD application doesn’t work (MOH sound is processed by AMD).

I was trying to start MOH on the first local channel, and then processing AMD on the callee channel, it works, but I can’t stop the MOH on the first channel after AMD finish.

Anybody can help me?


#2

Playing a sound whilst listening for silence will only work if there is good echo cancellation. I’d suggest your requirement will produce a fragile system.

What is the underlying reason for this requirement?


#3

The Italian law requires it for Dialers, I need to play something to the customer channel, he can’t hear silent.

If I call a dialplan to call the customer, I can start MOH with a macro and the option M in Dial application, then the callee will be in another extension where I can use AMD (and seems it works). So I think I can use AMD and MOH on different channels, but I don’t know how to stop MOH on first channel when AMD finish on the second channel.


#4

Answer the call on the local channel.


#5

What do you mean? Both channels are already answered. I use StartMusicOnHold to start MOH to be able to continue with dialplan. Can you provide a simple example to do what you mean?


#6

A local channel starts unanswered.


#7

This is my current test dialpans:

[test-amd-call]
exten => _X.,1,NoOp(TESTAMDCALL)
 same => n,Dial(Local/${EXTEN}@from-internal/n,30,M(test-amd-macro))
 same => n,Hangup()

[macro-test-amd-macro]
exten => s,1,NoOp(test-amd-macro)
 same => n,StartMusicOnHold(rumore)
 same => n,MacroExit()

[test-amd]
exten => _X.,1,NoOp(INITIALIZING AMD)
 same => n,AMD()
 same => n,Answer()
 same => n,NoOp(TESTAMDSTATUS: ${AMDSTATUS})
 same => n,NoOp(TESTAMDCAUSE: ${AMDCAUSE})
 same => n,GotoIf($[${AMDSTATUS}=MACHINE]?mach:humn)
 same => n(mach),NoOp(TESTAMD is a machine!)
 same => n,Hangup()
 same => n(humn),NoOp(TESTAMD is an human!)
 same => n,Queue(${EXTEN})
 same => n,Hangup()

Using CLI, I’m originating a call to dial 123456789 and queue the call on queue 100.

channel originate Local/123456789@test-amd-call extension 100@test-amd

Then, I can start MOH with StartMusicOnHold in the dial macro. AMD() is executing on another channel, so it doesn’t process MOH sound, but then I can’t stop the MOH.

What can I do?

I’m not an expert on asterisk, so probably I’m not evaluating some other possibilities to achieve this.


#8

I confused M with m. Use the m option on Dial.


#9

I need MOH on the called party when it answer.
m option provide hold music to the calling party.

Probably I’m wrong with the flow and it’s not the correct way to place a call.


#10

What I want to do is:

  • dial an external number
  • if it answers, start a MOH
  • while customer hear MOH, check if it’s an answering machine with AMD()
  • when AMD finish, stop MOH
  • then add the call to a queue