# key to answer a zap channel


#1

I’ve found the way to let asterisk now when a call with the zap-channel is answered (when using a fxo line),
In the Dial command we can use the c option:

Dial(ZAP/g0c/5768,15,t)

"if the letter c follows, then “Answer Confirmation” is requested, in which the call is not considered answered until the called user presses #. "
In this way I can achieve these two things:
-users that are reachable only via PSTN now can have a voicemail service, if they don’ answer the phone;
-I can a ring a SIP phone and a ZAP-channel together,
There is only a problem:the called has to know that he has to press the # key.
What can I do to play a message to the called sayng ‘press # to answer’ when he picks up the handset?
Could be better if the message says ‘there is a call from xxx for you, press # to accept the call’.

I hope this can help someone…
…and I hope someone can help me
Thanks in advance,
C.


#2

Don’t know if this is still an open question. I saw this post when searching for something else.

Anyway, I do something like this and it’s one of my favorite features of asterisk. You can invoke a macro in the dial command, and the macro is run before the call is bridged.

I do something like this:

exten => s,n,Dial(${HOUSEALL},20,tom(ringing)M(play-screen^${SCREENFILE}))
The relevant part is the M(play-screen). The ^${SCREENFILE} part is the way you pass an argument to the Macro (^ is the argument separator). The Macro is run when the callee answers the call. It can then do something like playback a standard message, listen for DTMF, etc. For example, my play-screen macro looks like this:

;*********** [macro-play-screen] ;*********** ; ----------------------------------------------------------------------------- ; macro for getting instructions about screened calls ; - it rings one of our extensions and announces the caller, it gives ; the callee a number of options: ; Dial 1 to immediately connect to this caller. ; Dial 2 to send them to voicemail. ; Dial 3 to send them to the torture scripts. ; Dial 4 to give them a short, polite "Don't call us, we'll call you" sendoff ; ARG1 = screen recording file ; usage: exten => s,1,Dial(SIP/john,20,M(play-screen^${CALLER})) ; ----------------------------------------------------------------------------- exten => s,1,Wait(0.2) exten => s,n,Playback(priv-callpending) exten => s,n,Playback(${ARG1}) exten => s,n,Read(ACCEPT|screen-callee-options|1) exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?connect) exten => s,n,GotoIf($[${ACCEPT} = 2 ] ?send-vmail) exten => s,n,GotoIf($[${ACCEPT} = 3 ] ?send-torture) exten => s,n,GotoIf($[${ACCEPT} = 4 ] ?send-goaway) exten => s,n,Goto(screen-menu) exten => s,n(send-vmail),NoOp(**** Should send caller to vmail) exten => s,n,Set(MACRO_RESULT=GOTO:sendfamilyvmail^s^1) exten => s,n,Playback(john/sending-to-family-vmail) exten => s,n,Goto(done) exten => s,n(send-torture),NoOp(**** Should send caller to torture) exten => s,n,Set(MACRO_RESULT=GOTO:telemarket^s^1) exten => s,n,Playback(john/sending-to-torture-menus) exten => s,n,Goto(done) exten => s,n(send-goaway),NoOp(**** Should send caller to goaway) exten => s,n,Set(MACRO_RESULT=GOTO:goaway^s^1) exten => s,n,Playback(john/sending-to-polite-go-away) exten => s,n,Goto(done) exten => s,n(connect),System(/bin/rm ${ARG1}) exten => s,n,Playback(connecting) exten => s,n(done),NoOp(**** Done with macro play-screen. MACRO_RESULT= ${MACRO_RESULT})
And here’s the key thing: If you want to simply bridge the call at the end of the macro, leave MACRO_RESULT unset.

Hope that helps. I’ll be glad to try to answer any questions.

Cheers,
john
p.s. funny, looking at my code just now, I think I found a bug! I’m pretty sure I need a label on the Read line, as so:

exten => s,n(screen-menu),Read(ACCEPT|screen-callee-options|1)

I just wanted to mention that in case someone’s looking at this code. I’ll have to look at it a little more and test it before I confirm that this is correct (I wrote the macro several months ago), so I’ll edit this post and remove this note once I’ve done that.


#3

Thank you greyhound;
Yes it is still an open question, I’m going to test your macro, then I’ll write something more.
C.