[Newbie]Problem with IVR

I’m using Asterisk 1.2.9 IVR functionality to allow our users to activate some functionality. They enter a code (12 digits) via DTMF, some identification (their phonenumber), and receive a SMS with the information, if the entered information is valid. Asterisk runs on a Linux box and has only a SIP channel for incoming calls configured.

Typically this works well, but sometimes the connection will be shut down during entering the 12 digits or the phone number (which must be finished with a #) before the code is completely entered. Asterisk is going on dealing with the dial plan, but the user connection has been shut down.

Where could be the error?

My dial plan:

[general]
static=yes
writeprotect=no

[sipgate_in]
; incoming calls are directly transferred to ivr
exten => ,1,Goto(ivr_greeting|s|1)

[ivr_greeting]
; IVR: welcome
exten => s,1,Set(LANGUAGE()=de)
exten => s,n,Answer()
exten => s,n,Wait(2)
exten => s,n,Set(TIMEOUT(digit)=5)
exten => s,n,Set(TIMEOUT(response)=10)
exten => s,n,Playback(cxp/welcome)
exten => s,n,Playback(cxp/activate)
exten => s,n,Goto(ivr_read_ppc|s|1)
exten => s,n,Hangup()

[ivr_read_ppc]
; read 12 digit code, store it in variable PPC
exten => s,1,Read(PPC,cxp/enterppc,12,3)
exten => s,n,Goto(ivr_validate_ppc|s|1)
exten => s,n,Hangup()

[ivr_validate_ppc]
; ask user whether received code is correct
exten => s,1,Playback(cxp/playppc)
exten => s,n,SayDigits(${PPC})
exten => s,n,Background(cxp/entrycorrect)

; 1 == input: ok
exten => 1,1,Goto(ivr_check_callerid|s|1)
exten => i,n,Hangup()

; input > 1: wrong input, repeat
exten => i,1,Goto(ivr_read_ppc|s|1)
exten => i,n,Hangup()

[ivr_check_callerid]
; check whether we know the calling phoneno
exten => s,1,GotoIf($[${CALLERID(num)} != “”]?ivr_phoneno_known|s|1:ivr_read_phoneno|s|1)
exten => s,n,Hangup()

[ivr_phoneno_known]
; tell user we got a phoneno
exten => s,1,Set(PHONENO=${CALLERID(num)})
exten => s,n,Playback(cxp/phonenofound)
exten => s,n,Goto(ivr_validate_phoneno|s|2)
exten => s,n,Hangup()

[ivr_read_phoneno]
; input phoneno (if not known or wrong)
exten => s,1,Read(PHONENO,cxp/enterphoneno,0,3)
exten => s,n,Goto(ivr_validate_phoneno|s|1)
exten => s,n,Hangup()

[ivr_validate_phoneno]
; ask user whether phoneno is correct
exten => s,1,Playback(cxp/playphoneno)
exten => s,2,SayDigits(${PHONENO})
exten => s,n,Background(cxp/entrycorrect)

; 1 == input: correct phoneno
exten => 1,1,Goto(ivr_activate_transaction|s|1)
exten => 1,n,Hangup()
; input > 1: wrong phoneno. Repeat input
exten => i,1,Goto(ivr_read_phoneno|s|1)
exten => i,n,Hangup()

[ivr_activate_transaction]
; call AGI to validate input and send SMS
exten => s,1,Playback(cxp/patience)
exten => s,n,AGI(cxp_ppc.agi)
exten => s,n,Hangup()

; --------------------------------------------------------------------
;

[default]

include => ivr_greeting