Converting Macro to Gosub
Macros are deprecated in Asterisk and will be removed completely in Asterisk version 21. It is therefore necessary to prepare the migration of all Macros to Gosub().
To do this smoothly, the following is proposed:
Keep the part of code with the macro and copy the content into the subcontext.
Keep the original macro context name, but replace 'macro' with 'sub'. In the following example we are converting macro-get-vmcontext to sub-get-vmcontext.
Edit the now deprecated macro context to include a priority (1) gosub to show the deprecated alert in the asterisk full log.
The alert called is :
After that, it's easy to know what we need to change in the dial plan to migrate marco to gosub like this:
Above we can see that the from-pms context includes a call to *98 in line 13 cailling a macro that needs to be migrated to Gosub()
Side PHP code:
You must use ext_gosub() like this:
So: ext_gosub( Prioroty, Ext, Context, Args ) ;
In our example about get-vmcontext, it will be changed to sub-get-vmcontext with a pritority 1 and the extension s :
List of modules that need to be converted:
Module Name | Open Source | Issue Link | Status(Open, Completed) | Fixed Version 15 | Fixed Version 16 |
---|---|---|---|---|---|
accountcodepreserve |
|
|
|
|
|
areminder |
|
|
|
|
|
blacklist |
|
|
|
|
|
callerid |
|
|
|
|
|
callforward |
|
|
|
|
|
calllimit |
|
|
|
|
|
callrecording |
|
|
|
|
|
callwaiting |
|
|
|
|
|
campon |
|
|
|
|
|
conferences |
|
|
|
|
|
contactmanager |
|
|
|
|
|
core |
| FREEPBX-19656 - Change user Macro hooks to Gosub RESOLVED | In Progress |
|
|
cos |
|
|
|
|
|
dashboard |
|
|
|
|
|
daynight |
|
|
|
|
|
dictate |
|
|
|
|
|
directory |
|
|
|
|
|
donotdisturb |
|
|
|
|
|
endpoint |
|
|
|
|
|
extensionroutes |
|
|
|
|
|
fax |
|
|
|
|
|
findmefollow |
|
|
|
|
|
framework |
|
|
|
|
|
hotelwakeup |
|
|
|
|
|
infoservices |
|
|
|
|
|
ivr |
|
|
|
|
|
languages |
|
|
|
|
|
miscapps |
|
|
|
|
|
outroutemsg |
|
|
|
|
|
paging |
|
|
|
|
|
pagingpro |
|
|
|
|
|
parking |
|
|
|
|
|
parkpro |
|
|
|
|
|
pbdirectory |
|
|
|
|
|
pinsets |
|
|
|
|
|
queues |
|
|
|
|
|
recordings |
|
|
|
|
|
ringgroups |
|
|
|
|
|
sangomacrm |
|
|
|
|
|
speeddial |
|
|
|
|
|
timeconditions |
|
|
|
|
|
vmblast |
|
|
|
|
|
vmnotify |
|
|
|
|
|
voicemail |
|
|
|
|
|
vqplus |
|
|
|
|
|
webcallback |
|
|
|
|
|
xmpp |
|
|
|
|
|
zulu |
|
|
|
|
|