H extension - which one is called?

Ok so I have a SIP station… that starts in context [GUEST]… the context is shown below…

[guests]
include = voicemail
include = emergency
include = operator
include = local_7_digit
include = toll_free
include = north_america_ld
include = international
include = wakeups
include = roomtoroom

exten => h,1,NoOp("Guest User Hung up")
exten => h,2,NoOp(${CDR(src)})
exten => h,3,NoOp(${CDR(billsec)})
exten => h,4,NoOp(${CDR(dst)})
exten => h,5,NoOp(${CDR(disposition)})
exten => h,6,NoOp(${CDR(start)})
exten => h,7,NoOp(${CDR(end)})

lets take for instance this user dials 9+555+1111. the include for local-7-digit calls will take over

it is shown below…

[local_7_digit]
exten =_9XXXXXXX,1,Macro(normal-dialout,${T1}/001614${EXTEN:1},,loc

if a match is made (which the above number will match) it calls the macro normal-dialout

the macro will try the main trunk… if its busy or unavailable it will try another… otherwise it will return congestion if all trunks are unavailable… if a trunk is grabbed the call will complete… once the call disconnects the h extension in the macro should be called…

what I find is that if the call comes back congestion or unavailable within the Macro the h extension in the macro is not called but instead the h extension in the original context is called… i thought once a macro was entered the macro needed its own h extension… otherwise if it is a call without a macro then the h extension of the originating context was called at disconnect… so im a little lost here trying to figure out what h extension to be called…

shouldnt the ‘Hangup’ command after the congestion or chanunavail trigger a call to the h extension within this macro?
below is part of the macro that deals with the dialout…

exten = s,n(allowed),set(CALLERID(num)=${GLOBAL_OUTBOUNDCID})
exten = s,n,Goto(1-dial,1)
exten = 1-dial,1,Dial(${ARG1})
exten = 1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1)
exten = 1-CHANUNAVAIL,1,Dial(${ARG2})
exten = 1-CHANUNAVAIL,n,Hangup()
exten = 1-CONGESTION,1,Dial(${ARG2})
exten = 1-CONGESTION,n,Hangup()
exten = 1-out,1,Hangup()
exten = h,1,NoOp("Trunk User Hung up")
exten = h,2,NoOp(${CDR(src)})
exten = h,3,NoOp(${CDR(billsec)})
exten = h,4,NoOp(${CDR(dst)})
exten = h,5,NoOp(${CDR(disposition)})
exten = h,6,NoOp(${CDR(start)})
exten = h,7,NoOp(${CDR(end)})
exten = h,8,AGI(smdr.php,${CDR(src)},${CDR(duration)},${CDR(billsec)},${CDR(dst

-Christopher

Hi

This has caught me out before.

[quote]If you Goto out of the Macro context, the Macro will terminate and control will return at the location refered to by the Goto. Otherwise if ${MACRO_OFFSET} is set at termination, Macro will attempt to continue at priority MACRO_OFFSET + N + 1 if such a step exists, and N + 1 otherwise.

‘h’ extension: If a macro executes a Dial() and the called party hangs up, then the control passes to the ‘h’ extension of the calling context.
However, the ‘h’ extension is still needed inside the Macro context in case of a command, application, or extension exiting non-zero - i.e. the user hangs up in the middle of a Record() - in this case the ‘h’ extension of the Macro context is used, not the ‘h’ extension of the calling context.)
Tilghman, May 2010: So Macro returns upon hangup to execute the “h” extension in the original calling context, though even that is conditional, based upon it having been broken for a long time.

It is worth noting that if you use the “include => contextname” directive to include another context, that the values of ${ARG1} etc. will also be available in that context. This could be used e.g. to set up a standard extension dialing macro with time of day based dependancies. [/quote]

Ian

great finds… but what is interesting is that ALL of my calls exit non-zero… does that mean there is something wrong with my programming of the system? I have a “Hangup” after every dial command thinking that would handle it…

but the way that quote eludes to is that I shouldnt have calls exiting non-zero unless it is an unexpected clearing of the call…

but take 2 SIP stations that call each other, a Dial command is used to make the call from the calling station to the receiving… the call completes… I have asterisk set to always stay in the middle… (canreinvite = no), when either party hangs up the call exits ‘non-zero’ at the Dial command…

if a Macro is used the h extension of the Macro is called per the quote above… if a Macro was not used, the h extension of the originating context is called…

maybe ALL calls on asterisk terminate as non-zero?

-Christopher