There is a lack of extant documentation (both Japanese and English) to configure Asterisk to detect CallerID on NTT analog lines.
Below is a configuration set that works for me. The analog card is a Taobao/AliExpress-sourced AEX410 clone. Digium likes to remove support for cards that it no longer sells from their official drivers, and the Linux kernel developers like to gratuitiously break driver APIs … which means that Digium drivers with AEX410 support (or TDM4xx support, etc) can’t be used with modern Linux kernels.
I’ve forked the Digium drivers, forward-ported wctdm and wctdm24xpp support, and placed the source code on GitHub here.
/etc/modprobe.d/dahdi.conf:
options wctdm24xxp boostringer=1 opermode=JAPAN
/etc/dahdi/system.conf:
fxsks=1 echocanceller=oslec,1 fxoks=2 echocanceller=oslec,2 fxoks=3 echocanceller=oslec,3 fxoks=4 echocanceller=oslec,4 # Global data loadzone = us defaultzone = us
chan_dahdi.conf preamble:
[channels] language=ja transfer=no canpark=no cancallforward=no callreturn=no immediate=no ; give Asterisk time to get CallerID usecallerid=yes cidstart=polarity ; NTT reverses polarity for CallerID cidsignalling=v23_jp ; NTT uses v23_jp echocancel=yes echocancelwhenbridged=no echotraining=no busydetect=yes busycount=15 answeronpolarityswitch=no ; give Asterisk time to get CallerID hanguponpolarityswitch=yes ; NTT reverses polarity on hangup ; FXO port 0 (Asterisk port 1) signalling=fxs_ks rxgain=3.0 hwtxgain=disabled ; hardware gain settings screw up CID callerid=asreceived group=0 context=inbound channel => 1
… if you have more analog lines, tack them onto the end.
That should do the trick.