≡ Menu

Detecting Caller ID on Dialogic D4/PCI Analog card

I keep getting mails by various people about detecting caller id using D4PCI and Dialogic API. I remember I too had to try hard once and finally contacted Dialogic support for getting ideas how caller ID could be detected using D4/PCI analog CTI board from Dialogic. I think the same procedure should work for Donjin Analog boards as well as any kind of Analog CTI boards, for that matter.

So the steps for detecting Caller ID in D4PCI board is :

1. As soon as you detect RINGING, do not connect or answer the call. But start detecting digit using appropriate API function. For example dx_getdig();

2. Important part is the settings in DV_TPT structure which is used in dx_getdig() function. Here is how I have been configuring:

  • End of DX_MAXDTMF should be configured to be length of expected Caller ID length.
  • DX_MAXTIME should be configured to be delay between two rings.
  • Since DTMF digits for Caller ID are sent together quickly by the PBX, one may take advantage of the option DX_IDDTIME ( Inter-digit Pause).

3. As soon as one comes out of from dx_getdig() function either because of DX_MAXDTMF,DX_MAXTIME or DX_IDDTIME, one should check if Caller ID is detected or not!

So these are the three simple steps for detecting Caller ID using D4PCI board. Here is the C++ code snippet:-

DV_TPT tpt[4];

// Allocate memory
memset( tpt, 0, (sizeof( DV_TPT ) * 3) );

/* Terminate GetDigits on Receiving MAXDTMF Digits, Interdigit Pause and MAxrime */
tpt[ 0 ].tp_type = IO_CONT;
tpt[ 0 ].tp_termno = DX_MAXDTMF;
//tpt[ 0 ].tp_length = MAXDTMF;
tpt[ 0 ].tp_length = digits; // Number of digits of expected caller ID
tpt[ 0 ].tp_flags = TF_MAXDTMF;

// Terminate dx_getdig function after 3 second Interdigit pause
tpt[ 1 ].tp_type = IO_CONT;
tpt[ 1 ].tp_termno = DX_IDDTIME;
tpt[ 1 ].tp_length = 30; // Gap in betwwen digits
tpt[ 1 ].tp_flags = TF_IDDTIME;

/* Terminate GetDigits after 8 Seconds */
tpt[ 2 ].tp_type = IO_EOT;
tpt[ 2 ].tp_termno = DX_MAXTIME;
tpt[ 2 ].tp_length = 80; // Maximum time
tpt[ 2 ].tp_flags = TF_MAXTIME;

if (dx_getdig( voiceh_handle, tpt, &(dtbuf),(unsigned short)ASYNC ) == -1 )
printf(“getdtmfs return 0x%Xn”, ATDV_LASTERR(pline->voiceh));


So here are few facts I have realised:-

1. D4PCI board ( or any analog board in that matter ) may not detect caller ID all the time completely (all the digits) all the time. It has nothing to do with the Dialogic CTI board though. The reason can be explained as below :

Normally, caller ID is presented in the form of DTMF ( Dual Tone Multiple Frequency) digits after the first ring and before the second ring.

I have observed that, some times, analog board fails to detect the first ring and detects the ring from the second ring only. It this case, any CTI application would miss the caller ID completely. Some other times, the analog board (D4PCI or equivalent analog CTI boards) would detect the ring at the end of first ring cadence which may result in missing first few caller ID digits.

So, detecting caller id perfectly using analog board may depend on PBX being used. If any one knows any better technique, it will be great to share here.

Next post:

Previous post:

{ 4 comments… add one }
  • Jayakrishnan K January 23, 2010, 3:42 pm

    You forgot to mention the missed call scenario which everyone eventually runs into. In a nutshell a missed call followed by an actual call would result in the first caller-id being assigned to the second call. Not a very good thing to happen. The implementation described above suffers from this issue.

  • Uttam Pegu January 23, 2010, 3:47 pm

    Hi Jayakrishnan,
    Thank you for pointing out the missed call scenario.

    Yes, that is another issue which which one has to live with Analog CTI boards.

  • R K Aggarwal February 8, 2010, 10:56 am

    can u pls. send me the code in Simple C Lang. for Caller ID Detection, I m not using any handles etc in my ivrs application in D4pci card.
    my whole ivrs program is ready except callerID.
    waiting for your early and positive reply.
    I will be very greatful to you.

    REGARD and Thanxs

    R K Aggarwal

  • Uttam Pegu February 8, 2010, 12:48 pm

    Hi RK Aggarwal,
    Are you using GC Protocol of DX functions ? I will try to send you the code in few days time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.