Hangup extension in macro how do?

Hi all

in one extension after Dial() i use hangup extension (h) for convert wave monitor to mp3 :

exten => _3xx,n,MixMonitor(${FILENAME}.wav) exten => _3xx,n,Dial(${OUTBOUNDTRANK}/125) exten => _3xx,n,Hangup() exten => h,n ,StopMixMonitor exten => h,n ,System(cd ${DEFPATH}) exten => h,n ,System(lame -b 96 -t -F -m m --bitwidth 16 --quiet ${FILENAME}.wav ${FILENAME}.mp3) exten => h,n ,System(rm -f ${FILENAME}.wav)

now i try move this code to one macro …BUT
have any way for use hangup extensions in macro ?

if no … have any other way to move upcode to one macro

What does Asterisk say, if you use Hangup() in macro?
This works perfectly for me!

note hangup application (exten => _3xx,n,Hangup() ) is not my problem :

i need anyway to use (exten => h,…) in macro because i must do some action after call finish (hangup occurs)

If I were you I would do the dial with the parameter ‘g’ (When the called party hangs up, exit to execute more commands in the current context. ) And so you would be able to execute more commands.

But seems not work when Calling (non called) first hangup !

But seems not work when Calling (non called) first hangup !

put the opction h in the context where you call to the Macro, and test if it is executed.

then can not use hangup code in macro and MUST put in context ?

nabble.com/h-extension-and-A … 46462.html

mail-archive.com/asterisk-de … 36923.html

[quote=“henkoegema”]http://www.nabble.com/h-extension-and-Asterisk-1.6.0.9-and-email-notifications--td23146462.html

mail-archive.com/asterisk-de … 36923.html[/quote]

i read this

but in end have any way to do it ?

[quote=“maziar”][quote=“henkoegema”]http://www.nabble.com/h-extension-and-Asterisk-1.6.0.9-and-email-notifications--td23146462.html

mail-archive.com/asterisk-de … 36923.html[/quote]

i read this

but in end have any way to do it ?[/quote]

If you use GOSUB in stead of MACRO the h extension will work.

[quote=“henkoegema”][quote=“maziar”][quote=“henkoegema”]http://www.nabble.com/h-extension-and-Asterisk-1.6.0.9-and-email-notifications--td23146462.html

mail-archive.com/asterisk-de … 36923.html[/quote]

i read this

but in end have any way to do it ?[/quote]

If you use GOSUB in stead of MACRO the h extension will work.[/quote]

can give me one sample ?

[quote=“maziar”]
can give me one sample ?[/quote]

This will NOT work:
exten => X.,1, Macro(test)

[macro-test]

exten => h,1,…

This WILL work:
exten => X.,1, GOSUB(test)

[test]

exten => h,1,…

THX NICE

but how pass parameter to sub ?

[quote=“maziar”]THX NICE

but how pass parameter to sub ?[/quote]

exten => X.,n,Gosub(test,s,1(par1,par2,par3))

Ok now work

new problem : when try use transfer from CALLING work ok BUT when
CALLER try transfer after press# listen transfer BUT after press
first number for transfer :

-- Called 102 -- SIP/102-b7b05af0 is ringing -- SIP/102-b7b05af0 answered SIP/101-092cbe08 -- Started music on hold, class 'default', on SIP/102-b7b05af0 -- <SIP/101-092cbe08> Playing 'pbx-transfer.gsm' (language 'en') -- Unable to find extension '1' in context 'recchannel' -- <SIP/101-092cbe08> Playing 'pbx-invalid.gsm' (language 'en') -- Stopped music on hold on SIP/102-b7b05af0 -- Executing [h@recchannel:1] StopMixMonitor("SIP/101-092cbe08", "") in new stack

[code][recchannel]
exten => s,1,NoOp(Start stdexten W RECORD)
exten => s,n,Set(ext=${ARG1})
exten => s,n,Set(dev=${ARG2})
exten => s,n,Set(cid=${ARG3})
;exten => s,n,Set(ctx=${ARG4})
exten => s,n,NoOp(parameter ext=${ext} dev=${dev} cid=${cid})
exten => s,n,set(FILENAME=${REC_PATH}${dev}-${cid}-${ext}-${STRFTIME(${EPOCH},%Y%m%d-%H%M%S)})
exten => s,n,NoOp(filename : ${FILENAME})
exten => s,n,Set(mbx="${ext}"$["${ctx}" ? “@${ctx}” :: “”])
exten => s,n,MixMonitor(${FILENAME}.wav)
exten => s,n,Dial(${dev}/${ext},20,tTwWkK) ; Ring the interface, 20 seconds maximum
exten => s,n,Hangup()
exten => s,n,Return
exten => h,1 ,StopMixMonitor
exten => h,n ,System(cd ${REC_PATH})
exten => h,n ,System(lame -v -V 9 --lowpass 9 --quiet ${FILENAME}.wav ${FILENAME}.mp3)
exten => h,n ,System(rm -f ${FILENAME}.wav)
(NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
exten => h,n,Return

[Dialinternal]
exten => _1xx,1,NoOp()
exten => _1xx,n,GOSUB(recchannel,s,1(${EXTEN},SIP,${CALLERID(num)}))
;exten => _1xx,n,Dial(SIP/${EXTEN},20,tTwWkK) ; Ring the interface, 20 seconds maximum
exten => _1xx,n,Hangup()
[/code]

but new problem