I have a system running Asterisk 11.2.1 that has had a couple calls between 
internal extensions get "stuck open".  I didn't catch the verbose log for the 
first one, since I generally don't verbosely log to file, but the second one 
shows that the call that got stuck was dialed, but the caller hung up before 
the called device answered.

This server is running a hotdesking environment, so I am running a GoSub on 
call completion (and on termination via the h extension) to handle custom 
device states, in order to provide BLF for the user extensions without having 
to dynamically update which device the hints are pointing to.  If the timing of 
the log entries are correct, Asterisk had already determined which device to 
ring, and dialed that device (firing off the "on call creation" GoSub to set 
the BLF of the called extension to RINGING), but then the calling user hung up 
before the GoSub returned.

Is this something with my dialplan logic?  Is this some race condition issue 
that I've stumbled across?  What can I do to fix/mitigate the issue?  Pertinent 
dialplan of my internal call handling is below:

[hotdesk-outbound] ; call from logged in phones comes here first to set 
CallerID and check permissions of logged in user
exten => _X.,1,NoOp()
same => n,Set(LOCATION=${CUT(CHANNEL,/,2)})
same => n,Set(LOCATION=${CUT(LOCATION,-,1)})
same => n,Set(WHO=${HOTDESK_PHONE_STATUS(${LOCATION})})
same => n,GotoIf($[${ISNULL(${WHO})}]?internal,${EXTEN},1)
same => n,Set(${WHO}_CID_NAME=${HOTDESK_INFO(cid_name,${WHO})})
same => n,Set(${WHO}_CID_NUMBER=${HOTDESK_INFO(cid_number,${WHO})})
same => n,Set(${WHO}_OUTBOUND_PERMISSION=${HOTDESK_INFO(permissions,${WHO})})
same => n,Gosub(blf-begincall,s,1(${WHO},INUSE))
same => n,Set(CALLERID(name)=${${WHO}_CID_NAME})
same => n,Set(CALLERID(num)=${${WHO}_CID_NUMBER})
same => n,Goto(users,${EXTEN},1)

[users]
include => internal

[internal]
exten => _1XX,1,Verbose(5,Internal user - ${EXTEN})
same => n,Set(E=${EXTEN})
same => n,Set(USER_LOCATION=${HOTDESK_USER_STATUS(${E})})
same => n,GotoIf($[${ODBCROWS} < 1]?notloggedin)
same => 
n,Dial(SIP/${USER_LOCATION},20,wWU(blf-begincall^${E}^INUSE)b(blf-begincall^s^1(${E}^RINGING)))
same => n,Voicemail(${E}@rsnwo,b)
same => n,Hangup()
same => n(notloggedin),Set(LOGGED_OFF=1)
same => n,Voicemail(${E}@rsnwo,u)
same => n,Hangup()

[blf-begincall]
exten => s,1,Verbose("Beginning of Call - set BLF Custom Device state")
same => n,Verbose(Updating: ${ARG1} Calls: ${GROUP_COUNT(${ARG1}@activecalls)} 
Status: ${ARG2})
same => n,ExecIf($[${ARG2} = 
RINGING]?ExecIf($[${GROUP_COUNT(${ARG1}@activecalls)} > 
0]?Set(DEVICE_STATE(Custom:${ARG1})=RINGINUSE):Set(DEVICE_STATE(Custom:${ARG1})=RINGING)):Set(DEVICE_STATE(Custom:${ARG1})=INUSE))
same => n,Set(GROUP(activecalls)=${ARG1})
same => n,Set(CHANNEL(hangup_handler_wipe)=blf-endcall,s,1(${ARG1}))
same => n,Return()

[blf-endcall]
exten => s,1,Verbose("End of Call - reset BLF Custom Device state")
same => n,Verbose(Updating: ${ARG1} Calls: ${GROUP_COUNT(${ARG1}@activecalls)})
same => n,ExecIf($[${GROUP_COUNT(${ARG1}@activecalls)} > 
1]?Set(DEVICE_STATE(Custom:${ARG1})=INUSE):Set(DEVICE_STATE(Custom:${ARG1})=NOT_INUSE))
same => n,Return()

Thank you,

Noah Engelberth
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to