Hi,<div><br><div>1- try putting absolute filepath in source and destination field.</div><div>2- verify that the permissions of the files you're changing. <br><br>Regards,</div><div>Sammy.</div><div><br><div class="gmail_quote">
On Mon, May 21, 2012 at 5:10 PM, virendra bhati <span dir="ltr"><<a href="mailto:virbhati@gmail.com" target="_blank">virbhati@gmail.com</a>></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 List,<br><br>I am trying to add new SIP account in new file additional_sip.conf. I read in Wiki there is API command UpdateConfig which is used to update , add and delete any entry from configure files. I am using PHP to make new entry in additional_sip.conf. Below is the code which I tryed ....<br>
<br><span style="color:rgb(51,204,255)"><?php</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 30);</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> if (!$socket) </span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> {</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> $done=0;</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> } else {</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "Action: Login\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "UserName: admin\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "Secret: admin\r\n\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> </span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "Action: UpdateConfig\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "reload=yes\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "SrcFilename: additional_sip.conf\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "DstFilename: additional_sip.conf\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "Action-000000: NewCat\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "Cat-000000: 9911881985\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "Var-000000: 9911881985\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "Value-000000: 9911881985\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "ActionID: 343434\r\n\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "Action: Logoff\r\n");</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> fputs($socket, "UserName: root\r\n");</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> fputs($socket, "Secret: energy\r\n\r\n");</span><br style="color:rgb(51,204,255)">
<br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> $done=1;</span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)"> }</span><br style="color:rgb(51,204,255)"><span style="color:rgb(51,204,255)"> </span><br style="color:rgb(51,204,255)">
<span style="color:rgb(51,204,255)">?></span><br clear="all"><br><b>CLI Log:-</b><br>ks3098819*CLI><br> == Parsing '/etc/asterisk/manager.conf': Found<br> == Manager 'admin' logged on from 127.0.0.1<br>
== Manager 'admin' logged off from 127.0.0.1<br>ks3098819*CLI><span class="HOEnZb"><font color="#888888"><br><br>-- <br><div dir="ltr"><br>Thanks and regards<br><br> Virendra Bhati<br><a href="tel:%2B91-08885268942" value="+918885268942" target="_blank">+91-08885268942</a><br>
Software Engineer<br>E-mail-: <a href="mailto:virbhati@gmail.com" target="_blank">virbhati@gmail.com</a><br>
Skype id:- virbhati2<br>Hyderabad(India)<br></div><br>
</font></span></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></div>