[asterisk-users] add new sip account in sip.conf with API Action UpdateConfig with php
SamyGo
govoiper at gmail.com
Mon May 21 07:19:25 CDT 2012
Hi,
1- try putting absolute filepath in source and destination field.
2- verify that the permissions of the files you're changing.
Regards,
Sammy.
On Mon, May 21, 2012 at 5:10 PM, virendra bhati <virbhati at gmail.com> wrote:
> Hi List,
>
> 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 ....
>
> <?php
> $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, 30);
> if (!$socket)
> {
> $done=0;
> } else {
> fputs($socket, "Action: Login\r\n");
> fputs($socket, "UserName: admin\r\n");
> fputs($socket, "Secret: admin\r\n\r\n");
>
> fputs($socket, "Action: UpdateConfig\r\n");
> fputs($socket, "reload=yes\r\n");
> fputs($socket, "SrcFilename: additional_sip.conf\r\n");
> fputs($socket, "DstFilename: additional_sip.conf\r\n");
> fputs($socket, "Action-000000: NewCat\r\n");
> fputs($socket, "Cat-000000: 9911881985\r\n");
> fputs($socket, "Var-000000: 9911881985\r\n");
> fputs($socket, "Value-000000: 9911881985\r\n");
> fputs($socket, "ActionID: 343434\r\n\r\n");
> fputs($socket, "Action: Logoff\r\n");
> fputs($socket, "UserName: root\r\n");
> fputs($socket, "Secret: energy\r\n\r\n");
>
> $done=1;
> }
>
> ?>
>
> *CLI Log:-*
> ks3098819*CLI>
> == Parsing '/etc/asterisk/manager.conf': Found
> == Manager 'admin' logged on from 127.0.0.1
> == Manager 'admin' logged off from 127.0.0.1
> ks3098819*CLI>
>
> --
>
> Thanks and regards
>
> Virendra Bhati
> +91-08885268942
> Software Engineer
> E-mail-: virbhati at gmail.com
> Skype id:- virbhati2
> Hyderabad(India)
>
>
> --
> _____________________________________________________________________
> -- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120521/e7476f11/attachment.htm>
More information about the asterisk-users
mailing list