All pastes #11948 Raw Edit

Anonymous

public text v1 · immutable
#11948 ·published 2005-05-17 01:14 UTC
rendered paste body
diff -u -r1.445 chan_zap.c
--- channels/chan_zap.c 16 May 2005 14:41:05 -0000      1.445
+++ channels/chan_zap.c 17 May 2005 01:14:20 -0000
@@ -960,6 +960,7 @@
        struct zt_pvt *p;
        int res = 0;
        int index;
+       struct ast_frame f = { AST_FRAME_CNG };
        p = ast->tech_pvt;
        ast_mutex_lock(&p->lock);
        index = zt_get_index(ast, p, 0);
@@ -982,14 +983,26 @@
 #else
                {
 #endif
+
+                       struct ast_channel *bchan;
+                       bchan = ast_bridged_channel(ast);
+                       if(bchan) {
+                               ast_write(bchan, ast_frdup(&f));
+                               ast_log(LOG_WARNING, "sending CNG to bridge peer...\n");
+//                     } else {
+//                             ast_queue_frame(ast, &f);
+//                             ast_log(LOG_WARNING, "sending CNG to self...\n");
+                       }
+
                        zo.op = ZT_DIAL_OP_APPEND;
                        zo.dialstr[0] = 'T';
                        zo.dialstr[1] = digit;
                        zo.dialstr[2] = 0;
                        if ((res = ioctl(p->subs[SUB_REAL].zfd, ZT_DIAL, &zo)))
                                ast_log(LOG_WARNING, "Couldn't dial digit %c\n", digit);
-                       else
+                       else {
                                p->dialing = 1;
+                       }
                }
        }
        ast_mutex_unlock(&p->lock);
@@ -2994,6 +3007,8 @@
                        return 0;
                }
                if (f->frametype == AST_FRAME_DTMF) {
+                       struct ast_frame cng = { AST_FRAME_CNG };
+
                        if (((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) ||
                            ((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))) {
                                *fo = f;
@@ -3006,6 +3021,9 @@
                        } else if ((who == c1) && p1->pulsedial) {
                                ast_write(c0, f);
                        }
+
+                       ast_write(c0, &cng);
+                       ast_write(c1, &cng);
                }
                ast_frfree(f);