Fix station ringback; trunk hangup issues in SLA

This patch fixes two bugs:
 * If an outbound call is made from a SLA phone using SLAStation, then there is
   no ringtone audible to the phone that originates the call. The indication of
   the ringing was not being passed to the SLA station; this patch fixes that
   by passing through the progress indications.
 * If an SLA station hangs up before the called party answers, then the channel
   to the called party continues to ring until a timeout occurs. If the called
   party manages to answer, Asterisk attempts to connect the called party to
   a non-existant MeetMe room. This patch corrects the behavior by abandoning
   the call attempt if it detects that the SLA station is no longer in use
   while attempting to call the called party.

Review: https://reviewboard.asterisk.org/r/2275/

(closes issue ASTERISK-20462)
Reported by: dkerr
patches:
  asterisk-11-bugid20440+20462.patch uploaded by dkerr (license 5558)
  asterisk-11-bugid20462.patch uploaded by dkerr (license 5558)

(closes issue ASTERISK-20440)
Reported by: dkerr
patches:
  asterisk-11-bugid20440.patch uploaded by dkerr (license 5558)
  asterisk-11-bugid20440+20462.patch uploaded by dkerr (license 5558)
........

Merged revisions 379825 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 379826 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379828 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan 2013-01-22 15:15:04 +00:00
parent 09fb47a65c
commit 985ea8b2c9
1 changed files with 23 additions and 0 deletions

View File

@ -6425,6 +6425,8 @@ static void *dial_trunk(void *data)
struct sla_trunk_ref *trunk_ref = args->trunk_ref;
int caller_is_saved;
struct ast_party_caller caller;
int last_state = 0;
int current_state = 0;
if (!(dial = ast_dial_create())) {
ast_mutex_lock(args->cond_lock);
@ -6478,14 +6480,35 @@ static void *dial_trunk(void *data)
case AST_DIAL_RESULT_TIMEOUT:
case AST_DIAL_RESULT_UNANSWERED:
done = 1;
break;
case AST_DIAL_RESULT_TRYING:
current_state = AST_CONTROL_PROGRESS;
break;
case AST_DIAL_RESULT_RINGING:
case AST_DIAL_RESULT_PROGRESS:
case AST_DIAL_RESULT_PROCEEDING:
current_state = AST_CONTROL_RINGING;
break;
}
if (done)
break;
/* check that SLA station that originated trunk call is still alive */
if (args->station && ast_device_state(args->station->device) == AST_DEVICE_NOT_INUSE) {
ast_debug(3, "Originating station device %s no longer active\n", args->station->device);
trunk_ref->trunk->chan = NULL;
break;
}
/* If trunk line state changed, send indication back to originating SLA Station channel */
if (current_state != last_state) {
ast_debug(3, "Indicating State Change %d to channel %s\n", current_state, ast_channel_name(trunk_ref->chan));
ast_indicate(trunk_ref->chan, current_state);
last_state = current_state;
}
/* avoid tight loop... sleep for 1/10th second */
ast_safe_sleep(trunk_ref->chan, 100);
}
if (!trunk_ref->trunk->chan) {