I have a simple Asterisk realtime configuration for an extension which is basically as follows (pseudo-code):
1 - Dial,SIP/70|16
2 - Voicemail,70@internal|su
3 - Hangup
The problem is that when somebody calls this extension and it gets answered, when the person at that extension hangs up the second priority (voicemail) is still executed unless the caller hangs up as well. This proves to be an even bigger problem on the inbound number, set up roughly as follows (pseudo-code again):
1 - Dial,SIP/70|12
2 - Dial,SIP/70&SIP/71&SIP/72|12
3 - Voicemail,70@internal|su
4 - Hangup
In this scenario, if the person at 70 (reception) answers and then hangs up before the caller, the dialplan will continue with the next priority and call all the other phones as well.
I realise that there are ways around this by implementing ‘gotos’ based on the DIALSTATUS variable as outlined at http://www.the-asterisk-book.com/unstable/voicemail-beispiele.html, but this is messy and difficult to implement in a realtime configuration. Is there an easier way around this?
Could you post the CLI output of a call, as I have never seen this happen and just set up a call as your example and it goes as expected.
== Spawn extension (internal, 100, 2) exited non-zero on 'SIP/900-081fdf70'
-- Executing AGI("SIP/900-081fdf70", "call_inbound.agi|SIP/100|16")
-- Launched AGI Script /var/lib/asterisk/agi-bin/call_inbound.agi
-- AGI Script Executing Application: (Dial) Options: (SIP/100|16)
-- Called 100
-- SIP/100-082048b8 is ringing
-- SIP/100-082048b8 answered SIP/900-081fdf70
-- AGI Script call_inbound.agi completed, returning 0
-- Executing VoiceMail("SIP/900-081fdf70", "100@internal|su")
-- <SIP/900-081fdf70> Playing '/var/spool/asterisk/voicemail/internal/100/unavail' (language 'en')
As you can see, once the AGI script has completed successfully, the voicemail ‘unavailable’ message plays even though the call was answered. Any ideas?
You talk about and show a normal dialplan, But you output shows you are using an AGI and no sign of that, and obviously the dilaplan you have shown is not the one you have issue with.
How can any expect to understand what is happening if you do not show the ACTUAL code you are using, IE DIalplan AGI etc
The problem will be the AGI returning to the dialplan I expect.