Philip Prindeville
2008-Mar-10 02:59 UTC
[asterisk-users] What replaces Macro() now? And how do you do the equivalent?
I've been working on getting the sample configuration of extensions.conf to be more usable, i.e. to make the examples be more flexible or cover more territory... I thought it might be handy to show people how to use more contexts for virtual hosting, for example. Problem is I was using the existing stdexten macro from 1.2. See: http://bugs.digium.com/view.php?id=11969 If Macro()/MacroExit() is deprecated, how does one go about achieving the same functionality with Gosub()/Return()? Not having named parameters is a bit of a hassle. I was thinking about setting up variables, and using a template, but that's clumsy also. So... if we're giving up Macro(), what functionality do we get instead? Thanks, -Philip
Anthony Messina
2008-Mar-12 14:21 UTC
[asterisk-users] What replaces Macro() now? And how do you do the equivalent?
On Sunday 09 March 2008 09:59:32 pm Philip Prindeville wrote:> http://bugs.digium.com/view.php?id=11969 > > If Macro()/MacroExit() is deprecated, how does one go about achieving > the same functionality with Gosub()/Return()?i agree--an excellent question. Since Macro is depreciated and I am using 1.4, planning on upgrading to 1.6, I started to mess around a bit with this. Currently, I use: [incoming] ; Calls from outside exten => 2202,1,Dial(${F1000G},30,kKotTwW) exten => 2202,n,Goto(vm-external,${EXTEN},1) [internal-extens] ; Calls from inside exten => 2202,1,Dial(${F1000G},30,kKotTwW) exten => 2202,n,Goto(vm-internal,${EXTEN},1) And the Goto directs you to this context: [vm](!) exten => _X.,1,Answer(500) exten => _X.,n,Exec(${IF($["${DIALSTATUS}" = "BUSY"]?VoiceMail(${EXTEN},b):VoiceMail(${EXTEN},u))}) exten => _X.,n,Playback(vm-goodbye) exten => _X.,n,Hangup() [vm-internal](vm) [vm-external](vm) I use two separate, but equal contexts so that in voicemail, i could distinguish between whether a call was "from-extension" or "from-phonenumber" I didn't need to use Gosub since I don't need a return. I'm sure there are plenty of ways that are simpler, etc. They have not yet arrived at my brain's doorstep. -- Anthony - http://messinet.com - http://messinet.com/~amessina/gallery 8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part. Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20080312/ef472750/attachment.pgp