原帖地址:http://blog.chinaunix.net/u/28461/showart_1966014.html
hello, all of users:
we have updated the callerid patch for wctdm.c and opvxa1200.c for both of zaptel and dahdi, I create a new thread to guild user how to use the patch. this new thread will let user know how to use the openvox new patched to detect callerid. please make sure few things to start the callerid patch:
1) you MUST subscribe callerid from your provider.
2) you MUST know the format of callerid(dtmf or fsk). you can ask your provider for that info, if you not know that.
3) this patch ONLY supports callerid with DTMF format.
4) you MUST know how the callerid is sent(beforeing first ring, or after first ring). You can hear that.
5) you SHOULD know how to compile zaptel with wctdm.c and opvxa1200.c and asterisk.
here, we use opvxa1200, zaptel-1.4.10 with asterisk-1.4.21 to demo the example. please go to the few these steps:
1) download the opvxa1200.c http://www.openvox.cn/viewvc/zaptel/trunk/1.4/ from that directory, if you use wctdm.c, you can downlaod wctdm.c
2) copy the opvxa1200.c to asterisk-1.4.10/kernel compiling zaptel in this way for A1200P/A800P, if you use wctdm.c, jump to step C).
A) add opvxa1200 in topmodule(TOPDIR_MODULES:=) in Makefile
B) add opvxa1200.o: kernel/wctdm.h kernel/zaptel.h find the line as below:
ztprovision.o: kernel/zaptel.h
ztmonitor.o: kernel/zaptel.h
opvxa1200.o: kernel/zaptel.h kernel/wctdm.h
ztspeed: CFLAGS=
C) If it is wctdm.c, you replace original wctdm.c(under zaptel-1.4.XX/kernel) with the newpatched wctdm.c.
D) run command: make, make install. after rebooting it, you can edit the zapata.conf and load the module by:
1) you MUST change the two parameters in zapata.conf to this:
cidsignalling=dtmf // MUST BE dtmf
cidstart=polarity // MUST BE polarity
2) modprobe zaptel // load zaptel driver
3) modprobe opvxa1200 cidbeforering=1 opermode=CHINA ; if loading a400p, please change to wctdm cidbeforering=1
here, users must to know how the callerid has been sent:
3.1)if before first ring, no polarity sending, send cid,then first ring: please load:
modprobe opvxa1200 cidbeforering=1 opermode=CHINA // opemode=CHINA load with CHINA format
3.2)if after first ring then send cid, you have to set:
modprobe opvxa1200 cidbeforering=1 cidbuflen=10 fixedtimepolarity =100 opermode=CHINA
NOTE: you MSUT load the driver with your COUNTRY. please change the parameters in zaptel.conf and indication.conf to your COUNTRY.
4) ztcfg -vvvvvvvvv
5) open your asterisk debug to check the functionality.
6) modify the chan_zap.c in asterisk, change res to 4000 or higher:
=============ss_thread method=====================
if (res <= 0) { ast_log(LOG_WARNING, "DTMFCID timed out waiting for ring. " "Exiting simple switch/n" ; ast_hangup(chan); return NULL; }
f = ast_read(chan);
if (!f) break;
if (f->frametype == AST_FRAME_DTMF)
{ dtmfbuf[i++] = f->subclass;
ast_log(LOG_DEBUG, "CID got digit '%c'/n", f->subclass);
res = 4000; // at line 6156, change 2000 to 4000
}
ast_frfree(f);
if (chan->_state == AST_STATE_RING
|| chan->_state == AST_STATE_RINGING) break; /* Got ring */ }
=================================
7) recompile your asterisk: make and make install
8) start asterisk: asterisk -vvvvvvvvvvgc -d
I do not give the the info for dahdi yet, User can download the dahdi patch from here: http://www.openvox.cn/viewvc/dahdi/trunk/
this patch works for most of cases,you MAY adjust the load parameters to fit your environment. therefore, you have to take more tests. if you have any problem, please leave here.
Regards!
james.zhu