How to assign two different task for same extension in asterisk?

Hi how should i assign two different task for same extension in asterisk? For example, in context2 when caller presses 0 when audio is played completely, he/she taken to context2 and same audio is replayed from starting. I want to implement another task to extension 0, when audio is still playing if caller presses 0(once or twice) caller should be taken to context1. Is it possible?


exten => s,1,NoOp(context1)  
same => n,Playback(audio)  
same => n,WaitExten(10)    

exten => 1,1,Goto(context2,s,1)   

exten => 0,1,Goto(context1,s,1)    


exten => s,1,NoOp(context2)       
same => n,Playback(audio2)    
same => n,WaitExten(10)

exten => 1,1,Goto(context3,s,1)   

exten => 0,1,Goto(context2,s,1)

I dont understand clearly your requiments but based on the title of your question you cand o this using Local chanel

Thanks for your reply. My question is when caller is in [context2]

  1. If caller presses 0 when audio2 is still playing, caller should be taken to [context1, 1, 1] and
  2. When audio2 is completed if caller presses 0, caller should be taken to [context2, s, 1](same audio should replay)

I mean zero should do two different job in same context. When audio is playing and another when audio is played. Is it possible? How to do?

You need two different contexts.

Yeah. I have two different contexts. But I don’t know how to implement. Please help me…

You may need four contexts. You need to change contexts before and after playing the recording, so that you are in contexts with the right set of actions.

It’s not possible in one context? Because I have many recordings. In each context audio will be played. After listening to the audio caller will provide dtmf to listen to next audio in next context. Suppose an audio is started playing, dude to some disturbance caller missed some sentence. so caller wants to listen the audio again from starting by pressing 0 from his dialpad, instead of waiting to finish the audio and listen again.

Replay should happen when audio is playing because when audio is played and caller presses 0 from his dailpad then caller will be taken to context 1 as shown in above example. Am I clear?

Take a look at the following Asterisk documentation. You can jump around the existing context or to other contexts.