Macro within Hangup Function

General discussions about Asterisk.

Moderators: Moderator, Support

Macro within Hangup Function

Postby tgwaste » Mon Jan 11, 2016 8:36 pm

Hello,

Upon Answer I have:

same => n,Set(CHANNEL(hangup_handler_push)=disconnect,s,1(args))

Then upon Hangup I have:

[disconnect]
exten => s,1,NoOp()
same => n,MacroExclusive(reset-common,${port})
same => n,Return()


The 'reset-common' macro never gets called. I tried using just Macro as well. Anything else I put within that extension gets called fine. Is this just not allowed? Any alternatives? Im trying to stay away from having the same blocks of code everywhere.

P.S. I am using MacroExclusive because I understand that it prevents channels from tripping over themselves. Please correct me if I'm wrong.

Many Thanks!
-tgwaste
tgwaste
Newsterisk
 
Posts: 26
Joined: Sat May 12, 2012 1:32 am

Re: Macro within Hangup Function

Postby ambiorixg12 » Mon Jan 11, 2016 11:48 pm

Would be helpful, see your cli output ,when asterisk execute your dial plan. Related to

MacroExclusive() It executes a previously defined macro but allows only a single instance of the macro to execute at any given point in time. If the same macro is called at the same time from elsewhere in the dialplan, this second instance must wait until the first instance has completed.
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Macro within Hangup Function

Postby tgwaste » Mon Jan 11, 2016 11:52 pm

ambiorixg12 wrote:Would be helpful, see your cli output ,when asterisk execute your dial plan. Related to

MacroExclusive() It executes a previously defined macro but allows only a single instance of the macro to execute at any given point in time. If the same macro is called at the same time from elsewhere in the dialplan, this second instance must wait until the first instance has completed.



Right so basically its a locking mechanism. I would show you some CLI output but there is none when it hits that function. The skies are clear. Unless I need to set some debug mode.
-tgwaste
tgwaste
Newsterisk
 
Posts: 26
Joined: Sat May 12, 2012 1:32 am

Re: Macro within Hangup Function

Postby ambiorixg12 » Tue Jan 12, 2016 12:09 am

Note : hangup handlers, like the h extension, need to execute quickly because they are in the hangup sequence path of the call leg. Specific channel driver protocols like ISDN and SIP may not be able to handle excessive delays completing the hangup sequence.
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Macro within Hangup Function

Postby tgwaste » Tue Jan 12, 2016 12:13 am

I wouldn't call setting one global variable an excessive delay
-tgwaste
tgwaste
Newsterisk
 
Posts: 26
Joined: Sat May 12, 2012 1:32 am

Re: Macro within Hangup Function

Postby ambiorixg12 » Tue Jan 12, 2016 12:30 am

I don't know exactly what your full dial plan is, but a Macro's that you call with macroExclusive should run quickly or you will clog up your Asterisk system.

http://www.voip-info.org/wiki/view/Aste ... oExclusive

Anyway I don't use macro too often I rather prefer gosub()
ambiorixg12
Astmaster
 
Posts: 967
Joined: Sun Mar 04, 2007 9:32 pm
Location: Dominican Republic

Re: Macro within Hangup Function

Postby tgwaste » Tue Jan 12, 2016 12:57 am

I was looking at gosub but I'm not sure how to continue my app where it left off after the gosub.
-tgwaste
tgwaste
Newsterisk
 
Posts: 26
Joined: Sat May 12, 2012 1:32 am

Re: Macro within Hangup Function

Postby tgwaste » Tue Jan 12, 2016 12:22 pm

Figured out the solution using Gosub.

Thanks!
-tgwaste
tgwaste
Newsterisk
 
Posts: 26
Joined: Sat May 12, 2012 1:32 am


Return to Asterisk General

Who is online

Users browsing this forum: Google [Bot] and 4 guests