diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-04-18 16:44:48 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-04-18 16:44:48 +0000 |
commit | 51b6c49681c17d260aebc67e618f996b9a7f1176 (patch) | |
tree | ec16e0af53fbf5ae405439c8ff08d8404f756a39 /main/dial.c | |
parent | cbe7f656749f5cf7e4d8321ef74a99c9281a2284 (diff) |
Originated calls: Fix several originate call problems.
* Restore the reason value set by pbx_outgoing_attempt() to use
AST_CONTROL_xxx values as all the consumers were expecting rather than
cause codes.
* Fixed the dial routines to set cause codes for more than just
ast_request() so pbx_outgoing_attempt() reason codes will function.
* Fix inconsistent locked_channel return status in pbx_outgoing_attempt().
The chanel may not have been locked or the channel may have been a stale
pointer.
* Fixed the OutgoingSpoolFailed channel to run dialplan whenever the
dialing fails for an originate exten and 1 < synchronous.
* Fix incorrect ast_cond_wait() usage in pbx_outgoing_attempt().
Indroduced by issue ASTERISK-22212 patch.
* Made struct pbx_outgoing use the ao2 lock instead of its own lock for
the cond wait mutex. No sense in having two locks associated with the
same struct when only one is needed.
Review: https://reviewboard.asterisk.org/r/3421/
........
Merged revisions 412581 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/dial.c')
-rw-r--r-- | main/dial.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/main/dial.c b/main/dial.c index bf0d51c5e..2563c707b 100644 --- a/main/dial.c +++ b/main/dial.c @@ -541,12 +541,14 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner)); ast_channel_publish_dial(chan, channel->owner, channel->device, "BUSY"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_USER_BUSY; channel->owner = NULL; break; case AST_CONTROL_CONGESTION: ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner)); ast_channel_publish_dial(chan, channel->owner, channel->device, "CONGESTION"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; channel->owner = NULL; break; case AST_CONTROL_INCOMPLETE: @@ -593,7 +595,7 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel break; case AST_CONTROL_HOLD: ast_verb(3, "Call on %s placed on hold\n", ast_channel_name(chan)); - ast_indicate(chan, AST_CONTROL_HOLD); + ast_indicate_data(chan, AST_CONTROL_HOLD, fr->data.ptr, fr->datalen); break; case AST_CONTROL_UNHOLD: ast_verb(3, "Call on %s left from hold\n", ast_channel_name(chan)); @@ -613,8 +615,6 @@ static void handle_frame(struct ast_dial *dial, struct ast_dial_channel *channel break; } } - - return; } /*! \brief Helper function that handles control frames WITHOUT owner */ @@ -638,12 +638,25 @@ static void handle_frame_ownerless(struct ast_dial *dial, struct ast_dial_channe ast_verb(3, "%s is busy\n", ast_channel_name(channel->owner)); ast_channel_publish_dial(NULL, channel->owner, channel->device, "BUSY"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_USER_BUSY; channel->owner = NULL; break; case AST_CONTROL_CONGESTION: ast_verb(3, "%s is circuit-busy\n", ast_channel_name(channel->owner)); ast_channel_publish_dial(NULL, channel->owner, channel->device, "CONGESTION"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION; + channel->owner = NULL; + break; + case AST_CONTROL_INCOMPLETE: + /* + * Nothing to do but abort the call since we have no + * controlling channel to ask for more digits. + */ + ast_verb(3, "%s dialed Incomplete extension %s\n", + ast_channel_name(channel->owner), ast_channel_exten(channel->owner)); + ast_hangup(channel->owner); + channel->cause = AST_CAUSE_UNALLOCATED; channel->owner = NULL; break; case AST_CONTROL_RINGING: @@ -661,8 +674,6 @@ static void handle_frame_ownerless(struct ast_dial *dial, struct ast_dial_channe default: break; } - - return; } /*! \brief Helper function to handle when a timeout occurs on dialing attempt */ @@ -686,6 +697,7 @@ static int handle_timeout_trip(struct ast_dial *dial, struct timeval start) AST_LIST_TRAVERSE(&dial->channels, channel, list) { if (dial->state == AST_DIAL_RESULT_TIMEOUT || diff >= channel->timeout) { ast_hangup(channel->owner); + channel->cause = AST_CAUSE_NO_ANSWER; channel->owner = NULL; } else if ((lowest_timeout == -1) || (lowest_timeout > channel->timeout)) { lowest_timeout = channel->timeout; @@ -835,6 +847,7 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann ast_poll_channel_del(chan, channel->owner); ast_channel_publish_dial(chan, channel->owner, channel->device, "CANCEL"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_ANSWERED_ELSEWHERE; channel->owner = NULL; } AST_LIST_UNLOCK(&dial->channels); @@ -859,6 +872,7 @@ static enum ast_dial_result monitor_dial(struct ast_dial *dial, struct ast_chann ast_poll_channel_del(chan, channel->owner); ast_channel_publish_dial(chan, channel->owner, channel->device, "CANCEL"); ast_hangup(channel->owner); + channel->cause = AST_CAUSE_NORMAL_CLEARING; channel->owner = NULL; } AST_LIST_UNLOCK(&dial->channels); |