K
K
Kirill Vasiliev2015-03-27 12:14:50
Asterisk
Kirill Vasiliev, 2015-03-27 12:14:50

How to simplify this dialplan?

Good afternoon comrades!!!
Give me an idea how to simplify the code, since I now have a little less than a hundred such rules, and I need to enter the code to a minimum:
AEL CODE

context reklama-global {
  200 =>{
    ifTime(*|*|*|jan-may){&rklm-00001();};
    goto ext-queues,200999,1; 
  };
};
macro rklm-00001(){
  Playback(reklama/00001);
  return;
};

AEL supports labels (label, something like this)
context reklama-global {
  200 =>{
    ifTime(*|*|*|jan-may){&rklm-00001();};
    label-end:
      goto ext-queues,200999,1; 
  };
};

The essence of the question, I need to execute the macro, and after completion, jump to the label.
Extension => about a hundred pieces, I don’t want to write a separate macro for each.
When asked why this is necessary, I will answer:
In the future, it will look like this
context reklama-global {
  200 =>{
    ifTime(*|*|*|jan-may){&rklm-00001();};
ifTime(*|2|*|jan-may){&rklm-00002();};
ifTime(*|1|*|jan-may){&rklm-00003();};
ifTime(*|*|*|jan-may){&rklm-00004();};
ifTime(*|*|*|jan-may){&rklm-00005();};
ifTime(*|3|*|jan-may){&rklm-00006();};
ifTime(*|4|*|jan-may){&rklm-00007();};
ifTime(*|*|*|jan-may){&rklm-00008();};
label-end:
    goto ext-queues,200999,1; 
  };
};

And I will need to execute the macro once, and then transfer the person to the queue.
And I really don’t want to fence the if else construction (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2015-03-27
@vasilevkirill

macros are outdated
try GoSub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question