]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
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:22:00 +0000 (10:22 +0000)
committerIgor Goncharovskiy <igor.goncharovsky@gmail.com>
Tue, 11 Jun 2013 10:22:00 +0000 (10:22 +0000)
(related to ASTERISK-20183)

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

channels/chan_unistim.c

index 733176724425283dddf8f8f178431cddba6eb67b..396000f6ce013fa46ca79276418b28de4784940c 100644 (file)
@@ -4777,7 +4777,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);
@@ -4822,10 +4822,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++) {
@@ -4836,9 +4834,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);
@@ -6132,7 +6138,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);