[Asterisk-Dev] zap call pickup problem - more details

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Wed Jun 2 07:14:52 MST 2004


I have modified res_parking.c and chan_zap.c to give me some more details.

T100P, Adit600, 16FXS, 8FXO.

Channels 1-16 are callgroup 1, pickupgroup 1
Channels 17-23 are callgroup 2, pickupgroup 2
Channel 24 is callgroup 1, no specific pickupgroup.

I have chan_zap.c show me the bitmaps for the call/pickupgroups:
+ int i;
+ char groupbits[17];
+
+for(i=0; i<16; i++)
+   groupbits[i] = ( tmp->callgroup & 1<<(15-i) ) ? '1' : '0';
+groupbits[16] = 0;
+ast_cli(fd, "callgroup  : %s\n", groupbits);
+
+for(i=0; i<16; i++)
+   groupbits[i] = ( tmp->pickupgroup & 1<<(15-i) ) ? '1' : '0';
+groupbits[16] = 0;
+ast_cli(fd, "pickupgroup: %s\n", groupbits);
+

Nothing too funky.  Anyway:
*CLI> zap show channel 2
Channel: 2
File Descriptor: 13
Span: 1
Extension:
Context: fxs
callgroup  : 0000000000000010
pickupgroup: 0000000000000010
...

*CLI> zap show channel 24
*CLI> zap show channel 24
Channel: 24
File Descriptor: 35
Span: 1
Extension:
Context: in_2914574
callgroup  : 0000000000000010
pickupgroup: 0000000000000100
...

good.  Makes sense, and is exactly how I specifed in zapata.conf (it's in 
pickup group 2 since it carried over from channel 17-23's settings).

Now res_parking.c was modified to give me some details about the channels as 
it scanned them for picking up:


# cvs diff -u res_parking.c
Index: res_parking.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_parking.c,v
retrieving revision 1.23
diff -u -r1.23 res_parking.c
--- res_parking.c       20 May 2004 16:30:10 -0000      1.23
+++ res_parking.c       2 Jun 2004 14:10:49 -0000
@@ -737,8 +737,32 @@
 {
        struct ast_channel *cur;
        int res = -1;
+
+char groupbits[17];
+int i;
+
        cur = ast_channel_walk_locked(NULL);
        while(cur) {
+
+ast_log(LOG_DEBUG, "ast_pickup_call(%s):\n", chan->name);
+ast_log(LOG_DEBUG, "                    cur->name: %s\n", cur->name);
+ast_log(LOG_DEBUG, "                    cur->pbx: %s\n", cur->pbx ? "true" : 
"false");
+
+for(i=0; i<16; i++)
+   groupbits[i] = ( cur->callgroup & 1<<(15-i) ) ? '1' : '0';
+groupbits[16] = 0;
+
+ast_log(LOG_DEBUG, "                    cur->callgroup: %s\n", groupbits);
+
+for(i=0; i<16; i++)
+   groupbits[i] = ( chan->pickupgroup & 1<<(15-i) ) ? '1' : '0';
+groupbits[16] = 0;
+
+ast_log(LOG_DEBUG, "                    chan->pickupgroup: %s\n", groupbits);
+
+ast_log(LOG_DEBUG, "                    chan->pickupgroup & cur->callgroup: 
%s\n", chan->pickupgroup & cur->callgroup ? "True" : "False");
+ast_log(LOG_DEBUG, "                    cur->state: %d\n", cur->_state);
+

And the output of an attempted pickup of channel 24 by channel 2:

DTMF digit: * on Zap/2-1
DTMF digit: 8 on Zap/2-1
Enabled echo cancellation on channel 2
ast_pickup_call(Zap/2-1):
                    cur->name: Zap/2-1
                    cur->pbx: false
                    cur->callgroup: 0000000000000010
                    chan->pickupgroup: 0000000000000010
                    chan->pickupgroup & cur->callgroup: True
                    cur->state: 1
ast_pickup_call(Zap/2-1):
                    cur->name: Zap/24-1
                    cur->pbx: true
                    cur->callgroup: 0000000000000000
                    chan->pickupgroup: 0000000000000010
                    chan->pickupgroup & cur->callgroup: False
                    cur->state: 4
No call pickup possible...

As you can see, Channel 24's callgroup and pickupgroup are completely wrong.  
Also, it's pbx flag is set.  

Channel 24 is in its own context and that context has an 's' extension -- 
however the extension does NOT answer() -- it Dial()'s my home * box through 
IAX2 (and that box does not answer unless I pick up a line).

Is there a reason why cur->pbx should be false for pickup?  And where do I 
start looking to see why the call/pickup groups are incorrect?

Regards,
Andrew



More information about the asterisk-dev mailing list