Fix issue with no sound in both way in case of previous call to chan_unistim phone...
authorIgor Goncharovskiy <igor.goncharovsky@gmail.com>
Tue, 11 Jun 2013 10:24:04 +0000 (10:24 +0000)
committerIgor Goncharovskiy <igor.goncharovsky@gmail.com>
Tue, 11 Jun 2013 10:24:04 +0000 (10:24 +0000)
(related to ASTERISK-20183)
........

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

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391380 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_unistim.c

index 28d332f..fbc6add 100644 (file)
@@ -4792,7 +4792,7 @@ static int unistim_hangup(struct ast_channel *ast)
        struct unistim_line *l;
        struct unistim_device *d;
        struct unistimsession *s;
-       int i;
+       int i,end_call = 1;
 
        s = channel_to_session(ast);
        sub = ast_channel_tech_pvt(ast);
@@ -4835,10 +4835,8 @@ static int unistim_hangup(struct ast_channel *ast)
                unistim_unalloc_sub(d, sub);
                return 0;
        }
-
        if (sub->subtype == SUB_REAL) {
                sub_stop_silence(s, sub);
-               send_end_call(s); /* Send end call packet only if ending active call, in other way sound should be loosed */
        } else if (sub->subtype == SUB_RING) {
                send_no_ring(s);
                for (i = 0; i < FAVNUM; i++) {
@@ -4849,9 +4847,17 @@ static int unistim_hangup(struct ast_channel *ast)
                        if (is_key_line(d, i) && !strcmp(l->name, d->sline[i]->name)) {
                                send_favorite_short(i, FAV_LINE_ICON, s);
                                d->ssub[i] = NULL;
+                               continue;
+                       }
+                       if (d->ssub[i] != NULL) { /* Found other subchannel active other then hangup'ed one */
+                               ast_log(LOG_WARNING, "There is not only one call here %p %p %i\n",d->ssub[i], sub, i);
+                               end_call = 0;
                        }
                }
        }
+       if (end_call) {
+               send_end_call(s); /* Send end call packet only if ending active call, in other way sound should be loosed */
+       }
        sub->moh = 0;
        if (sub->softkey >= 0) {
                send_favorite_short(sub->softkey, FAV_LINE_ICON, s);
@@ -6141,7 +6147,7 @@ static int parse_bookmark(const char *text, struct unistim_device *d)
                        return 0;
                }
                if (d->softkeyicon[p] != 0) {
-                       ast_log(LOG_WARNING, "Invalid position %d for bookmark : already used\n:", p);
+                       ast_log(LOG_WARNING, "Invalid position %d for bookmark : already used:\n", p);
                        return 0;
                }
                memmove(line, line + 2, sizeof(line) - 2);