aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_sip.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index e84dd20de..6c403bc3a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -7881,13 +7881,22 @@ static int transmit_state_notify(struct sip_pvt *p, int state, int full, int tim
/* Check which device/devices we are watching and if they are registered */
if (ast_get_hint(hint, sizeof(hint), NULL, 0, NULL, p->context, p->exten)) {
char *hint2 = hint, *individual_hint = NULL;
+ int hint_count = 0, unavailable_count = 0;
+
while ((individual_hint = strsep(&hint2, "&"))) {
- /* If they are not registered, we will override notification and show no availability */
- if (ast_device_state(individual_hint) == AST_DEVICE_UNAVAILABLE) {
- local_state = NOTIFY_CLOSED;
- pidfstate = "away";
- pidfnote = "Not online";
- }
+ hint_count++;
+
+ if (ast_device_state(individual_hint) == AST_DEVICE_UNAVAILABLE)
+ unavailable_count++;
+ }
+
+ /* If none of the hinted devices are registered, we will
+ * override notification and show no availability.
+ */
+ if (hint_count > 0 && hint_count == unavailable_count) {
+ local_state = NOTIFY_CLOSED;
+ pidfstate = "away";
+ pidfnote = "Not online";
}
}