Extenxions Optimization

Home » Asterisk Users » Extenxions Optimization
Asterisk Users 1 Comment

Hi

We want optimize my extensions file conf on asterisk 11.4.0 :

We have a big quantity of extensions, all are same “design”:

; Destination: Gambia Type: Fixe
exten => _00220X.,1,Set(CDR(CodeCom)=BUS-GMB)
exten => _00220X.,2,AGI(Caller-ID.agi,${IAXVAR(ACCOUNTID)})
exten => _00220X.,3,Set(CALLERID(all)=${NUMID})
exten => _00220X.,4,Set(CALLERPRES()=${CALLPRES})
exten => _00220X.,5,Dial(SIP/Trunk-Telco/${EXTEN:2},180,rt)
exten => _00220X.,6,Hangup

; Destination: Libya Type: Fixe
exten => _00218X.,1,Set(CDR(CodeCom)=BUS-LBY)
exten => _00218X.,2,AGI(Caller-ID.agi,${IAXVAR(ACCOUNTID)})
exten => _00218X.,3,Set(CALLERID(all)=${NUMID})
exten => _00218X.,4,Set(CALLERPRES()=${CALLPRES})
exten => _00218X.,5,Dial(SIP/Trunk-Telco/${EXTEN:2},180,rt)
exten => _00218X.,6,Hangup

; Destination: Tunisia Type: Fixe
exten => _00216X.,1,Set(CDR(CodeCom)=BUS-TUN)
exten => _00216X.,2,AGI(Caller-ID.agi,${IAXVAR(ACCOUNTID)})
exten => _00216X.,3,Set(CALLERID(all)=${NUMID})
exten => _00216X.,4,Set(CALLERPRES()=${CALLPRES})
exten => _00216X.,5,Dial(SIP/Trunk-Telco/${EXTEN:2},180,rt)
exten => _00216X.,6,Hangup

; Destination: Algeria Type: Fixe
exten => _00213X.,1,Set(CDR(CodeCom)=BUS-DZA)
exten => _00213X.,2,AGI(Caller-ID.agi,${IAXVAR(ACCOUNTID)})
exten => _00213X.,3,Set(CALLERID(all)=${NUMID})
exten => _00213X.,4,Set(CALLERPRES()=${CALLPRES})
exten => _00213X.,5,Dial(SIP/Trunk-Telco/${EXTEN:2},180,rt)
exten => _00213X.,6,Hangup

My .conf file is ~80000 line

He have a solution for reduc this ? because a lot of line if “same”

I think’s use a AGI style:

; Destination: Libya Type: Fixe
exten => _00218X.,1,AGI(Extensions.agi,${IAXVAR(ACCOUNTID)})
; Destination: Tunisia Type: Fixe
exten => _00216X.,1,AGI(Extensions.agi,${IAXVAR(ACCOUNTID)})
; Destination: Algeria Type: Fixe
exten => _00213X.,1,AGI(Extensions.agi,${IAXVAR(ACCOUNTID)})

and into my Extensions.agi, i sent the other line. Do you think’s that it’s a good idea ?

Best regards Olivier

One thought on - Extenxions Optimization

  • [5 lines]

    [the same 5 lines]

    AGI is perfect for this. Create a list of destinations and relate your variables to it. Your free to use your favorite database and your favorite script/language to replace those 80000 with 1.

    There is a drawback ofcourse, there is atleast one more program to fail at calling time.

    You may be in a position where you can do the magic later based on cdrs, that way there is only asterisk to fail during the call.