Call completion question

I have my Asterisk server behind a fax machine which uses distinctive ring (i.e. PSTN-fax-Asterisk-phones). This is working fine - the fax is set to not answer before Asterisk has a chance to process a voice call.

The problem I have is when a call is completed, and another call comes in immediately afterwards, the fax tone is heard right away (from the calling side), then the caller is hung up. On the Asterisk side, I see the following:

-- Starting simple switch on 'Zap/1-1'

[Apr 15 10:25:11] WARNING[4059]: chan_zap.c:6499 ss_thread: CallerID returned with error on channel ‘Zap/1-1’
– Executing [s@incoming:1] Wait(“Zap/1-1”, “5”) in new stack
– Starting simple switch on ‘Zap/3-1’
– Executing [s@incoming:2] Answer(“Zap/1-1”, “”) in new stack
– Executing [s@incoming:3] Goto(“Zap/1-1”, “internal|6002|1”) in new stack
– Goto (internal,6002,1)
– Executing [6002@internal:1] Macro(“Zap/1-1”, “voicemail|Zap/3”) in new stack
– Executing [s@macro-voicemail:1] Dial(“Zap/1-1”, “Zap/3|20”) in new stack
[Apr 15 10:25:16] WARNING[4059]: app_dial.c:1106 dial_exec_full: Unable to create channel of type ‘Zap’ (cause 17 - User busy)

It appears to me that the Zap channel is taking some time to fully hang-up and therefore the following call is being affected. When the call drops (at the caller’s side), Asterisk continues to process the call, ringing the extension (with CallerID unknown) even though the call was dropped (by the Asterisk side).

To be clear, the second call is being dialled a few seconds after the first call is completed.

My dialplan looks like this for Zap coming in:
[incoming]
;
; Incoming calls from the FXO port are directed to this context from zapata.conf
;
exten => s,1,Wait(3)
exten => s,n,Answer()
exten => s,n,Goto(internal,6002,1)

[internal]
;
; Main context for extensions
;
exten => 6002,1,Macro(voicemail,Zap/3)

;
; Voicemail setup macro (from *: TFOT)
;
[macro-voicemail]
exten => s,1,Dial(${ARG1},20)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},u)
exten => s-NOANSWER,n,Goto(incoming,s,1)
exten => s-BUSY,1,Voicemail(${MACRO_EXTEN},b)
exten => s-BUSY,n,Goto(incoming,s,1)
exten => _s-.,1,Goto(s-NOANSWER,1)
;

I’d appreciate any assistance in amending the configuration to resolve this.

Thanks,

Des

I’d put an explicit Hangup() command somewhere in there.

I’m not sure why you have your next step after voicemail to return the call to the incoming context.

That restarts the call from the beginning.

I’d change this:

exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},u)
exten => s-NOANSWER,n,Goto(incoming,s,1)

To:

exten => s-NOANSWER,1,Voicemail(${MACRO_EXTEN},u)
exten => s-NOANSWER,n,Hangup()

Same thing with the BUSY section.

If you put some NoOp() statements in your incoming context, you’ll probably see that the call is returning there, and trying to call extension 6002 again. (Which is where the Dial() command is failing. The original call has hung up.)

Dufus,

Thanks for your help. I made the changes you suggested (the original code came straight from The Future of Telephony book); however, the change didn’t affect the issue.

I also added a NoOp in the incoming context, to display the incoming CallerID. On the original call, I see the calling number as expected. When I end that call and call back, there is no CallerID - in fact I see:

WARNING[5699]: chan_zap.c:6499 ss_thread: CallerID returned with error on channel ‘Zap/1-1’

What I don’t understand is how, given the second call is terminated (at least at the caller end) as soon as the fax tone is heard, Asterisk is involved - if the fax answers (if, indeed that is what is happening), then shouldn’t Asterisk ignore the call?

Regards,

Des

The problem is that the call isn’t being ended.

The call has more work to do after the voicemail is collected, because you send the call back to the incoming context.

At that point the system puts call processing on a three second wait, and then tries to proceed. The errors occur because it tries to continue to process a call that’s no longer in progress.

You might also consider putting in an ‘h’ extension to tell the system what to do after a hangup event.

When you made the changes, did you remember to restart the system?

Dufus,

I made the changes you suggested, and have reloaded the dialplan after each change I’ve made.

Still getting the same result, though. I also tried to place an “h” extension, both in the macro and subsequently in the incoming context, but this didn’t seem to help. I tried “h,1()” - not sure what an appropriate command to run would be.

I agree with you that the call doesn’t seem to be ending, although the console (at verbose level 3) shows the execution of the hangup. Below is the log of the first call, answered and hung up, followed by the second:

-- Executing [604xxxxxxx@DCG:1] Dial("SIP/6000-0820d918", "SIP/604xxxxxxx@dolphin-outbound|60|tr") in new stack
-- Called 604xxxxxxx@dolphin-outbound
-- SIP/dolphin-outbound-081f96f8 is making progress passing it to SIP/6000-0820d918
-- SIP/dolphin-outbound-081f96f8 is ringing
-- Starting simple switch on 'Zap/1-1'
-- Executing [s@incoming:1] Wait("Zap/1-1", "3") in new stack
-- Executing [s@incoming:2] Answer("Zap/1-1", "") in new stack
-- Executing [s@incoming:3] NoOp("Zap/1-1", "CallerID is 604xxxxxxx") in new stack
-- Executing [s@incoming:4] Goto("Zap/1-1", "internal|6002|1") in new stack
-- Goto (internal,6002,1)
-- Executing [6002@internal:1] Macro("Zap/1-1", "voicemail|Zap/3") in new stack
-- Executing [s@macro-voicemail:1] Dial("Zap/1-1", "Zap/3|20") in new stack
-- Called 3
-- Zap/3-1 is ringing
-- SIP/dolphin-outbound-081f96f8 answered SIP/6000-0820d918
-- Zap/3-1 is ringing
-- Zap/3-1 answered Zap/1-1
-- Native bridging Zap/1-1 and Zap/3-1
-- Hungup 'Zap/3-1'

== Spawn extension (macro-voicemail, s, 1) exited non-zero on ‘Zap/1-1’ in macro ‘voicemail’
== Spawn extension (macro-voicemail, s, 1) exited non-zero on ‘Zap/1-1’
[Apr 17 11:38:04] WARNING[9467]: pbx.c:1797 pbx_extension_helper: No application ‘’ for extension (macro-voicemail, h, 1)
== Spawn extension (macro-voicemail, h, 1) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’
== Spawn extension (DCG, 604xxxxxxx, 1) exited non-zero on ‘SIP/6000-0820d918’
– Starting simple switch on ‘Zap/1-1’
– Starting simple switch on ‘Zap/3-1’
– Hungup ‘Zap/3-1’
[Apr 17 11:38:37] WARNING[9477]: chan_zap.c:6499 ss_thread: CallerID returned with error on channel ‘Zap/1-1’
– Executing [s@incoming:1] Wait(“Zap/1-1”, “3”) in new stack
– Executing [s@incoming:2] Answer(“Zap/1-1”, “”) in new stack
– Executing [s@incoming:3] NoOp(“Zap/1-1”, "CallerID is ") in new stack
– Executing [s@incoming:4] Goto(“Zap/1-1”, “internal|6002|1”) in new stack
– Goto (internal,6002,1)
– Executing [6002@internal:1] Macro(“Zap/1-1”, “voicemail|Zap/3”) in new stack
– Executing [s@macro-voicemail:1] Dial(“Zap/1-1”, “Zap/3|20”) in new stack
– Called 3
– Zap/3-1 is ringing
– Zap/3-1 is ringing
– Zap/3-1 answered Zap/1-1
– Native bridging Zap/1-1 and Zap/3-1
– Hungup ‘Zap/3-1’
== Spawn extension (macro-voicemail, s, 1) exited non-zero on ‘Zap/1-1’ in macro ‘voicemail’
== Spawn extension (macro-voicemail, s, 1) exited non-zero on ‘Zap/1-1’
[Apr 17 11:38:46] WARNING[9477]: pbx.c:1797 pbx_extension_helper: No application ‘’ for extension (macro-voicemail, h, 1)
== Spawn extension (macro-voicemail, h, 1) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’