How can I collect the 6 digits of ID number?

user_data1 property
application user data, for uses store their own "call session"
variable , it is helpfully in multi-lines programming.

In the sample demo, user_data1 store the flag of the "recording mode"

user_data1=0 now is not in the recording mode
user_data1=1 now is in the recording mode, user will press any key to stop recording.

The following is some codes for gather the zip code in Delphi, press '3' to start gather the zip code, '#' ending , Visual basic is the same story.

//---------------
procedure TForm1.Tapiex1DTMF(Sender: TObject; const m_Call: ITAPICall;
  KeyCode: Integer; DigitMode: TOleEnum; TickCount: Integer);
var
zipcode:string;
digitslen:integer;
begin

 if (m_Call.User_Data2>0) and (keycode<>ord('#')) then exit; //collecting zip 
code

  case keycode of
   ord('3'):begin
             m_Call.StopPlayBack;
             m_Call.PlaybackFile('zipreq.wav');
                 // enter your zip code followed by the # sign
             if m_Call.User_Data2=0 then //get the '3' store the current keys 
position in User_Data2
                 m_Call.User_Data2:=length(m_Call.DigitsReceived);
            end;

   ord('#'):begin
              digitslen:=m_Call.User_Data2; //get the '#'
              if digitslen>0 then
               begin
                  zipcode:=copy(m_Call.DigitsReceived,digitslen+1,length
(m_Call.DigitsReceived)-digitslen-1);
                 //get my zip code
                 caption:=zipcode;
                 Showmessage('Your zip code:' +  zipcode);
               end;
             end;
  end;
end;
//-------------------