Calls going to voicemail instead of disconnecting


I recently took an old Asterisk (CVS-HEAD-04/22/05-07:18:00) / AMP configuration running under Linux and ported it to Asterisk 1.4.19 running under Solaris 10.

I’ve gotten everything working, but I’ve run into one last problem which is stumping me. When a call is placed to an extension, and the extension hangs up, the caller is then transfered to the extension’s voicemail. Obviously, I’d rather the call disconnect.

This is my macro-dial:

exten => o,1,Background(pls-wait-connect-call) 
exten => s,1,AGI,dialparties.agi 
exten => s,22,Macro(hangupcall)             ; The call was answered and then hungup 
exten => s,23,Wait(1) 
exten => s,24,Voicemail(b${ARG3})           ; The call was internal to extension, and was busy 
exten => o,1,Background(pls-wait-connect-call)  ; 0 during vm message will hangup 
exten => o,2,Hangup

Anyone have any ideas? Thanks.

Hi and the cli verbose output looks like ???

    -- Executing [7600@pstn-incoming:1] Macro("SIP/", "exten-vmnew|novm|7600|49160") in new stack
    -- Executing [s@macro-exten-vmnew:1] BackGround("SIP/", "silence/1") in new stack
    -- <SIP/> Playing 'silence/1' (language 'en')
    -- Executing [s@macro-exten-vmnew:2] Macro("SIP/", "dial|30|r|7600") in new stack
    -- Executing [s@macro-dial:1] AGI("SIP/", "dialparties.agi") in new stack
    -- Launched AGI Script /var/asterisk/agi-bin/dialparties.agi
    --  dialparties.agi: priority = 1
    --  dialparties.agi: callingani2 = 0
    --  dialparties.agi: accountcode =
    --  dialparties.agi: channel = SIP/
    --  dialparties.agi: callerid = unknown
    --  dialparties.agi: context = macro-dial
    --  dialparties.agi: callington = 0
    --  dialparties.agi: dnid = 7600
    --  dialparties.agi: request = dialparties.agi
    --  dialparties.agi: calleridname = unknown
    --  dialparties.agi: extension = s
    --  dialparties.agi: language = en
    --  dialparties.agi: uniqueid = 1210262559.362
    --  dialparties.agi: callingpres = 0
    --  dialparties.agi: type = SIP
    --  dialparties.agi: rdnis = unknown
    --  dialparties.agi: callingtns = 0
    --  dialparties.agi: enhanced = 0.0
  dialparties.agi: Caller ID is not set
    --  dialparties.agi: Added extension 7600 to extension map
    --  dialparties.agi: Extension 7600 cf is disabled
    --  dialparties.agi: Extension 7600 do not disturb is disabled
  == Parsing '/etc/asterisk/manager.conf': Found
  == Manager 'admin' logged on from
  == Manager 'admin' logged off from
  dialparties.agi: Extension 7600 has call waiting disabled
    --  dialparties.agi: DbDel CALLTRACE/7600 - Caller ID is not defined
  dialparties.agi: About to execute Dial(SIP/7600|30|r)
    -- AGI Script Executing Application: (Dial) Options: (SIP/7600|30|r)
    -- Called 7600
    -- SIP/7600-083bc058 is ringing
    -- SIP/7600-083bc058 answered SIP/
    -- Packet2Packet bridging SIP/ and SIP/7600-083bc058
  dialparties.agi: User hung up. (rc=-1)
    -- AGI Script dialparties.agi completed, returning 0\

That is where it “fails” and goes to voicemail instead of dropping the call.

The following is it calling into the voicemail system on the real PBX.

    -- Executing [s@macro-exten-vmnew:3] BackGround("SIP/", "pls-wait-connect-call") in new stack
    -- <SIP/> Playing 'pls-wait-connect-call' (language 'en')
Really destroying SIP dialog '44e29766533c82802fe099d7285b9636@' Method: BYE
    -- Executing [s@macro-exten-vmnew:4] Dial("SIP/", "SIP/98169150@|90|A(49160)") in new stack
    -- Called 98169150@
    -- SIP/ is making progress passing it to SIP/
    -- SIP/ answered SIP/
    -- <SIP/> Playing '49160' (language 'en')
    -- Packet2Packet bridging SIP/ and SIP/
Really destroying SIP dialog 'YzFlMjUzN2M5ZWI1M2JlNDI1YTc0NWVjYzEwZGFkOGU.' Method: REGISTER
  == Spawn extension (macro-exten-vmnew, s, 4) exited non-zero on 'SIP/'
Really destroying SIP dialog '21a8d83f48adf44b320e51675224e950@' Method: INVITE
Really destroying SIP dialog '46BE17C-1C4F11DD-B519BF81-222EACAD@' Method: BYE

Anyone have any ideas?

Optimistic bump?


Ok you havent posted the part of the dialplan that is in control

its macro-exten-vmnew as this is where the call goes back to.


exten => s,1,Background(silence/1)
exten => s,2,Macro(dial,30,r,${ARG2})
exten => s,3,Background(pls-wait-connect-call)
exten => s,4,Dial(SIP/98169150@,90,A(${ARG3}))
exten => s,20,Hangup

Voicemail is handled by the main PBX.

The point is, it’s not supposed to be going back to exten-vmnew, it should be dropping the call instead.

Ok so whats the dialplan that calls this ?

[quote] Macro(macroname|arg1|arg2…): Executes a macro using the context
’macro-’, jumping to the ‘s’ extension of that context and
executing each step, then returning when the steps end.
[/quote] which is whats happening.

But we need to see the whole picture


I believe it’s macro-dial that’s invoking macro-exten-vmnew.

The symptom is that when someone calls a SIP extension, when that extension disconnects they’re then forwarded to voicemail instead of the call dropping.

Hi We need to see the dialplan from the start. Macros are called initaly by something that passes the arguments to it.

So what we need to see is what calls the initial macro.


Is this what you’re looking for?

exten => 201,1,Macro(exten-vm,novm,201)
exten => 2112,1,Macro(exten-vm,novm,202)
exten => 7603,1,Macro(exten-vmnew,novm,7603,49125)
exten => 7602,1,Macro(exten-vmnew,novm,7602,39103)
exten => 7601,1,Macro(exten-vmnew,novm,7601,49150)
exten => 7600,1,Macro(exten-vmnew,novm,7600,49160)
exten => 7604,1,Macro(exten-vmnew,novm,7604,39110)
exten => 7606,1,Macro(ringout-needed,novm,7606)
exten => 7607,1,Macro(ringout-needed,novm,7607)
exten => 7700,1,Macro(exten-vmnew,novm,7700,48700)
exten => 7701,1,Macro(ringout-needed-w-busy,novm,7701)
exten => 7702,1,Macro(ringout-needed,novm,7702)
exten => 7703,1,Macro(ringout-needed,novm,7703)

I take it my last post wasn’t helpful?

If you could be more specific about what it is that you need to see, I will try and find it… Thanks.

Nevermind, I fixed it myself. macro-vmnew was the culprit.

It just needed to switch on $DIALSTATUS to either go to voicemail or hangup, as appropriate.

exten => s,1,Background(silence/1)
exten => s,2,Macro(dial,30,r,${ARG2})   ; dial the SIP extension
exten => s,3,Goto(s-${DIALSTATUS},1)    ; switch on status
exten => s-NOANSWER,1,Goto(s-VOICEMAIL,1)
exten => s-BUSY,1,Goto(s-VOICEMAIL,1)
exten => s-CHANUNAVAIL,1,Goto(s-VOICEMAIL,1)
exten => s-CONGESTION,1,Goto(s-VOICEMAIL,1)
exten => s-CANCEL,1,Goto(s-HANGUP,1)
exten => s-HANGUP,1,Wait(1)
exten => s-HANGUP,2,Hangup
exten => s-VOICEMAIL,1,Background(pls-wait-connect-call)
exten => s-VOICEMAIL,2,Dial(SIP/98169150@,90,A(${ARG3})) ; dial PBX