Claim your Biolink Click Here
0 like 0 dislike
1.2k views
in Education & Reference by | 1.2k views

1 Answer

0 like 0 dislike
Best answer

The purpose of this application is to save your time and the writing of one and the same extensions. For example, if you have a big and complicated dialplan with 100 lines and you have to add additional extensions for each line, it is easier to make one macro with these extensions. Then with just one new line you will call these extensions, wherever you want in your dialplan.

Below, we will give you an example.

Executes a macro using the context ‘macro-<macroname>’, jumping to the ‘s’ extension of that context and executing each step, then returning when the steps end or a call to MacroExit is encounted.

The calling extension, context, and priority are stored in ${MACRO_EXTEN}, ${MACRO_CONTEXT} and ${MACRO_PRIORITY} respectively. Arguments become ${ARG1}, ${ARG2}, etc in the macro context.

[CONTEXT]

exten => 12345,1,Answer()
exten => 12345,n,voicemail(4080@friends-number)

exten => 77777,1,Macro(direct-dial1,292991)
exten => 77777,n,Hangup()

exten => 55555,1,Macro(direct-dial2,292991)
exten => 55555,n,Hangup()

[macro-direct-dial1]
exten => s,1,Set(CDR(accountcode)=R1-${MACRO_EXTEN})
exten => s,n,Set(DIRNAME=${MACRO_EXTEN}/${STRFTIME(${EPOCH},,%Y/%m/%d)})
exten => s,n,Set(FILENAME=/var/www/html/R1temp-Recording/${UNIQUEID}-${STRFTIME(${EPOCH},,%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(FILENAME2=/var/www/html/FOLDER/IN/${DIRNAME}/${UNIQUEID}-${STRFTIME(${EPOCH},,%H%M%S)}-${CALLERID(num)})
exten => s,n,System(/bin/mkdir -p /var/www/html/FOLDER/IN/${DIRNAME})
exten => s,n,Set(FILE=${FILENAME2}.mp3)
exten => s,n,AGI(read.php,${FILE},${UNIQUEID},${TIME})
exten => s,n,Monitor(wav,${FILENAME},b)
;try for 20 sec this number including prefix(which is Argument)
exten => s,n,Dial(${SERVER-IP}/${ARG1}1234567890,20)
;try for 60 sec another number including prefix(which is Argument {ARG1} and we defined {server-IP} ij global alternatively you can do this way Dial/SIP:)
exten => s,n,Dial(${SERVER-IP}/${ARG1}9876543210,60)

[macro-direct-dial2]
exten => s,1,Set(CDR(accountcode)=R1-${MACRO_EXTEN})
exten => s,n,Set(DIRNAME=${MACRO_EXTEN}/${STRFTIME(${EPOCH},,%Y/%m/%d)})
exten => s,n,Set(FILENAME=/var/www/html/R1temp-Recording/${UNIQUEID}-${STRFTIME(${EPOCH},,%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(FILENAME2=/var/www/html/FOLDER/IN/${DIRNAME}/${UNIQUEID}-${STRFTIME(${EPOCH},,%H%M%S)}-${CALLERID(num)})
exten => s,n,System(/bin/mkdir -p /var/www/html/FOLDER/IN/${DIRNAME})
exten => s,n,Set(FILE=${FILENAME2}.mp3)
exten => s,n,AGI(read.php,${FILE},${UNIQUEID},${TIME})
exten => s,n,Monitor(wav,${FILENAME},b)
;try for 20 sec this number including prefix(which is Argument)
exten => s,n,Dial(${SERVER-IP}/${ARG1}5874578454,20)
;try for 60 sec this number including prefix(which is Argument)
exten => s,n,Dial(${SERVER-IP}/${ARG1}8754585959,60)
by

Related questions

1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
1 like 0 dislike
1 answer
2 like 0 dislike
1 answer
3 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer

Where your donation goes
Technology: We will utilize your donation for development, server maintenance and bandwidth management, etc for our site.

Employee and Projects: We have only 15 employees. They are involved in a wide sort of project works. Your valuable donation will definitely boost their work efficiency.

How can I earn points?
Awarded a Best Answer 10 points
Answer questions 10 points
Asking Question -20 points

1,312 questions
1,473 answers
569 comments
4,809 users