[HELP] Dial L(x:y:z) option not working when xfering call

Hello All,

This is my first post to this forum. Thanks in advance for all your help.

Symptom description:

When transfering a call from a queue or a custom extension which dials out a trunk using Dial(…,L(x:y:z)) the timer does not work and the call is not terminated after x milliseconds.

When dialing the the number directly the timer works fine and the call is terminated as expected.

problem details:

When the call is dialed directly from an local extension (i.e. a SIP phone) the log files show that the call timer for the call correctly reflects the call time. The Dial L option works correctly and drops the call after x ms. However, When the call is transfered from an IVR or from an IVR->Queue or a custom extension (or when the custom extension is dialed directly) the log file shows that the call duration from the trunk call is only a few seconds. The call records for the call to the IVR show the actual call time. it seems that the L() opion works on the extension originated call which is only a few seconds long while the actual call is timed for the IVR/Queue connection. The result is that the the call does not get terminated correctly at the expiration time of x.

Here are the gory details…

Here is the dial string for the extension

[ext-local]
exten => 999,1,Macro(exten-vm,novm,999)
exten => 999,hint,Local/979898664412915@outrt-001-MSATAlaskaNet

[outrt-001-MSATAlaskaNet-custom]
exten => _97989.,1,Macro(pinsets,1|0)
exten => _97989.,2,SetVar(LIMIT_TIMEOUT_FILE=vm-goodbye)
exten => _97989.,3,SetVar(LIMIT_CONNECT_FILE=welcome)
exten => _97989.,n,Macro(dialout-trunk-msat,5,${EXTEN:5},)
exten => _97989.,n,Macro(dialout-trunk-msat,6,${EXTEN:5},)
exten => _97989.,n,Macro(outisbusy,)

[globals]
MSAT_TRUNK_OPTIONS = rD(8223*9998#)L(600000:550000:60000)

;
; a slightly modified version of diaout macro created by FreePBX.
;
[macro-dialout-trunk-msat]
exten => s,1,GotoIf($["${ARG3}" = “”]?3:2) ; arg3 is pattern password
exten => s,2,Authenticate(${ARG3})
exten => s,3,Macro(user-callerid)
exten => s,4,Macro(record-enable,${CALLERID(number)},OUT)
exten => s,5,Macro(outbound-callerid,${ARG1})
exten => s,6,Set(GROUP()=OUT_${ARG1})
exten => s,7,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1}} ]?108)
; if we’ve used up the max channels, continue at (n+101)
exten => s,8,Set(DIAL_NUMBER=${ARG2})
exten => s,9,Set(DIAL_TRUNK=${ARG1})
exten => s,10,AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
exten => s,11,Set(OUTNUM=${OUTPREFIX_${ARG1}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
exten => s,12,Set(custom=${CUT(OUT_${ARG1},:,1)}) ; Custom trunks are prefixed with “AMP:“
exten => s,13,GotoIf($[”${custom}” = “AMP”]?16)
exten => s,14,Dial(${OUT_${ARG1}}/${OUTNUM},120,${MSAT_TRUNK_OPTIONS}) ; Regular Trunk Dial
exten => s,15,Goto(s-${DIALSTATUS},1)

; This is a custom trunk. Substitute $OUTNUM$ with the actual number and rebuild the dialstring
; example trunks: “AMP:CAPI/XXXXXXXX:b$OUTNUM$,30,r”, “AMP:OH323/$OUTNUM$@XX.XX.XX.XX:XXXX"
exten => s,16,Set(pre_num=${CUT(OUT_${ARG1},$,1)})
exten => s,17,Set(the_num=${CUT(OUT_${ARG1},$,2)}) ; this is where we expect to find string OUTNUM
exten => s,18,Set(post_num=${CUT(OUT_${ARG1},$,3)})
exten => s,19,GotoIf($[”${the_num}" = “OUTNUM”]?20:21) ; if we didn’t find “OUTNUM”, then skip to Dial
exten => s,20,Set(the_num=${OUTNUM}) ; replace “OUTNUM” with the actual number to dial
exten => s,21,Dial(${pre_num:4}${the_num}${post_num},120,${MSAT_TRUNK_OPTIONS})
exten => s,22,Goto(s-${DIALSTATUS},1)

exten => s,108,Noop(max channels used up)

exten => s-BUSY,1,NoOp(Trunk is reporting BUSY)
exten => s-BUSY,2,Busy()
exten => s-BUSY,3,Wait(60)
exten => s-BUSY,4,NoOp()

exten => _s-.,1,NoOp(Dial failed due to ${DIALSTATUS})

So… when I pick up my phone and dial the 866 number directly (including the digits which select the outboud trunk) the call is timed correctly and call is processed correctly with the L options (listed above in MSAT_TRUNK_OPTIONS.

Here are the corresponding log entries for the direct dial

fixlocalprefix: Added prefix. New number: 18664412915
– AGI Script fixlocalprefix completed, returning 0
– Executing Set(“SIP/201-1ae3”, “OUTNUM=18664412915”) in new stack
– Executing Set(“SIP/201-1ae3”, “custom=IAX2/VoicePulse1”) in new stack
– Executing GotoIf(“SIP/201-1ae3”, “0?16”) in new stack
– Executing Dial(“SIP/201-1ae3”, "IAX2/VoicePulse1/18664412915|120|rD(82239998#)L(600000:550000:60000)") in new stack
– Limit Data for this call:
– - timelimit = 600000
– - play_warning = 550000
– - play_to_caller= yes
– - play_to_callee= no
– - warning_freq = 60000
– - start_sound = welcome
– - warning_sound = timeleft
– - end_sound = vm-goodbye
– Called VoicePulse1/18664412915
– Call accepted by 64.61.93.87 (format ulaw)
– Format for call is ulaw
– IAX2/VoicePulse1-7 is making progress passing it to SIP/201-1ae3
– IAX2/VoicePulse1-7 answered SIP/201-1ae3
– Sending DTMF '8223
9998#’ to the called party.
– Playing ‘welcome’ (language ‘en’)
– Playing ‘vm-youhave’ (language ‘en’)
– Playing ‘digits/9’ (language ‘en’)
– Playing ‘queue-minutes’ (language ‘en’)
– Playing ‘digits/10’ (language ‘en’)
– Playing ‘queue-seconds’ (language ‘en’)
– Hungup 'IAX2/VoicePulse1-7’
asterisk1*CLI>

Notice that the timeleft macro is executed and asterisk faithfully tells us the amount of time left on the call. The call will eventually be closed by asterisk when 10 minutes are up as expected.

Here are the call log showing that the time is correclty maintained by asterisk for the call. In this case 1 minute and 14 seconds.

  1.  2006-08-15 13:29:13  	SIP/201-1a...  	2066530241  	"STS" <2066530241>  	979898664412915  	ANSWERED  	01:14
    

Now… if we call the extension directly instead of dialing the number (i.e. dial 999 instead of the 866 number) I get the following.

Here are the corresponding log entries

– Executing Set(“Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2”, “OUTNUM=18664412915”) in new stack
– Executing Set(“Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2”, “custom=IAX2/VoicePulse1”) in new stack
– Executing GotoIf(“Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2”, “0?16”) in new stack
– Executing Dial(“Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2”, "IAX2/VoicePulse1/18664412915|120|rD(82239998#)L(600000:550000:60000)") in new stack
– Limit Data for this call:
– - timelimit = 600000
– - play_warning = 550000
– - play_to_caller= yes
– - play_to_callee= no
– - warning_freq = 60000
– - start_sound = welcome
– - warning_sound = timeleft
– - end_sound = vm-goodbye
– Called VoicePulse1/18664412915
– Call accepted by 64.61.93.87 (format ulaw)
– Format for call is ulaw
– IAX2/VoicePulse1-3 is making progress passing it to Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2
– IAX2/VoicePulse1-3 answered Local/979898664412915@outrt-001-MSATAlaskaNet-d82e,2
– Sending DTMF '8223
9998#’ to the called party.
– Playing ‘welcome’ (language ‘en’)

The welcome mesg is played but that is it. The call never hangs up and the timeleft macro is never executed. We are left with an open connection for ever.

Here is the corresponding call log. Notice that the call duration was logged for the extension and not the call to Local. The timer never expires because as far as the asterisk dial command goes the call only latested 18 seconds and not 2:31

  1.  2006-08-15 13:18:53  	Local/9798...  	2066530241  	"STS" <2066530241>  	979898664412915  	ANSWERED  	00:18
    
  2.  2006-08-15 13:18:52 	SIP/201-f9... 	201 	"Luis Soltero" <201> 	999 	ANSWERED 	02:31
    

So my question to the community is… Is it possible to design a call plan that will allow you to time calls that come in throgh an IVR, Queue, and/or Local extension?

I look forward to your comments.

Thanks,

–luis