Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25647/channels

Modified Files:
        chan_zap.c 
Log Message:
Additions to chan_zap.c to receive PRI_EVENT_KEYPAD_DIGIT properly.  Bug #4286


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.445
retrieving revision 1.446
diff -u -d -r1.445 -r1.446
--- chan_zap.c  16 May 2005 14:41:05 -0000      1.445
+++ chan_zap.c  16 May 2005 18:48:09 -0000      1.446
@@ -7847,6 +7847,34 @@
                                                }
                                }
                                break;
+                       case PRI_EVENT_KEYPAD_DIGIT:
+                               chanpos = pri_find_principle(pri, 
e->digit.channel);
+                               if (chanpos < 0) {
+                                       ast_log(LOG_WARNING, "KEYPAD_DIGITs 
received on unconfigured channel %d/%d span %d\n", 
+                                               PRI_SPAN(e->digit.channel), 
PRI_CHANNEL(e->digit.channel), pri->span);
+                               } else {
+                                       chanpos = pri_fixup_principle(pri, 
chanpos, e->digit.call);
+                                       if (chanpos > -1) {
+                                               
ast_mutex_lock(&pri->pvts[chanpos]->lock);
+                                               /* queue DTMF frame if the PBX 
for this call was already started (we're forwarding KEYPAD_DIGITs further on */
+                                               if (pri->overlapdial && 
pri->pvts[chanpos]->call==e->digit.call && pri->pvts[chanpos]->owner) {
+                                                       /* how to do that */
+                                                       int digitlen = 
strlen(e->digit.digits);
+                                                       char digit;
+                                                       int i;                  
                
+                                                       for (i=0; i<digitlen; 
i++) {    
+                                                               digit = 
e->digit.digits[i];
+                                                               {
+                                                                       struct 
ast_frame f = { AST_FRAME_DTMF, digit, };
+                                                                       
zap_queue_frame(pri->pvts[chanpos], &f, pri);
+                                                               }
+                                                       }
+                                               }
+                                               
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
+                                       }
+                               }
+                               break;
+                               
                        case PRI_EVENT_INFO_RECEIVED:
                                chanpos = pri_find_principle(pri, 
e->ring.channel);
                                if (chanpos < 0) {

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to