[asterisk-users] hangup not detected?

Justin Killen jkillen at allamericanasphalt.com
Fri May 18 12:00:28 CDT 2012


I have and automated call-in dispatch system where hundreds of people call in daily for 2-3 minutes each.  The extension is set up to get their information, then text-to-speech the dispatch information (via odbc).  It then loops 5 times then ends the call.  These calls are being handled by an 8 port analog digium card.

Sometimes though, I see calls via 'core show channel dahdi/1-1' that have a time of > 16 hours.  I'm not sure if this is a result of dahdi missing the hangup, ODBC timing out, or TTS failing for some reason.  When a channel gets in this state, the call doesn't seem to progress through the dialplan, they always display the TTS line.  Doing a 'dahdi destroy channel 1-1' doesn't seem to be effective - the only way I've been able to clear the calls is to do a 'dahdi restart' and/or restart the asterisk service.

For TTS I'm using cepstral with the Swift wrapper.

Here is a snippet of my dialplan:


[AAA_27_EMP]
exten => s,1,Answer
        same => n,Set(CDR(accountcode)=27_EMP)
        same => n,Set(comp_num=27)
        same => n,Set(readprompt=AAA/enter_employee_number)
        same => n,Set(truck_text=employee number)
        same => n,Set(validate_func=AAA_VALIDATE_EMP_NUM)
        same => n,Set(get_param1=27)
        same => n,Set(get_param2=E)
        same => n,Set(read_length=7)
        same => n,Goto(DB_LOOKUP,s,1)

[DB_LOOKUP]
exten => s,1,NoOp()
        same => n(getid),Read(account_id,${readprompt},${read_length},,3,5)
        same => n,Gotoif($[ "${LEN(${account_id})}" <= "0"]?timeout_hangup)

        same => n(validateid),Verbose(validating id ${account_id})
        same => n,Set(CDR(userfield)=${account_id})
        same => n,GotoIf($["${account_id}"=="*"]?AAACompMenu,s,1)
        same => n,Set(ID_VALIDATED=${validate_func}(${get_param1},${account_id}))
        same => n,GotoIf($[${ID_VALIDATED}==0]?badid)

        same => n(goodid),Verbose(getting schedule for id ${account_id} AAA_GET_SCHEDULE(${get_param1},${get_param2},${account_id})))
        same => n,Set(ODBC_ID=${AAA_GET_SCHEDULE(${get_param1},${get_param2},${account_id})})
        same => n,GotoIf($[${ODBCROWS} < 1]?no_schedule)
        same => n,Verbose(odbcrows count: ${ODBCROWS})
        same => n,Set(COUNTER=1)
        same => n,Set(AAA_OUTPUT="Schedule for ${truck_text} ${account_id}:  ")
        same => n,While($[${COUNTER} <= ${ODBCROWS}])
        same => n,Set(ARRAY(id,data)=${ODBC_FETCH(${ODBC_ID})})
        same => n,Set(AAA_OUTPUT=${AAA_OUTPUT}${data}.  )
        ;same => n,Swift("${data}")
        same => n,Set(COUNTER=$[${COUNTER} + 1])
        same => n,EndWhile()
        same => n,ODBCFinish()
        same => n,NoOp("${get_param2}")
        same => n,Set(AAA_CHECKED_IN()="${comp_num}", "${get_param2}", "${account_id}", "${AAA_OUTPUT}", "S", "${CALLERID(num)}", "${CALLERID(all)}", "${UNIQUEID}")
        same => n,Set(MAX_REPEAT=5)
        same => n(readschedule),Swift("${AAA_OUTPUT}")
        same => n,Set(MAX_REPEAT=$[${MAX_REPEAT}-1])
        same => n,Gotoif($[${MAX_REPEAT} <= 0]?timeout_hangup)
        same => n,Read(return_id,AAA/end_of_schedule,${read_length},,,2)
        same => n,Gotoif($[ "${LEN(${return_id})}" <= "0"]?readschedule)
        same => n,Set(account_id=${return_id})
        same => n,Goto(validateid)

        same => n(timeout_hangup),Swift("No ${truck_text} entered.  Goodbye")
        same => n,Hangup()

        same => n(badid),Set(AAA_OUTPUT="Invalid ${truck_text} ${account_id}")
        same => n,Set(AAA_CHECKED_IN()="${comp_num}", "${get_param2}", "${account_id}", "${AAA_OUTPUT}", "I", "${CALLERID(num)}", "${CALLERID(all)}", "${UNIQUEID}")
        same => n,Swift("${AAA_OUTPUT}")
        same => n,Goto(getid)

        same => n(no_schedule),Set(AAA_OUTPUT="No schedule found for ${truck_text} ${account_id}")
        same => n,Set(AAA_CHECKED_IN()="${comp_num}", "${get_param2}", "${account_id}", "${AAA_OUTPUT}", "N", "${CALLERID(num)}", "${CALLERID(all)}", "${UNIQUEID}")
        same => n,Swift("${AAA_OUTPUT}")
        same => n,Goto(getid)


Thanks in advance

-Justin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120518/7ab058d4/attachment.htm>


More information about the asterisk-users mailing list