[Asterisk-Users] Asterisk RealTime Question, Please help

Benchev bbench at mail.bg
Fri Mar 17 09:46:42 MST 2006


> >> I need many contexts because I have around 1000 DID's each with 5-10
> >> Extensions.
> >> These DID numbers are changed or added very frequently and whenever
> >> there is a change I have to change Extensions.conf manually. So please
> >> tell me how can I do this dynamically without changing Extensions.conf
> >> and help me configure Asterisk.
> >
> > I presume you have about 1000 DID numbers and each of this numbers
> > may ring to
> > 5-10 users of yours, right?
> >
> > If so, make a context in you extensions.conf and include in it a switch
> > like that:
> > [ever_changing_dids]
> > switch => Realtime/ever_changing_dids at extensions
> >
> > Now you can insert in your extensions_table imaginary DID 9876543210:
> >
> > INSERT INTO `extensions_table` VALUES ('', 'ever_changing_dids',
> > '9876543210',
> > 1, 'Dial', 'SIP/user1:SIP/user2:SIP/user3:SIP/user4:SIP/user8:SIP/user12|
> > 20');
> > You can do that for many thousands of DIDs without changing
> > extensions.conf.
> >
> My current setup is exactly similar to which you have suggested. My DID
> numbers
> are added or changed very frequently and all the time I have to change some
> config file manually and should reload Asterisk or atleast call Extensions
> reload. I do want these things to be manual, Can't I have the Asterisk to
> directly get the contexts from Mysql DB without giving them in config
> files? If
> this is possible then we can have a realtime dynamic Asterisk.
>
> The other approcah can be to match the context itself with some regular
> expression. But I do not know how do this or whether this is possible? I
> will have a context something like this
>
> [XXXXXXXXXX]
> switch => Realtime/@extensions
>
> So all contexts will be directed to Mysql DB matching regex but
> [XXXXXXXXXX] is
> not acting as regex as expected it just matches context XXXXXXXXXX.
I am afraid I'm loosing you.
However,  try to change in extconfig.conf
extentions => mysql,astcc,extensions_table
to:
exten_sions => mysql,astcc,extensions_table
and then switch => Realtime/@exten_sions
Then in extensions.conf:
[inbound]
switch => Realtime/@exten_sions
In mysql do:
INSERT INTO `extensions_table` VALUES ('', 'inbound',
 '9876543210', 1, 'Dial', 'SIP/user1|20');

*CLI> show dialplan inbound
should show: Alt. Switch =>  'Realtime/@exten_sions'
not what you have used to see with a static extensions.conf but you can do:
server*CLI> realtime load exten_sions context inbound
                   Column Name  Column Value
          --------------------  --------------------
                            id  1
                       context  inbound
                         exten  9876543210
                      priority  1
                           app  Dial
                       appdata  SIP/user1|20
and see how realtime took that.

On the other hand, no you can not create contexts on the fly and
out of nothing. Actually the context scheme is the backbone of your system
and should be thought over and set up beforehand.
The connection between particular context and realtime is the switch.
When you insert into  the extensions_table a set, which context corresponds
 to where the switchis, and this is read in realtime without the need of 
reloading.
Pretty much that's all I can do to help. Sorry.

Benchev



More information about the asterisk-users mailing list