Monday, October 24, 2016

Setting up rocketchat on a UBUNTU 16.04 server

Steps to install on UBUNTU 16.04

1.     Perform the basic install of Unbutu 16.04 server.
Using the default drive sizing settings etc are probably fine, especially if you are testing this.

         Set an appropriate username (ex.  Administrator)
         Set the appropriate country
         Set the appropriate timezone
         Set Hostname (ex Rocketchat)

2.     When installation is completed, server will reboot.

3.     Log into the server and reboot the box again (Weird Ubuntu thing I’ve encountered in the past)
Reboot [enter]

4.     Box restarts, log in and do the following:

5.     sudo apt-get update
6.     sudo apt-get dist-upgrade
(this will take 30 minutes probably)

7.     sudo snap install rocketchat-server
8.    reboot

9.     If you want to hardcode an IP,  eetup IP address by editing the file:  /etc/network/interfaces/
iface eth0 inet static
address x.x.x.x
netmask x.x.x.x
gateway x.x.x.x

10.  Save your changes
11.  Reboot

By default RocketChat uses port 3000 so, if you want to forward standard :80 port, you can do it with this in UBUNTU with this following commands

sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3000
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000

Done!  You should now be, by default, http://IPofYourServer:3000 and be prompted by a rocketchat webpage.
Register as a new user, this user will automatically become the Administrator user.
You can go in an resign this permission to other users, so its not permanent.

Should you wish to update it.  These commands will help:

"snap find rocketchat-server" will pull the SNAP repository for the latest version.

"sudo snap refresh rocketchat-server" will update your version to the latest.  Takes a minute or so usually to download, the upgrade is under a minute and users probably will just see some "reconnecting" indications if they are logged in, but usually only takes 10-20 seconds for the service to restart.  Everyone will automatically log back in.

If running the above sudo command gives you an error similar to the following:
bla bla bla assumes unsupported features: snapd2.23 

Try the following command:

sudo apt update sudo apt install snapd

The re-run the snap find/snap refresh commands again. You should be good to go.

Friday, October 21, 2016

Aligning two different sets of data in excel with each other

Here is how to align two different sets of data in excel each set containing multiple rows, but only one common element between the two to use as a 'key'.

This will explain a way to make the data on the left, become the data on the right. We are using "USER ID" as the common value between the two groups


Put each set of data into its own EXEL tab



In my example I want the data in Sheet2 to be put into Sheet1.  
So on Sheet2, select all the data

When you select in, the box in the upper left corner of Excel that normally shows you which cell(s) are select, type in MyData into that box



Here's some Excel Vlookup magic.


Go to Sheet 1 and select the first box to the right of the first row of data that you want matching data to start being displayed.  In my example below i'm putting into C2

and enter this code in

=vlookup($A2,MyData,1,false)


Next put in this into your next column, in my example it will be D2
You will notice

                                        =VLOOKUP($A2,MyData,2,FALSE)



Now do a select and auto fill by selecting the cells you put in the code, and double clicking the autofill dot that appears in the lower right corner of the selection


You should see data fill in like this:


The way the code basically works is
($ColumnWithCommonValueToMatch, DataName, ColumnNumber, code)

=vlookup($a2,MyData,1,false)

=vlookup($a2,MyData,2,false)

=vlookup($A1,MyData,3,false)


Monday, October 3, 2016

Tether an iPhone to router for Internet access

Scenario:
The ISP providing internet to your office/home network (wired and wireless) is unavailable and you need internet to work again.  The method described here will allow you to have multiple connections through your iPhone's data plan using your existing SOHO router.

To use your iPhone with your router, you will need to utilize a computer that will host the connection between your iPhone and your router.  You can still use this machine for internet access, however it will have limited access to your LAN resources since it is 'outside' the network.




(Mobile Network Data) <-> iPhone <-> Host Computer <-> Router <-> (wired/wireless LAN)
  1. On the host computer, (tested on windows 7 and 10), plug your iPhone into it with the USB cable.
  2. Enable Personal Hotspot
  3. When prompted with this message, select USB ONLY
  4. After 30 secs or so, windows SHOULD recognize this as a device in your computer network settings.
  5. Now select the "Apple Mobile Device Ethernet", hold down the CTRL key and click on the Local Area Connection that coincides with the Ethernet port of your host computer.

  6. Right click on this and then select BRIDGE CONNECTIONS.  You'll see this message appear.
  7. Then you'll see a new network device show up....
  8. Give it a minute or so, but eventually you'll see this:
  9. You'll see the new Ethernet device show up as "iPhone"
  10. (On the host computer, you'll see that the iPhone has provided the new "Ethernet 2" connection an IP of 172.20.10.2, and the iPhone itself has the ip of 172.20.10.1  )

  11. Now plug in the host computer into your router's "WAN" port
  12. Depending on the router model/design, you may have some due diligence to allow it to accept this new connection.  The router has to obtain a proper WAN side ip, in our example, it would be an IP of 172.20.10.X


Once your router has obtained the IP from the host computer/iPhone bridge, then your machines that are connected to this router through a wired and/or wireless connection will now have internet access.

Your router LAN IP structure will stay exactly the same, so all your local users should still have access to the same local resources they are used to.  The router will automatically make the internet available to these users.

Remember, all these machines will be using your data plan, so be cautious of usage!

Saturday, September 17, 2016

Play a message on asterisk before calling someone

I had a need to play a reminder message to users who placed a call through our asterisk server that utilized a high toll charge route.  The automatic message reminds them that the call is using a high toll cost trunk, then the number is connected as normal.

This was built on ELASTIX 2.5.0 distribution

FreePBX doesn't let you do this out of the box yet (as of Sept 2016) but I wanted to implement something as simple as I could come up with.
What I did was modify the FreePBX pinset feature to play the message, without the need of entering a pin number and with minimal programming.

FreePBX pinset feature prompts users to enter a PIN before the call connected.  I just changed the message to a custom one I made, and removed the need for users to enter any number.

INSTRUCTIONS

1> Make a custom recording of what you want the new message to be.  I recorded it using the FreePBX GUI sound recordings menu and called it "TollRoute"

2> Open up extensions_additional.conf file and look for [macro-pinsets].  It will look like this:

[macro-pinsets]
include => macro-pinsets-custom
exten => s,1,GotoIf(${ARG2} = 1?cdr,1)
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?Authenticate(/etc/asterisk/pinset_${ARG1}))
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?ResetCDR())

exten => cdr,1,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?Authenticate(/etc/asterisk/pinset_${ARG1},a))
exten => cdr,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?ResetCDR())

;--== end of [macro-pinsets] ==--;


3> Copy this portion of code and paste it into "extensions_override_freepbx.conf".

4> Now change to two instances to the newly pasted text that contain:
?Authenticate(/etc/asterisk/pinset_${ARG1}))
to:
?Playback(./custom/TollRoute))

AND



?Authenticate(/etc/asterisk/pinset_${ARG1},a))
to:
?Playback(./custom/TollRoute))

Here is what the code should look like based on my example:

[macro-pinsets]
exten => s,1,GotoIf(${ARG2} = 1?cdr,1)
;if extension has PINLESS DIAL set to YES then the message is NOT played
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?Playback(./custom/TollRoute))
exten => s,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?ResetCDR())

exten => cdr,1,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?playback(./custom/TollRoute))
exten => cdr,n,ExecIf($["${DB(AMPUSER/${AMPUSER}/pinless)}" != "NOPASSWD"]?ResetCDR())

5> Save these changes.

6> In the FreePBX GUI, goto PINSETS and create a Pinset called "TollWarning"
You don't need to put any pins in this, you can leave it empty.  Save it.

7> Select the outbound route you want this feature on, and next to "PIN Set:", select "TollWarning" in the drop box.  Save your changes and apply them with the red bar/button at the top of FreePBX

8> make your test.  When you call that route, you should hear your custom message played.  As soon as it is done, your call will automatically dial.

FEATURE:
If you have extension(s) that you dont want this to be applied to (maybe you have different lines of business) you can go to those extensions and enable "PINLESS DIAL"  those extensions will simply automatically bypass this code and goto immediate ringing.

WHAT AM I CHANGING?
Essentially you are changing the "AUTHENTICATE" command, which is triggers asterisk to play the "Please enter your pin" and wait for you to enter a value into your phone, and modifying it to simply play the message, then continue.

WARNING:
This code will affect your PBX pins on any routes that you have in your system currently.

Thursday, September 15, 2016

Customizing FreePBX dialplans

Want to modify the existing code that FreePBX generates slightly for your own and not have it get overwritten every time you update the GUI?  Here's how.

First, find the code that you want to alter

In the example below, I wanted to customize the code that asterisk used when asking for a pin# when someone dials the phone.

So I found the code I wanted to change in: extensions_additional.com

[outrt-11] ; PSTN_PIN
include => outrt-11-custom
exten => _6666X.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _6666X.,n(pinsets),Macro(pinsets,1,1)
exten => _6666X.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _6666X.,n,Set(_NODEST=)
exten => _6666X.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))
exten => _6666X.,n,Macro(dialout-trunk,2,${EXTEN:4},,off)
exten => _6666X.,n,Macro(outisbusy,)

Copy that code and then paste it in: extensions_override_freepbx.conf

Now alter the file as you need.  You'll see I've added a "NoOp" line to echo a message into the live log.  Remember, don't alter the ["HEADING"], leave as is.

[outrt-11] ; PSTN_PIN
include => outrt-11-custom
exten => _6666X.,1,Macro(user-callerid,LIMIT,EXTERNAL,)
exten => _6666X.,n,NoOp( THIS IS THE ALTERED CODE!!!!!!!!!!!!!! )
exten => _6666X.,n(pinsets),Macro(pinsets,1,1)
exten => _6666X.,n,Set(MOHCLASS=${IF($["${MOHCLASS}"=""]?default:${MOHCLASS})})
exten => _6666X.,n,Set(_NODEST=)
exten => _6666X.,n,Gosub(sub-record-check,s,1(out,${EXTEN},))
exten => _6666X.,n,Macro(dialout-trunk,2,${EXTEN:4},,off)
exten => _6666X.,n,Macro(outisbusy,)

Save the changes then reload the config in asterisk and you will be good to go.

In the above example, the calls behave the same, but in the live log you'll see "THIS IS THE ALTERED CODE" appear when the module is triggered.


Thursday, July 14, 2016

AudioCodes MP-112 or MP-124 factory reset

Here's how to reset both an AudioCodes MP-112 or MP-124 FXS adapter.  Probably works with
other models.

OR

How to find out the IP of the unit (or really most any ethernet device) without resetting, which is described a little bit below.

Hardware Reset:
Power up the unit.  If first time the fail light might be lit, it normally clears itself out after 2 minutes or so.

While unit is powered on do the following:

1. Press and hold the RESET on the back of the unit for 10 seconds.  Use a paperclip or some small pokey thing to do this.

2. Waiting For\
> MP112 for the fail light to go out (after about a 2 minutes)

> MP-124 "READY" light to go green

3. Plug in the Ethernet cable, unit should be HTTP accessible on the default IP of  10.1.10.10

#####################################################################
http://10.1.10.10
users/password is  "Admin/Admin"  (case sensitive, note the CAPITAL "A"!!!!!!!!)
#####################################################################

When you set the IP, at least on the MP124, you must click on "SUBMIT" then http to the new IP and select "BURN". 

DISCOVER the IP OF THE BOX WireShark

IF you can't find the IP of the box (or you dont want to reset it to factory)
1.  (Install) start wireshark

2.  Connect the audiocodes directly to your computer and start a capture in wireshark of the ethernet port.

3. plug the audiocodes directly into your computer.  It doesn't matter what IP your computer has either.

4  unplug the power to the audiocodes and plug it back in.

5. watch the shark log.  What you are looking for under the "SOURCE" column is AudioCodes, or some close name to that.

6. when you spot it, on the right side under "INFO" for those entries you see entries like "Who is x.x.x.x? Tell X.X.X.X"


you might have but don't know the IP to.

Monday, July 4, 2016

Sangoma Vega200g gateway with FreePBX

Get FreePBX configured with a Sangoma 200G vega gateway.

This document is an older doc for an old config.  I'm not sure how much it applies now
I'm keeping it here for reference only.  Check this blog for the VEGA100 configuration which is done on JAN of 2021

This installation is specifically with ELASTIX 2.5.0 deployment build using Asterisk and FreePBX


I'm really not going to get into major details of installing this product...but this deployment example is using ELASTIX 2.5.0 - 08 May 2015 build.

Its using a Venga 200g gateway with the following information:

Binary File Name  : VEGA_R101S019
    Release Date      : Mar 16 2016 09:48:13
    Versioning Info   : SIP Firmware Rev 10.01 for H/W Type 15
    Boot Requirements : Boot Loader 04.00


So i pulled the Asterisk side using the following lync:

http://wiki.freepbx.org/display/VG/Freepbx

To sum this up, all you really need to do is create a new SIP trunk

Give it a General Settings Trunk Name ie "SangomaGateway"

Then in OUTGOING SETTING
give it a TRUNK NAME ie "PBX-PRI"

In PEER DETAILS
username=PBX-PRI
secret=as234234234sdfasdfasdfasd3542g4349807
type=friend
qualify=yes
context=from-trunk
insecure=port,invite
host=dynamic

SAVE / APPLY those changes and that is about it.
The "host=dynamic" fixed a bunch of connection issues I had btw.  Its the first time I've ever used that setting.

Aside from creating an outbound route to use that trunk, these were all the changes I made on a base install of ELASTIX.  

VEGA 200G configuration.



I used the configuration for the 200G using the configuration from this site:

https://support.gradwell.com/entries/23304546-How-to-configure-your-Sangoma-Vega-Gateway

It was pretty good.  I've included their work below and noted some changes I had to make to tweak it for the Elastix type of install.


We are assuming you are configuring a brand new unit. Following this procedure will erase/nullify any existing configurations on this box.| Manual configuration

fter logging in, click on Quick Config from the left hand menu.
The quick configuration allows you to set basic entry level values on the unit easily. 
On the Quick Config screen, set the network information that you wish the unit to use, for example the IP address.  Use DHCP or Hardcode the IP as your network needs suit.
Now click on the VoIP tab. Ensure that the values are set as below.
  • Registration Mode: Off
  • Outbound Proxy Used?: No
  • SIP domain: IP OF YOUR ASTERISK BOX
  • SIP Server IP/Name: IP OF YOUR ASTERISK BOX
  • Outbound Proxy IP/Name: leave blank
  • Registration and Authentication ID: leave blank
  • Authentication Password: leave blank
In the codecs drop down, ensure that g711Alaw64k is selected first, g711Ulaw64k is second and g729 is third.
Now click on E1. In the Telephone number list fields we recommend that you enter .*
NT?  This depends.  Normally YES, check.  Mine, I had to disable it.  So if you encounter issues during turnup of your system, this is a check box that you can come back to.
Now tick New Install? at the top of the screen and then Submit. Ensure that you save the configuration and reboot the system to fully apply the changes.
Once the gateway has rebooted, expand the Expert Config menu on the left hand side and click SIP.
Click on the Modify link that is within the SIP Profiles box.
Look for the From Header 'userinfo' dropdown
Depending on your installation, you might need to use either CALLING PARTY or AUTHENTICATION USERNAME.
I've had issues with inbound.  So this is a spot where you might need to come back to.
If LOCAL DOMAIN is not populated, put in your asterisk IP.
Now scroll to the SIP Proxy entry that is on this page (it's underneath the SIP Profile 1 Proxy Parameters 1 box). Click the Add button and then Modify to enter a new hostname.
IP/DNS Name "Your Asterisk IP", IE 10.4.100.10
Ensure that the Enable box is ticked before clicking Submit. The proxy list should now look like this:
Click the SIP menu link from the main left hand menu.
Scroll to to SIP Authentication Configuration and click SIP Authentication.
Click on Modify.
On this page enter your FreePBX trunk Username and Password.Ensure that Enable is ticked and click Submit.
This should be the USERNAME / PASSWORD you used in your FREEPBX TRUNK screen.
Click the red Save button in the left hand menu and then the red Apply Changes button. Reboot the system and your gateway should be ready to use.
Make sure when you hit SAVE the screen does refresh.  The SAVE should no longer be red.