[asterisk-users] how to add-edit-delete entery into asterisk conf files

virendra bhati virbhati at gmail.com
Mon Sep 5 03:39:39 CDT 2011


Hi Sammy,

Yes I am asking about AstDB only.

On Mon, Sep 5, 2011 at 2:00 PM, Sam Govind <govoiper at gmail.com> wrote:

> Are you talking about AstDB or MySQL as DB backend for asterisk?
>
>
> On Mon, Sep 5, 2011 at 1:23 PM, virendra bhati <virbhati at gmail.com> wrote:
>
>> Hi Sammy,
>>
>> Thanks for share your experance and provide a new way of Asterisk
>> communication with DB.
>>
>> Actually I am using this feature only for MOH feature of asterisk right
>> now. But I will used it to all the configuration files too as per the needs.
>>
>>
>> I am not too much aware abut the Asterisk DB handling that's why I used
>> ODBC and mysql connection with asterisk.
>>
>> One more thing please tell me how to take backup of Asterisk DB ? It is my
>> 1st and last things which hurt me.
>>
>>
>>
>> On Mon, Sep 5, 2011 at 12:48 PM, Sam Govind <govoiper at gmail.com> wrote:
>>
>>> 1- Per my experience I've used DB with configuration files and I was
>>> amazed that Asterisk was taking a union of DB + conf file configurations and
>>> accepting both.So if you just make a simple script or DB function to do file
>>> operation on some event/cronjob you'll be saved.
>>>
>>> Moreover, if that still may induce duplication into configurations then
>>> DB replication and redundancy is the best way to cater your failure case.
>>> There are hundreds of how-tos on DB redundancy and failure etc.
>>>
>>> 2- If you've to move forward with this approach I'll suggest you to read
>>> only part of configuration file corresponding to one user i.e [user-1-area]
>>> and over-write that part only. If a new user then just append. This way file
>>> data loss will be minimized(may even avoided totally).
>>>
>>> Those were all my suggestions, if anyone else can add valuable comments
>>> to this.
>>>
>>> -
>>> sammy
>>>
>>>
>>> On Mon, Sep 5, 2011 at 11:45 AM, virendra bhati <virbhati at gmail.com>wrote:
>>>
>>>> Hi Sammy,
>>>>
>>>> Ans of 1st question:-
>>>>
>>>> As per my experiance Asterisk realtime(DB) based data will lost when
>>>> your server is creash and you may not take backup of your server's DB.
>>>> If any one know  then plese guide me so that I will start working on it.
>>>>
>>>> Ans of 2nd question:-
>>>>
>>>> Your question is correct if more then one user will access these
>>>> configuration files then might be some problem will come.
>>>>
>>>> For this issue I am just make a connection with server then close it
>>>> after finishing the job. So problem will be avoided ....
>>>>
>>>>
>>>>
>>>> On Mon, Sep 5, 2011 at 10:47 AM, Sam Govind <govoiper at gmail.com> wrote:
>>>>
>>>>> Though this might have been resolved/accomplished already but I've
>>>>> couple of questions for Virendra Bhati.
>>>>>
>>>>> 1- If you are doing this to make new accounts for new users, why
>>>>> couldn't you use Asterisk realtime(DB) based configurations of
>>>>> Voicemail/MoH/SIP/dialplan etc wouldn't it be much easier than doing lots
>>>>> and lots of filing !?
>>>>>
>>>>> 2- Since its a web-based Filing operations and if multiple users are to
>>>>> use the same page for appending/overwriting their configurations wouldn't it
>>>>> lead to information being lost when multiple users applying their changes ?
>>>>> I wonder how do you handle that ?
>>>>>
>>>>> I'm sure I'd more questions when I started writing this response mail
>>>>> but now I've forgotten those :P
>>>>>
>>>>> Thanks,
>>>>> Sammy.
>>>>>
>>>>> On Sun, Sep 4, 2011 at 6:00 PM, Tzafrir Cohen <
>>>>> tzafrir.cohen at xorcom.com> wrote:
>>>>>
>>>>>> On Fri, Sep 02, 2011 at 04:58:52PM +0530, virendra bhati wrote:
>>>>>> > Hi list,
>>>>>> >
>>>>>> > I want ot do basic work (add-edit-delete) into asterisk
>>>>>> configuration files,
>>>>>> > like sip.conf, manager.conf,musiconhold.conf etc.
>>>>>> >
>>>>>> > Please guide me how to configure all these files from from AMI
>>>>>> connection. I
>>>>>> > am able to login into AMI from Login action but I want to do more
>>>>>> task in to
>>>>>> > it.
>>>>>> >
>>>>>> > *AMI login:- *
>>>>>> >
>>>>>> > *login.php*
>>>>>> >
>>>>>> > <?php
>>>>>> > $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 30);
>>>>>> > fputs($socket, "Action: Login\r\n");
>>>>>> > fputs($socket, "UserName: root\r\n");
>>>>>> > fputs($socket, "Secret: energy\r\n\r\n");
>>>>>> > ?>
>>>>>> > *AMI command:-*
>>>>>> >
>>>>>> > Below commands are for musiconhold.conf. I want to add new MOH
>>>>>> context into
>>>>>> > it.
>>>>>> > <?php
>>>>>> > include("login.php");
>>>>>> >   fputs($socket, "Action: UpdateConfig\r\n");
>>>>>> >   fputs($socket, "Filename: musiconhold.conf\r\n");
>>>>>> >   fputs($socket, "Srcfilename: musiconhold.conf\r\n");
>>>>>> >   fputs($socket, "Dstfilename: musiconhold.conf\r\n");
>>>>>> >   fputs($socket, "Action-000000: newcat\r\n");
>>>>>> >   fputs($socket, "Cat-000000: bhavik\r\n");
>>>>>> >   fputs($socket, "mode: files\r\n");
>>>>>> >   fputs($socket, "directory: /var/lib/asterisk/moh\r\n");
>>>>>> >   fputs($socket, "Reload: yes\r\n");
>>>>>> >   fputs($socket, "ActionID: 9873497149817\r\n");
>>>>>> >   fputs($socket, "Action: Logoff\r\n\r\n");
>>>>>>
>>>>>> You're not really editing. You're writing.
>>>>>>
>>>>>> Note the following:
>>>>>>
>>>>>> * It requires Asterisk to be running, and accessible through the
>>>>>> manager
>>>>>>  interface.
>>>>>> * asterisk.conf may be in a path that is not the configuration
>>>>>>  directory. I'm not sure if this special case is handled.
>>>>>> * #include are basically handled, but mostly for reading. IIRC the
>>>>>> write
>>>>>>  is back to a single file. No idea about #exec, which will probably
>>>>>>  have odd interactions with UpdateConfig. Configuration templates
>>>>>>  ('[section](template)') are also not handled gracefully.
>>>>>>
>>>>>> >
>>>>>> > After doing all no success :((
>>>>>>
>>>>>> This is a report of the the thing that did not happen. Next time you
>>>>>> ask
>>>>>> a question, please report what actually does happen ("I got the
>>>>>> following
>>>>>> response: ...").
>>>>>>
>>>>>> --
>>>>>>               Tzafrir Cohen
>>>>>> icq#16849755              jabber:tzafrir.cohen at xorcom.com
>>>>>> +972-50-7952406           mailto:tzafrir.cohen at xorcom.com
>>>>>> http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
>>>>>>
>>>>>> --
>>>>>> _____________________________________________________________________
>>>>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>>>>               http://www.asterisk.org/hello
>>>>>>
>>>>>> asterisk-users mailing list
>>>>>> To UNSUBSCRIBE or update options visit:
>>>>>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> _____________________________________________________________________
>>>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>>>               http://www.asterisk.org/hello
>>>>>
>>>>> asterisk-users mailing list
>>>>> To UNSUBSCRIBE or update options visit:
>>>>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>> -----
>>>> Thanks and regards
>>>>
>>>>  Virendra Bhati
>>>> +91-9172341457
>>>> Software Engineer
>>>>
>>>>
>>>> --
>>>> _____________________________________________________________________
>>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>>               http://www.asterisk.org/hello
>>>>
>>>> asterisk-users mailing list
>>>> To UNSUBSCRIBE or update options visit:
>>>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>
>>>
>>>
>>> --
>>> _____________________________________________________________________
>>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>>               http://www.asterisk.org/hello
>>>
>>> asterisk-users mailing list
>>> To UNSUBSCRIBE or update options visit:
>>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>>
>>
>>
>>
>> --
>>
>>
>>
>> -----
>> Thanks and regards
>>
>>  Virendra Bhati
>> +91-9172341457
>> Software Engineer
>>
>>
>> --
>> _____________________________________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>> New to Asterisk? Join us for a live introductory webinar every Thurs:
>>               http://www.asterisk.org/hello
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>               http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 



-----
Thanks and regards

 Virendra Bhati
+91-9172341457
Software Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110905/5574a928/attachment.htm>


More information about the asterisk-users mailing list