<div>1- Per my experience I&#39;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&#39;ll be saved.</div>
<div><br></div><div>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.</div>
<div><br></div><div>2- If you&#39;ve to move forward with this approach I&#39;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).</div>
<div><br></div><div>Those were all my suggestions, if anyone else can add valuable comments to this.</div><div><br>-</div><div>sammy</div><div><br></div><div><br><div class="gmail_quote">On Mon, Sep 5, 2011 at 11:45 AM, virendra bhati <span dir="ltr">&lt;<a href="mailto:virbhati@gmail.com">virbhati@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">Hi Sammy,<br><br>Ans of 1st question:- <br><br>As per my experiance <font face="arial, sans-serif">Asterisk realtime(DB) based</font> data will lost when your server is creash and you may not take backup of your server&#39;s DB. <br>

If any one know  then plese guide me so that I will start working on it.<br><br>Ans of 2nd question:- <br><br>Your question is correct if more then one user will access these configuration files then might be some problem will come.<br>

<br>For this issue I am just make a connection with server then close it after finishing the job. So problem will be avoided ....<div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Mon, Sep 5, 2011 at 10:47 AM, Sam Govind <span dir="ltr">&lt;<a href="mailto:govoiper@gmail.com" target="_blank">govoiper@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Though this might have been resolved/accomplished already but I&#39;ve couple of questions for <span style="color:rgb(80, 0, 80);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255, 255, 255)">Virendra Bhati. </span><div>


<font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">1- If you are doing this to make new accounts for new users, why couldn&#39;t you use Asterisk realtime(DB) based configurations of Voicemail/MoH/SIP/dialplan etc wouldn&#39;t it be much easier than doing lots and lots of filing !?<br>


</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">2- Since its a web-based Filing operations and if multiple users are to use the same page for appending/overwriting their configurations wouldn&#39;t it lead to information being lost when multiple users applying their changes ? I wonder how do you handle that ?</font></div>


<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I&#39;m sure I&#39;d more questions when I started writing this response mail but now I&#39;ve forgotten those :P</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">Thanks,</font></div><div><span style="font-family:arial,sans-serif">Sammy.</span></div><div><div></div><div>
<div><font color="#500050" face="arial, sans-serif"><br></font><div class="gmail_quote">On Sun, Sep 4, 2011 at 6:00 PM, Tzafrir Cohen <span dir="ltr">&lt;<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><div>On Fri, Sep 02, 2011 at 04:58:52PM +0530, virendra bhati wrote:<br>
</div><div><div></div><div>&gt; Hi list,<br>
&gt;<br>
&gt; I want ot do basic work (add-edit-delete) into asterisk configuration files,<br>
&gt; like sip.conf, manager.conf,musiconhold.conf etc.<br>
&gt;<br>
&gt; Please guide me how to configure all these files from from AMI connection. I<br>
&gt; am able to login into AMI from Login action but I want to do more task in to<br>
&gt; it.<br>
&gt;<br>
&gt; *AMI login:- *<br>
&gt;<br>
&gt; *login.php*<br>
&gt;<br>
&gt; &lt;?php<br>
&gt; $socket = fsockopen(&quot;127.0.0.1&quot;,&quot;5038&quot;, $errno, $errstr, 30);<br>
&gt; fputs($socket, &quot;Action: Login\r\n&quot;);<br>
&gt; fputs($socket, &quot;UserName: root\r\n&quot;);<br>
&gt; fputs($socket, &quot;Secret: energy\r\n\r\n&quot;);<br>
&gt; ?&gt;<br>
&gt; *AMI command:-*<br>
&gt;<br>
&gt; Below commands are for musiconhold.conf. I want to add new MOH context into<br>
&gt; it.<br>
&gt; &lt;?php<br>
&gt; include(&quot;login.php&quot;);<br>
&gt;   fputs($socket, &quot;Action: UpdateConfig\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Filename: musiconhold.conf\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Srcfilename: musiconhold.conf\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Dstfilename: musiconhold.conf\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Action-000000: newcat\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Cat-000000: bhavik\r\n&quot;);<br>
&gt;   fputs($socket, &quot;mode: files\r\n&quot;);<br>
&gt;   fputs($socket, &quot;directory: /var/lib/asterisk/moh\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Reload: yes\r\n&quot;);<br>
&gt;   fputs($socket, &quot;ActionID: 9873497149817\r\n&quot;);<br>
&gt;   fputs($socket, &quot;Action: Logoff\r\n\r\n&quot;);<br>
<br>
</div></div>You&#39;re not really editing. You&#39;re writing.<br>
<br>
Note the following:<br>
<br>
* It requires Asterisk to be running, and accessible through the manager<br>
  interface.<br>
* asterisk.conf may be in a path that is not the configuration<br>
  directory. I&#39;m not sure if this special case is handled.<br>
* #include are basically handled, but mostly for reading. IIRC the write<br>
  is back to a single file. No idea about #exec, which will probably<br>
  have odd interactions with UpdateConfig. Configuration templates<br>
  (&#39;[section](template)&#39;) are also not handled gracefully.<br>
<div><br>
&gt;<br>
&gt; After doing all no success :((<br>
<br>
</div>This is a report of the the thing that did not happen. Next time you ask<br>
a question, please report what actually does happen (&quot;I got the following<br>
response: ...&quot;).<br>
<font color="#888888"><br>
--<br>
               Tzafrir Cohen<br>
icq#16849755              <a href="mailto:jabber%3Atzafrir.cohen@xorcom.com" target="_blank">jabber:tzafrir.cohen@xorcom.com</a><br>
<a href="tel:%2B972-50-7952406" value="+972507952406" target="_blank">+972-50-7952406</a>           mailto:<a href="mailto:tzafrir.cohen@xorcom.com" target="_blank">tzafrir.cohen@xorcom.com</a><br>
<a href="http://www.xorcom.com" target="_blank">http://www.xorcom.com</a>  <a href="http://iax:guest@local.xorcom.com/tzafrir" target="_blank">iax:guest@local.xorcom.com/tzafrir</a><br>
</font><div><div></div><div><br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br><br clear="all"><br></div></div>-- <br><div class="im">
<div dir="ltr"><br><br>
<br>-----<br>Thanks and regards<br><br> Virendra Bhati<br><a href="tel:%2B91-9172341457" value="+919172341457" target="_blank">+91-9172341457</a><br>Software Engineer<br></div><br>
</div></div>
<br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
               <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
   <a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>