问题
I am working project which written in java & handle asterisk. By java program i select station numbers like max no 90 or 900 or 9000. For adding in asterisk i handle 3 files sip.conf queues.conf extensions.conf In extensions.conf i done following setting specifically for adding stations quick. extenpatternmatchnew=yes
By this i can enter 90 stations within 20-30sec in extensions.conf 900 stations within 8-9 min & 9000 withing 5 hours But i got info that we can include as many conf files as we want. #include another dialplan - asterisk but my question is If i want to add 9000 stations in extensions.conf file & by technique of #include Can i put temp1.conf, 0 to 1000 stations temp2.conf, 1001 to 2000 stations
tempN.conf, N to last-No stations If i can then what is format of temp.conf? By doing this can i reduce time to adding large number of stations in extensions.conf,sip.cof, queues.conf? Need help please!
回答1:
The #include statement doesn't affect performance, but the dial plan may be easier to maintain.
The format of include files
The #include statement replaces the Content of that File in the Dialplan. It has to be written like you would write the Dialplan. The #include statement works in all Asterisk configuration files. You could also overwrite Dialplan Sections, if you #include the File on the bottom.
Example
#include "headquarter_extensions_custom.conf"
[globals]
; ...
[default]
exten => s,1,Answer
exten => s,2,Playback(welcome-message)
; go to context defined in included file
exten => s,3,Goto(headquarter,s,1)
After editing the include file, you have to reload the Configuration, ie. reload
.
Alternatives
You could also include Contexts, with the include Statement in the Dialplan.
This allows to write standard Contexts and extend them with Contexts
defined in a Custom Configuration File (via #include).
include => NameOfContext
Example
Content of "extensions.conf"
#include "headquarter_extensions_custom.conf"
#include "localoffice_extensions_custom.conf"
[general]
[support]
include => localoffice
include => headquarter
Content of "headquarter_extensions_custom.conf":
[headquarter]
exten => 012345678,1,Dial(SIP/012345678)
Content of "localoffice_extensions_custom.conf":
[localoffice]
exten => 1234,1,Dial(SIP/2001)
Patterns
If you can replace hundreds of Extensions with Patterns, route Blocks of Numbers to Destinations, ie. _123XX
LocalOffice, _5[1-3]XX
HeadQuarterOffice.
Scalability
You could also split your Asterisk Configurations on more than one Servers. That means determining limits of your Hard- and Software and scale through DNS, SIP-Proxy or switch to a asterisk Realtime Implemetation.
来源:https://stackoverflow.com/questions/15498028/how-to-create-custom-conf-file-for-add-stations-in-extensions-conf-asterisk