app_queue: Fix multiple calls to a queue member that is in only one queue.

When ringinuse=no queue members can receive more than one call if these
calls happen at nearly the same time.

* Fix so a queue member does not receive more than one call from a queue.

NOTE: This fix does not prevent multiple calls to a member if the member
is in more than one queue.

* Did some refactoring to eliminate some code redundancy.

(issue ASTERISK-16115)
Reported by: nik600
Patches:
      jira_asterisk_16115_single_q_v1.8.patch (license #5621) patch uploaded by rmudgett
      Modified

* Revert the -r341580 and -r341599 changes adding the queues.conf
check_state_unknown option as it was added in an attempt to fix this
problem.  The fix did not need to be optional.  The fix should not have
tried to explicitly set the device state.  Setting the device state by
something other than the device introduces a race condition.  I also could
not see how the change would be effective other than delaying the
app_queue code long enough for the device state to propagate to app_queue.
........

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

Merged revisions 378683 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/11@378687 f38db490-d61c-443f-a65b-d21fe96a405b
app_queue: Fix incorrect assertion.

(issue ASTERISK-16115)
........

Merged revisions 378689 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/11@378690 f38db490-d61c-443f-a65b-d21fe96a405b