Disable / Enable Elstatix GUI (httpd) from your phone: Asterisk Dialplan

  1. Create 2 scripts to start & stop httpd daemon.
    1. httpstop
      #!/usr/bin/php
      <?php
      $output = $ret = NULL;
      exec("/sbin/service httpd stop 2>&1", $output, $ret);
      ?>
    2. httpstart
      #!/usr/bin/php
      <?php
      $output = $ret = NULL;
      exec("/sbin/service httpd start 2>&1", $output, $ret);
      ?>
  2. Make them executable (chmod +x) and copy to /usr/share/elastix/privileged
  3. Edit the file /etc/asterisk/extensions_custom.conf and add the lines under context [from-internal-custom].
    [from-internal-custom]
    exten => 120,1,Playback(posix-restarting) ; "Stop HTTP Server"
    exten => 120,2,Wait(1)
    exten => 120,3,System(sudo /usr/sbin/elastix-helper httpstop)
    exten => 120,4,Playback(disabled)
    exten => 120,5,Hangup
    
    exten => 121,1,Playback(posix-restarting) ; "Start HTTP server"
    exten => 121,2,Wait(1)
    exten => 121,3,System(sudo /usr/sbin/elastix-helper httpstart)
    exten => 121,4,Playback(enabled)
    exten => 121,5,Hangup

    I used the number 120 to stop the web server & 121 to start it.

  4. Reload asterisk and dial 120 & 121 to test.
  5. If you want to dial it from outside add above numbers in “Misc Destination” menu and then select them from IVR menu.
Advertisements

, , , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: