Re: add new sip account in sip.conf with API Action UpdateConfig with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



I have update sammy but no luck

<?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: /etc/asterisk/additional_sip.conf\r\n");
  fputs($socket, "DstFilename: /etc/asterisk/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: admin\r\n");
  fputs($socket, "Secret: admin\r\n\r\n");

  $done=1;
  }
 
?>

On Mon, May 21, 2012 at 5:49 PM, SamyGo <govoiper@xxxxxxxxx> wrote:
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@xxxxxxxxx> 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@xxxxxxxxx
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


--
_____________________________________________________________________
-- 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-08885268942
Software Engineer
E-mail-: virbhati@xxxxxxxxx
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

[Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [DCCP]     [Gimp]     [100% Free Online Dating]     [Yosemite News]     [Arts & Crafts]     [Yosemite Photos]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]


Add to Google Powered by Linux