Summary:ASTERISK-15713: [patch] The Dial c option returns answered elsewhere if the dial timeout occurs (only tested using SIP)
Reporter:Dennis DeDonatis (dennisd)Labels:
Date Opened:2010-02-28 13:32:29.000-0600Date Closed:2011-06-07 14:05:24
Versions:Frequency of
Environment:Attachments:( 0) 16928.patch
Description:[2010-02-28 14:04:53.293] DEBUG[10201] channel.c: Hanging up channel 'SIP/2003-0000002a'
[2010-02-28 14:04:53.293] DEBUG[10201] chan_sip.c: This call was answered elsewhere[2010-02-28 14:04:53.293] DEBUG[10201] chan_sip.c: Hangup call SIP/2003-0000002a, SIP callid 3f786f6a497f3cf57fe1e56e0db536ad@example.com
[2010-02-28 14:04:53.293] DEBUG[10201] chan_sip.c: Updating call counter for outgoing call

This call was not answered anywhere.

****** STEPS TO REPRODUCE ******

exten => 519,1,Dial(sip/2003,5,c)

don't answer the sip phone and then check the DEBUG log.


This used to work, but I can't remember how long ago.  It may have worked properly on a 1.6.1 version.

There most likely should be a newline after the debug message "This call was answered elsewhere".

I've spent about 2 hours going through chan_sip.c and app_dial.c and I can't figure out how to fix this.  I really wanted to supply a patch, but I'm giving up for now in the hopes that someone who knows Asterisk internals will spot the problem quickly and easily.
Comments:By: Mark Michelson (mmichelson) 2010-05-26 15:25:07

I have uploaded 16928.patch, which I believe will fix the issue. Please test and let me know if it works properly.

By: Dennis DeDonatis (dennisd) 2010-05-26 15:36:32

I have applied the patch to and will test sometime later today, if possible.

By: Dennis DeDonatis (dennisd) 2010-05-26 19:58:44

This is on  The patch doesn't change the behavior.

Does not show there was a missed call on the GXP2000:


CANCEL sip:2024@;transport=udp SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK5cd24dae;rport
Max-Forwards: 70
From: "Dennis' Office" <sip:2009@dennisd.com>;tag=as7b4da91a
To: <sip:2024@;transport=udp>
Call-ID: 2097af5044935e6057cbfc38294ac5e4@dennisd.com
CSeq: 102 CANCEL
User-Agent: Asterisk PBX
Reason: SIP;cause=200;text="Call completed elsewhere"
Content-Length: 0

Shows there was a missed call on the GXP2000:


CANCEL sip:2024@;transport=udp SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK5997d6a5;rport
Max-Forwards: 70
From: "Dennis' Office" <sip:2009@dennisd.com>;tag=as3e5ccd5d
To: <sip:2024@;transport=udp>
Call-ID: 2ea2eaaa4b97e5560702fe297d7e2dd8@dennisd.com
CSeq: 102 CANCEL
User-Agent: Asterisk PBX
Content-Length: 0

I dialed from 2009 to 2024 and let it ring a couple of times and then hung up in both cases.


By: Mark Michelson (mmichelson) 2010-05-27 09:34:04

Thanks for the feedback. I should be able to look at this a bit more later today.

By: Mark Michelson (mmichelson) 2010-06-01 09:55:44

Didn't get a chance to look Thursday, and I have been on vacation since then, but I have plenty of time to get to this today.

By: Mark Michelson (mmichelson) 2010-06-01 10:50:08

I took a closer look at things, and I have concluded that the option is actually working as it is supposed to be. From the documentation of the 'c' option:

"If the Dial() application cancels this call, always set the flag to tell the channel driver that the call is answered elsewhere"

The wording of the option makes it clear that with the 'c' option set, the indication of the "answered elsewhere" status will be set for all canceled calls. As far as I can tell, this option really is only useful if a single Dial() calls multiple local channels, which each in turn dial endpoints. The individual dials from within the Local channels would need the 'c' option set in case one of the other simultaneous Dials is answered.

For your situation, the fix is simple. Just remove the 'c' option. If you dial multiple endpoints and only 1 answers, then the "answered elsewhere" indication will be properly sent to the endpoints that had CANCELs sent to them.