Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. buttons from sip.conf instead of voicemail.conf?

buttons from sip.conf instead of voicemail.conf?

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 78 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I
    I
    id10t
    wrote on last edited by
    #1

    Does anyone parse the sip.conf to build the buttons? I have users that have both soft and hard phones. Soft phones do not have voicemail and/or are the softphone is setup to leave voicemail at the primary (hard phone) mailbox. Hard phones that are in conference rooms, lobbies, server room, etc do not have mailboxes either so I don't see them in fop2.

    Has anyone written a script to parse the sip.conf file instead?

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2

      The latest beta can be used together with a freepbx module to configure users from the extensions instead of voicemail. Please search the forums as there are several posts with the appropiate links... you can try that out. Best regards,

      1 Reply Last reply
      0
      • N
        N
        nicolas
        wrote on last edited by
        #3

        Quick and dirty, for FreePBX:

        #!/bin/bash
        if [ -e /etc/amportal.conf ]; then
        
        DBNAME=`cat /etc/amportal.conf | sed 's/ //g' | grep ^AMPDBNAME | cut -d= -f2`
        DBUSER=`cat /etc/amportal.conf | sed 's/ //g' | grep ^AMPDBUSER | cut -d= -f2`
        DBPASS=`cat /etc/amportal.conf | sed 's/ //g' | grep ^AMPDBPASS | cut -d= -f2`
        DBHOST=`cat /etc/amportal.conf | sed 's/ //g' | grep ^AMPDBHOST | cut -d= -f2`
        
        mysql -NB -u $DBUSER -p$DBPASS -h $DBHOST $DBNAME -e "select CONCAT('user=',id,':',data,':all') from sip where keyword='secret'" | while read LINEA
        do
        echo $LINEA 
        done
        echo "buttonfile=autobuttons.cfg"
        
        else
        echo "Unable to find /etc/amportal.conf"
        fi
        
        1 Reply Last reply
        0
        • I
          I
          id10t
          wrote on last edited by
          #4

          I don't have freepbx but got this to work with asterisk 1.6.0.26
          Create a file called build_buttons.pl and paste following code.

          #!/usr/bin/env perl
          #
          # Extensions
          #
          while (<>) {
                  if (m/\[\d/) {
                          chomp $_;
                          s/\[([0-9]+)\]/\1/;
                          print("[SIP/$_]\n");
                          print("type=extension\n");
                          print("extension=$_\n");
                          while (<>) {
                                  if (m/^$/) {
                                          last
                                  }
                          if (m/^(context|label|vmexten=[0-9]|callerid|mailbox|\[[0-9])/) {
                                  s/\<([0-9]+)\]/\1/;
                                  s/callerid=/label=/;
                                  s/ <\d+>//;
                                  if ( m/context/ ) {
                                          $context=$_;
                                          $context=~ s/context=//;
                                          chomp $context;
                                  }
                                  s/(mailbox=\d+)/\1\@default/;
                                  s/vmexten=(\d+)/extenvoicemail=*\1\@$context/;
                                  print
                                  }
                          }
                  }
          }
          
          #The rest of this is just hardcoded buttons.
          #
          # Conference
          #
          print("[CONFERENCE/1600]\n");
          print("type=conference\n");
          print("label=User\n");
          print("extension=1600\n");
          print("context=from-internal-redir\n");
          print("\n");
          
          print("[PARK/default]\n");
          print("extension=700\n");
          print("context=parkedcalls\n");
          print("type=park\n");
          print("Label=Parked \n");
          print("\n");
          
          print("[SIP/VoicePulse]\n");
          print("type=trunk\n");
          print("label=VoicePulse\n");
          
          print("[G1]\n");
          print("type=trunk\n");
          print("label=PRI\n");
          print("channel=DAHDI/1\n");
          print("channel=DAHDI/2\n");
          print("channel=DAHDI/3\n");
          print("channel=DAHDI/4\n");
          print("channel=DAHDI/5\n");
          print("channel=DAHDI/6\n");
          print("channel=DAHDI/7\n");
          print("channel=DAHDI/8\n");
          print("channel=DAHDI/9\n");
          print("channel=DAHDI/10\n");
          print("channel=DAHDI/11\n");
          print("channel=DAHDI/12\n");
          print("channel=DAHDI/13\n");
          print("channel=DAHDI/14\n");
          print("channel=DAHDI/15\n");
          print("channel=DAHDI/16\n");
          print("channel=DAHDI/17\n");
          print("channel=DAHDI/18\n");
          print("channel=DAHDI/19\n");
          print("channel=DAHDI/20\n");
          print("channel=DAHDI/21\n");
          print("channel=DAHDI/22\n");
          print("channel=DAHDI/23\n");
          

          buttons.cfg only has this line
          #exec build_buttons.pl < /etc/asterisk/sip.conf

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups