Dialplan usage\syntax question

I was told, that this:
exten => 302117853547/9989XXXXXXX,1,Dial(SIP/trunk/num)

is better than
exten => 302117853547,1,Execif($["${CALLERID(num)}" = "9989XXXXXXX"]?Dial(SIP/trunk/num))

Even agi and ari is better than it.


Is execif much slower that first solution? or what?

The same reasons as it is better to do:

exten => 302117853547,…

rather than

exten => _.,1,Execif($[${EXTEN} = …

including, that it is easier to read and that the pattern can be preprocessed, whereas the parameters for the application have to be parsed every time.

But if I will have to use multiple CALLERID(num)?

at first case it will be
exten => 302117853547/9989111111,1,Dial(SIP/trunk/num)
exten => 302117853547/998922222,1,Dial(SIP/trunk/num)

and in second case:
exten => 302117853547,1,Execif($[$["${CALLERID(num)}" = “9989111111”] | $["${CALLERID(num)}" = “9989222222”]]?Dial(SIP/trunk/num))

And what if first case hase more comples logic inside?
So I would have to create multiple extensions every time?