Dialout to someone, play message then wait for response

I’d like to dial to another destination, play my message to him and wait for response.
Is this possible?

this is our helpdesk setup - we dial out and use the macro option to set the result of the dial command. this way, if our help desk guy’s phone goes straight to voicemail, the system will skip him and go to the next guy in line.

works like a charm.

[macro-helpdesk] exten => s,1,Wait(1) exten => s,n,Background(attention-required) exten => s,n,Read(ACCEPT|press-1|1|||3) exten => s,n,ResponseTimeout(5) exten => s,n,Gotoif($[${ACCEPT} = 1] ?10:20) ;connect exten => s,10,Wait(1) exten => s,20,SetVar(MACRO_RESULT=CONTINUE) exten => s,21,SetVar(DIALSTATUS=BUSY)

hi wes,
I did it, but when I did answer ‘1’ nothing happened!

exten => x,1,Dial(SIP/${account}/${number},mM(helpdesk))

Maybe is a problem with dtmf tune in sip.conf?


does your dialplan also have a [macro-helpdesk] section ?

maybe, what do you have set now ?

it’s worth setting up some “test” extensions to debug issues like this. a simple one to Read() in some DTMF, then SayDigits() back is a good start.

Yes it has the suggested by wes Post#2.

okay, set debug to 10 and do this again…post the results from the CLI on here.

also, make sure you are waiting for the beep before pressing 1.

These is the CLI output:

-- Executing Dial("SIP/603-081cc940", "SIP/provider/210XXXXXXX|15|mM(helpdesk)") in new stack -- Called provider/210XXXXXXX -- Started music on hold, class 'default', on channel 'SIP/603-081cc940' -- SIP/provider-081e4800 is making progress passing it to SIP/603-081cc940 -- SIP/provider-081e4800 answered SIP/603-081cc940 -- Executing Wait("SIP/provider-081e4800", "1") in new stack -- Executing BackGround("SIP/provider-081e4800", "msg1") in new stack -- Playing 'msg1' (language 'gr') -- Executing BackGround("SIP/provider-081e4800", "msg2") in new stack -- Playing 'msg2' (language 'gr') -- Executing Read("SIP/provider-081e4800", "ACCEPT||1|||3") in new stack -- Accepting a maximum of 1 digits. -- parse_srv: SRV mapped to host sip1server2.sipdiscount.com, port 5060 -- User entered nothing. -- Executing ResponseTimeout("SIP/provider-081e4800", "10") in new stack -- Executing GotoIf("SIP/provider-081e4800", "0?10:20") in new stack -- Goto (macro-helpdesk,s,20) or with message msg2 in read command

    -- Executing Dial("SIP/603-081e76d0", "SIP/provider/210XXXXXXX|15|mM(helpdesk)") in new stack
    -- Called provider/210XXXXXXX
    -- Started music on hold, class 'default', on channel 'SIP/603-081e76d0'
    -- SIP/provider-0821e0d0 is making progress passing it to SIP/603-081e76d0
    -- SIP/provider-0821e0d0 answered SIP/603-081e76d0
    -- Executing Wait("SIP/provider-0821e0d0", "1") in new stack
    -- Executing BackGround("SIP/provider-0821e0d0", "msg1") in new stack
    -- Playing 'msg1' (language 'gr')
    -- parse_srv: SRV mapped to host sip1server5.sipdiscount.com, port 5060
    -- Executing Read("SIP/provider-0821e0d0", "ACCEPT|msg2|1|||10") in new stack
    -- Accepting a maximum of 1 digits.
    -- Playing 'msg2' (language 'gr')
    -- User entered nothing.
    -- Executing ResponseTimeout("SIP/provider-0821e0d0", "15") in new stack
   Also I've tested with dtmf=rfc... and inband but the same ...


it’s a DTMF issue - the system isn’t picking up your keypresses.

what type of phone are you using, and what is your dtmfmode set to?

using rfc2833 works great for us across the board…

It’s a standard analog phone

connected to asterisk how? and what dtmfmode is the device using?

I am setup to deliver a message as documented here:

voip-info.org/wiki/index.php … er+message

I have this setup for delivering alarms from our monitoring system.

Is there some way to get the system to wait until the phone is actually answered on the other end before starting to deliver the message?

Currently, it just loops and loops until someone acknowledges, but it doesn’t detect that the person has answered the phone or that it went to voicemail.

Is there anyway to do this? Is it supposed to already do this and I don’t have something set right?



our helpdesk macro does not play any audio until the line is answered…the call is not bridged until the user hits a key, that way if the call is answered by a VM system, it will route to the next person.

i’m not sure if that is what you are looking for, but it sounds like it.

look at the macro i made, it is nothing like the script you linked to - the Dial command is able to set the success/failure of the call based on the results of a macro…in our case, i’m simply calling the macro, waiting for input, and deciding whether the call is “live” or not based on the user pressing a key.

quick, easy, and it works wonderfully.

I think the problem is that I am using plain old telephone lines connected to Asterisk (I think you call them FXO).

Since I am not digital, Asterisk considers the line connected and answered as soon as it finishes dialing.

I need to do something else. Possibly listen for silence and then start playing after I detect silence?

I don’t know how to do that though - background command or something?


shouldn’t matter what kind of line you use - but i might be wrong on that.

try copying my macro and testing it - if it doesn’t work, then we can try something else.

there is/was/might be an answering machine detection script or function out there, and i remember looking at it for this feature, but using the macro flag in the Dial command worked MUCH better for us.

i could have sworn i used to have MachineDetect !!

this might be better nowadays : voip-info.org/wiki/view/NVLineDetect

cool, hadn’t seen that one.

looks like it may have a few strings attached, as you have to contact Newman Telco for the code…the comments don’t look too promising either.

too bad, as having a feature like this would be GREAT for a predictive dialer.

this is probably a better page : voip-info.org/wiki/view/Newman+Telecom

i’ve never had an issue getting the code from them, i think they just like an idea of how many people are using it. now i should go read the licece documents (if any) that came too !!

I created a file called silence.wav that is 30 seconds long and then used the following which is working for me:

exten => s,1,DigitTimeout,5
exten => s,2,ResponseTimeout,10
exten => s,3,Answer
exten => s,4,Wait(1)
exten => s,5,BackgroundDetect(silence/silence,4600)
exten => s,6,Background(outboundmsgs/msg1)
exten => s,7,Background(outboundmsgs/how_to_ack)
exten => 1,1,Goto(s,5)
exten => 2,1,Goto(msgack,s,1)
exten => s,8,Wait(2:w)
exten => s,9,Goto(s,5)
exten => t,1,Hangup

Now…there is some silence before the msg1 is heard, but it doesn’t start msg1 part way through anymore which is what it was doing.