Adds support for defining a timeout when ringing a queue member interface. This is useful if you add interfaces like 'SIP/6001' to a queue, where you don't have the option to set a timeout using the Dial application. Index: asterisk-1.4.17~dfsg/apps/app_queue.c =================================================================== --- asterisk-1.4.17~dfsg.orig/apps/app_queue.c 2009-01-25 14:06:20.000000000 +0100 +++ asterisk-1.4.17~dfsg/apps/app_queue.c 2009-01-25 14:27:07.000000000 +0100 @@ -439,7 +439,8 @@ int wrapuptime; /*!< Wrapup Time */ int retry; /*!< Retry calling everyone after this amount of time */ - int timeout; /*!< How long to wait for an answer */ + int timeout; /*!< How long to wait before leaving the queue */ + int member_timeout; /*!< How long to wait for a member to pick up a ringing call */ int weight; /*!< Respective weight */ int autopause; /*!< Auto pause queue members if they fail to answer */ @@ -834,6 +835,7 @@ q->dead = 0; q->retry = DEFAULT_RETRY; q->timeout = -1; + q->member_timeout = 0; q->maxlen = 0; q->announcefrequency = 0; q->announceholdtime = 0; @@ -979,6 +981,10 @@ q->timeout = atoi(val); if (q->timeout < 0) q->timeout = DEFAULT_TIMEOUT; + } else if (!strcasecmp(param, "member-timeout")) { + q->member_timeout = atoi(val); + if (q->member_timeout < 0) + q->member_timeout = 0; } else if (!strcasecmp(param, "ringinuse")) { q->ringinuse = ast_true(val); } else if (!strcasecmp(param, "setinterfacevar")) { @@ -2841,10 +2847,21 @@ free(tmp); } } - if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout)) - to = (qe->expire - now) * 1000; - else - to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1; + int member_timeout = qe->parent->member_timeout; + if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout)) { + if (member_timeout > 0 && member_timeout < (qe->expire - now)) { + to = member_timeout * 1000; + } else { + to = (qe->expire - now) * 1000; + } + } else { + int queue_timeout = (qe->parent->timeout) ? qe->parent->timeout : -1; + if (member_timeout > 0 && member_timeout < queue_timeout) { + to = member_timeout * 1000; + } else { + to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1; + } + } ++qe->pending; ring_one(qe, outgoing, &numbusies); ast_mutex_unlock(&qe->parent->lock);