Tuesday, November 1, 2011

Nagios Plugin–Advance Traceroute to check between two devices


We had to create a plugin to basically do the following
1) Do a typical traceroute from the Nagios box to a destination IP
2) Instead of calculating the time between the Nagios to Destination Host, we are interested to know the time between two host in between

In other words, a typical traceroute will
NagionServer –> Gateway –> Hop 1 –> Hop 2 –> Hop 3 –> Destination

What this plugin can do is when defined correctly, to check the time (in ms) between Hop 1 up until Hop 3, plot a graph and put up warning and critical values for your alerting.
Here’s the sample plugin, and relevant configuration files you probably need.
NOTE: You may need to tweak for different  Oses other than Debian as this was created and tested with a Debian.
The plugin
  • The plugin (place typically in /usr/local/nagios/libexec)
  • Paste below into a file say trace_time
  • Make sure it belongs to user <nagios> and has execution right; e.g.
  • chown nagios:nagios /usr/local/nagios/libexec/trace_time
  • chmod +X /usr/local/nagios/libexec/trace_time
#####START PLUGIN#####
#!/bin/bash
#
# usage
# ./trace-time <final-dest> <startip> <endip> <warning> <critical>
# Note: You must define all three, there's no error checking
# tip: do a traceroute first, then determine from which ip to which ip do you want to calculate. If
#
#
DEST=$1
IP1=$2
IP2=$3
WARNING=$4
CRITICAL=$5
PROG=`which traceroute`
if [[ $DEST == "" ]]; then
   
    echo "UNKNOWN: No destination ip defined"
    exit 3
fi

if [[ $IP1 == "" ]]; then
        echo "UNKNOWN: No start ip defined"
    exit 3
fi

if [[ $IP2 == "" ]]; then
    IP2=$DEST
fi
if [[ $WARNING -eq "" ]]; then
        echo "UNKNOWN: No warning value defined"
        exit 3
fi
if [[ $CRITICAL == "" ]]; then
        echo "UNKNOWN: No critical value defined"
        exit 3
fi

if [[ $WARNING  >  $CRITICAL ]]; then
        echo "UNKNOWN: Warning value larger than critical value"
        exit 3
fi
#
myepoch=`date +%s`
filename=/tmp/$myepoch.tmp.txt
tempfile=/tmp/$myepoch.output
#
/bin/touch $filename
/bin/touch $tempfile
#
/bin/chown nagios:nagios $filename
/bin/chown nagios:nagios $tempfile
#
#
getreading=`$PROG -n -q 1 $DEST > $tempfile`
#
numberip1=`cat $tempfile | grep ms | grep $IP1 | awk {'print $1'}`
numberip2=`cat $tempfile | grep ms | grep $IP2 | awk {'print $1'}`
#
#
for i in $(seq $numberip1 $numberip2)
do
   
    getms=`cat $tempfile | sed -e 's/^[ \t]*//' | grep ^$i |  awk {'print $3'}`
    echo $getms >> $filename
done
#
startcalc=`awk '{s+=$0} END {print s}' $filename`
#
rm $filename
rm $tempfile
#
# OUTPUTS
#
grapher="$IP1-->$IP2"
#
if awk 'BEGIN{if(0+'$startcalc'>'$CRITICAL'+0)exit 0;exit 1}'
then
        echo "CRITICAL($startcalc): Time exceed critical value|$grapher=$startcalc;$WARNING;$CRITICAL"
        exit 2
fi
if awk 'BEGIN{if(0+'$startcalc'>'$WARNING'+0)exit 0;exit 1}'
then
        echo "WARNING($startcalc): Time exceed warning value|$grapher=$startcalc;$WARNING;$CRITICAL"
        exit 1
       
else
   
        echo "OK($startcalc): Time OK|'$grapher'=$startcalc;$WARNING;$CRITICAL;;"
        exit 0
fi
#####END PLUGIN#####

Nagios – Host.cfg
define host{
        use                     debian5-linuxserver
        host_name     Google WWW server
        alias                   For Tracing TimeHop Distances
        address            209.85.175.105
        }           

Nagios – commands.cfg
define command{
        command_name    check_time_between_hosts
        command_line    $USER1$/trace-time $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$
         }

Nagios – services.cfg
define service{
        use                                       debian5-linuxservice
        host_name                       Google WWW server
        service_description      Between IP 210.5.40.153 to 209.85.250.237
        action_url                          /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
        check_command            check_time_between_hosts!210.5.40.153!113.23.161.66!10!20
       }
* Note, the template debian5-linuxservice and debian5-linuxserver is not default and you need to define one first or use the defaults
Now, just restart Nagios to make it work.

More info
In order for you to know the hop you wish to monitor, simply do a traceroute;
# traceroute -n -q 1 209.85.175.105
-n = Numeric output
- q 1= Only do a single query
In this example below, I am tracing to one of Google’s servers at 209.85.175.105, the output of the trace is like below (NOTE!: actual IPs have been changed)
1  111.22.42.3  0.554 ms
2  111.22.40.153  0.667 ms
3  111.22.40.125  1.026 ms
4  203.188.233.121  1.218 ms
5  203.188.233.205  1.488 ms
6  113.23.161.66  1.627 ms
7  209.85.242.246  1.542 ms
8  209.85.242.125  2.322 ms
9  66.249.94.158  3.075 ms
10  209.85.175.105  2.801 ms

So lets say you wish to trace the time between IP 111.22.40.153 and IP113.23.161.66, simply use the plugin with these values on the CLI (to test);
# ./trace-time 209.85.175.105 111.2.40.153 113.23.161.66 10 20
And the output will look like this;
OK(5.909): Time OK|'111.22.40.153-->113.23.161.66'=5.909;10;20;;
*Which is a typical output expected by Nagios with PNP graphing enabled
Graphs will look like this
image

Sunday, August 28, 2011

pfSense and TM Unifi


This is to show you how to enable pfSense 2.x and use TMNet’s Unifi.
Important to note that inorder to “dial” into Unifi, you must fire the PPPoE through a VLAN and those are VLAN 500 for your regular internet browsing and VLAN 600 for your Video. This guide is to setup basic internet using pfSense.
Assuming you are using at least 2 interfaces, the LAN (in this guide, eth0), which all your local networks (or regular users) are connected, the other interface is WAN (in this guide, eth 1) which will be the one that will dial into Unifi.
image

Your LAN can be easily configured to any IP which you wish your users to connect to. This will typically be the gateway IP address for your users. The interface we will discuss here is the WAN interface.
So summary of the steps to get it working;
1) Define the WAN interface as null (or none)
2) Setup VLAN 500 and tie it to the WAN interface or eth1
3) Setup PPPoE inside VLAN interface

1) Defining WAN interface as null.
Simply go to WAN interface and set it up as none. Save it. Setup like below
image

2) Define a new interface:
On pfSense’s main menu, click on Interfaces and click on (assign). Click on VLANs. Select WAN (or eth1) as the parent interface. Inside VLAN tag, enter 500. Put a nice description, like VLAN-TMUnifi there if you so wish. Click on save.
image
3) Setup PPPoE on the VLANned interface:
Now, click on Interfaces again, click on (assign). Click on the + to add a new interface and select the newly created VLAN-TMUnifi. Notice the interface name that was created for you like OPT1 or OPT2. Click on interfaces again, select (and in this example), OPT1. Click to enable the interface. Under type, select PPPoE. Scroll down to the username and password part. Enter your username and password respectively.
You can also rename your interface as for example, from OPT1 to UNIFPPP (for example):
image

Before you click on save, make sure you select, Block private and bogon networks. They should not pass through this interface (unlike interface LAN).
Now, once you’ve save, click on the blue S icon on the top right of the page. If all config such as username and password is correct, you should see the interface come up like below;
image
If you have problems, click on, Status, click on System Log files then click on PPP. Any issues or errors will be shown there.

Once done, you need to setup gateways and routing correctly in order to route traffic over this new interface you just created and dialed.
image
You should set it up as default unless you have other gateways and such. Otherwise, setting it as default will quickly allow you to browse.
Well that’s it, also of course don’t forget to setup an allow rule from interface LAN to any (to begin with) and allow that connection.
If you need to allow incoming connections, select the UNIFPPP interface instead of WAN and setup your inbound rules there.
Enjoy pfSense and the speed of Unifi!
PS> If you are interested in our appliance, do write to sanjay@astiostech.com. Should cost you around US250/box with 4G flash, enclosure, 3 NICs, 2 USB ports (can use for 3G usb modems etc).

Saturday, August 13, 2011

Using Asterisk call files with FreePBX (using Local channel)

Call files are perhaps one of the coolest things you can do with Asterisk. Just literally dump the file in a particular directory and voila, you can make a call. Past few days, I’ve been playing around with it quite a bit and would like to share some things with you on using the Local channel which is most beneficial since you may wish to take advantage of the dialplans and call flows defined in FreePBX (for instance).
Now, the Local channel does a lot such as checks if voicemail is enabled, call forwarding (follow-me) and other customization to the user’s account. It also would support the Device and User mode if that’s being used. The Local channel rather than using technology channels directly can help with several things again for example restrictions that may apply (context) for a particular user. Using channels like SIP/1000 and IAX/1000 will literally bypass all the good stuff that may have been setup.
In conjunction with asterisk call files e.g. .call. You can do lots! including lots of automation and what not just like how you would do using AMI or any AGI stuff if you know about them. Here I would like to show you how to take advantage of the Local channel in call files.
Channel: Local/2000@from-internal/n
CallerID: <0386892800>
MaxRetries: 0
RetryTime: 1
WaitTime: 10
Context: from-internal
Extension: 86892888
Priority: 1 
Archive: no
Set: AMPUSER=2000
Now try modifying these above values to match your specific needs, e.g. channel 2000 is a user 2000 attached to device 1000, change that, change Extension to the destination you wish to bridge a call and here’s what’s important for device/user mode, you must specify the AMPUSER value otherwise, the macro-set-callerid will not be able to set right variables such as outbound CID for you since the Local/2000 will eventually be using SIP/1000 and SIP 1000 doesn’t really have anything more than just a connection agreement (username/password).
Create this file anywhere and then dump it into /var/spool/asterisk/outgoing and voila, you’ve got call.
Also, would like to share a script to automatically create and move files for you; note this will work with FreePBX 2.8 or higher and Asterisk 1.8.
1) nano /root/callgenerator.sh
2) Paste the script below

#!/bin/bash
user=$1
dial=$2

if [[ "$user" -eq "" ]]; then
    echo "ERROR No User / Destination Defined"
    exit 2
fi

if [[ "$dial" -eq "" ]]; then
    echo "ERROR No Destination Number Specified"
    exit 2
fi

# generate call file
mydate=`date +%d%m%y_%H%M%S`
filename="$mydate.U-$user-D-$dial.call"
#
# SUPPORT ONLY SIP
echo -e "Channel: Local/$dial@from-internal/n
CallerID:
MaxRetries: 0
RetryTime: 1
WaitTime: 10
Context: from-internal
Extension:*60
Priority: 1
Archive: no
Set: AMPUSER=$user" > /var/spool/asterisk/$filename

# Call now
# File ops
chown asterisk:asterisk /var/spool/asterisk/$filename
mv /var/spool/asterisk/$filename /var/spool/asterisk/outgoing/ > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
    echo "ERROR Parsefile crashed"
    exit 2
else
    echo Start calling..
fi

exit 0


3) Make it executable chmod +x /root/callgenerator.sh
Test it out like this /root/callgenerator.sh 2000 986892888 (where 2000 is the user’s phone that will first ring and once picked up, it will proceed with the other leg of the call i.e. 986892888, its important here to use from-internal otherwise, your dialplan routing and prefix handingling (in this case, the number 9) will not be stripped off when calling).

Thursday, August 4, 2011

FreePBX IVR direct dial across multiple locations/asterisk servers/FreePBX servers


Assuming you have 2 FreePBX servers across two location that are connected via a trunk and the trunk dialling does work fine. Meaning you can already call SiteA and SiteB and vice-versa.
SiteA: Extensions 1000 and on
SiteB: Extensions 2000 and on
With the default IVR context in FreePBX it’s limited to local numbers only (in this case SiteA extensions). Imagine if you had a PRI line coming into Site A and the IVR direct dial would then need to reach extensions on Site B, this will by default will not work.
Here’s how to “extend” the IVR dialling to other locations. NOTE, we assume the outbound route doesn’t have a prefix to dial intersite between Site A or Site B.
1) nano /etc/asterisk/extensions_custom.conf
2) Enter the following codes (here’s Site A IVR trying to reach site B)
[from-did-direct-ivr-custom]
exten => _2XXX,1,ExecIf($["${BLKVM_OVERRIDE}" != ""]?Noop(Deleting: ${BLKVM_OVERRIDE}: ${DB_DELETE(${BLKVM_OVERRIDE})}))
exten => _2XXX,n,Set(__NODEST=)
exten => _2XXX,n,Goto(from-internal,${EXTEN},1)

#NOTE each line should start with exten like below, on single lines
image
3) Save the file and reload the dialplan
asterisk –rx “dialplan reload”
Lets say you use prefix 7 to dial site B from site A followed by the extension number. Just edit the part and as an example below;
exten => _2XXX,n,Goto(from-internal,7${EXTEN},1)
Where 7 prefixes automatically is entered before the extension number.
Have fun!

Sunday, July 31, 2011

The 4th Cloud Service? – VoIP As a Service (VaaS)


This weekend, i had a chance to present to Microsoft guests at their office here in Malaysia about cloud computing and focusing my talk on cloud technology security.
It was clear after a while jiving with those techies and seeing their responses and also doing much research, this concept, the relevant technologies wrapped around and more importantly, enjoying unwavering support from some of the big boys such as Google, Microsoft, Amazon, EMC, etc, one can easily deduce that the {{CLOUD}} is here to stay. This could mean a lot to consumers or business opportunists alike to ride on the wave (or as some may still insist, the hype)
In the weekend while on the treadmill at the local gym i started think about one particular service and of course being Astiostech’s core of 2 cores, Asterisk and VoIP and how it fits the 3 domains defined by the Cloud Security Alliance (CSA), and these are;
1) Software as a service
2) Platform as a service
3) Infrastructure as a service
Thinking about where would VoIP sit, it becomes quite clear to me after while that it doesn’t really belong to those categories (as far as I've understood them.) One would think it’s close to SaaS or Software as a service, but i beg to differ, Why?
1) VoIP is software in code, true, but its not offered as one, but rather a communication platform
2) Hosting VoIP is not the same as software, it breaks the boundaries of typical software running on computers and basically runs on IP phones rather.
3) It can connect to other software services to introduce Computer Telephony Integration or CTI to enrich one’s telephony experience but it in itself, isn’t one.
Hosted PBX isn’t something new. Astiostechtech has done so for almost 4 years now and rebranded it as e-fon ( www.efon.my ). We find such application of technology to be quite exciting then and over the years, seeing almost no downtime or complains, we are now convinced that it’s a technology and offering that could really change the way we do PBXes..
How has PBXes works for you currently and in the past.
image
Typically it was like the above diagram
1) Everything was at premise
2) Phones and servers communicated locally
3) Expansions were done as long as the PBX supports them
4) Most of the time, companies change their PBX when moving offices
5) Upgrades get done very sparingly as it can really blow a huge hole in the pocket
Lets talk about web servers and company websites, I can imagine almost all small and medium sized companies host their websites with local providers and do not host them internally. The reason why they host their websites is quite obvious, it’s because the service and support was there and it was just paying a very affordable monthly fee. This is closely tied to the economics of scale. They run operations of hundreds of servers and buy and rent stuff in bulk. Imagine a Hosted PBX like your Website server.
This elevates the need for running local servers, hiring experts to setup and run it and not to forget the cost of running and maintaining such infrastructure. Also to think about disaster recovery and business continuity, while, we businesses should be thinking about making money obviously, and not maintaining PBXes like we didn’t maintain our websites.
Now, imagine if the same like websites, were to be offered as a service to you in regards of telecommunications or simply, a hosted PBX instead of an on premise one.
image
Here’s a sample provider, like Astiostech (e-fon.my) can provide you. As an end user in a small and medium sized organization running your own onsite PBX is shortly becoming a thing of the past. Imagine again these infrastructures are now placed in cloud computing technology.
First and foremost; hosting outside your premise and into services like e-fon can help
1) Re-size on the fly
2) Gain mobility and do not lose your "favourite” phone numbers
3) It has all you need or even more than you can expect. (Economies of scale)
4) Its cheaper to have enterprise features, remember, the economies of scale! Make your organization sound like a multi-billion dollar setup (perception helps btw)
5) Connect to multiple types of Telcos that the PBX provider subscribes to and enjoy rates they enjoy as well
6) Connect to your other offices flawlessly if they use common protocols such as SIP or H323
7) Do not worry about upgrades as its done centrally
8) Use different types of phones or even free ones like softphones

Those you get with Hosted PBXes, i am sure or at least with e-fon you do. But here’s the kicker, with now cloud computing, e-fon gets hosted on cloud services. Not only you enjoy those highlighted list of benefits above, you also can enjoy that offered by putting stuff on cloud computing architecture such as;
1) Fabric on demand (CPU, disk, memory)
2) Auto and transparent redundancy
3) Strong network architecture and bandwidth
4) Probably more secure than if you ever had to put on premise
5) Ride on credible cloud providers for credible service offering

I can imagine in the next few years, this would be the “talk of town” per-se. Hosted PBX will be on just about all companies and hosting on premise even with a keyphone system isn’t attractive or make any sense anymore to business people. Just like how hosting websites took a while before just about all friends and companies i know in the small and medium category of companies have their websites with a provider or in a cloud alike.
From the Astiostechtech Engineering Office…

Tuesday, May 10, 2011

How to make FreePBX updates through Proxy

SInce FreePBX does not honour the proxy settings via the bash export, you need to tell Apache instead to use a proxy. This would apply for FreePBX as well.

Here’s a how to for Debians.

1) #nano  /etc/apache2/envvars

2) Add the following codes at the end. You will notice that there's repeats, sometimes they are needed so keep them there twice.

export ftp_proxy=http://10.50.19.206:8080
export http_proxy=http://10.50.19.206:8080
export FTP_PROXY=http://10.50.19.206:8080
export HTTP_PROXY=http://10.50.19.206:8080

3) #/etc/init.d/apache2 restart

Where 10.50.19.206 is the proxy server and 8080 is the proxy port, you can also insert an auth username like this for all instances above.

http://username:password@10.50.19.206:8080

Friday, April 15, 2011

Asterisk | FreePBX boss secretary module (updated)

In some of our migrations to Asterisk, users keep asking about this feature where the secretary can pickup calls from the boss using a function key in their phones that support them.

Here’s the challenge, the secretary asked us to setup in such a way that they can press this button and pickup their boss’s call. So, that was simple, in Asterisk core its just **<exten> e.g. **1003 and it will pickup 1003 and just program that in the feature code.

The problem was, they want to dial the boss using the same key. So, when you hit **1003 obviously it will not work cause that’s a pickup code being sent.

So here’s the solutions.

How it works? It does a check to see if the device state of the boss is RINGING, if yes, cool, we will pickup if not, we will do a dial. Simple Smile. Here’s the dialplan for Asterisk 1.6.2, see note below if using Asterisk 1.4 with ported DEVSTATE module. Also note that this dialplan is designed for four digits extension scheme. Modify yours accordingly, esp XXXX part …

Note the pickupchan module worked on asterisk 1.6.2. This is to pickup channels originating from other context (such as from-did-direct). Use the appropriate technology such as SIP/ IAX/ or SKINNY/ for instance to pickup that particular extension’s telephone technology.

Put this code up in /etc/asterisk/extensions_custom.conf.

[app-boss-sec]  
; Dialplan
;
exten => _*XXXX*,1,NoOp(Starting boss sec module)
exten => _*XXXX*,n,Macro(user-callerid,)
exten => _*XXXX*,n,Set(mydev=${DB(AMPUSER/${EXTEN:1:4}/device)})
exten => _*XXXX*,n,NoOp(mydev is = ${mydev})
exten => _*XXXX*,n,NoOp(SIP/${mydev} has state ${DEVICE_STATE(SIP/${mydev})})
exten => _*XXXX*,n,Set(MYDEVICESTATE=${DEVICE_STATE(SIP/${mydev})})
exten => _*XXXX*,n,NoOp(SIP/${mydev} has state ${MYDEVICESTATE})
;
exten => _*XXXX*,n,Gotoif($[${MYDEVICESTATE} = RINGING ]?pickup)
;
exten => _*XXXX*,n,NoOp(Just call)
exten => _*XXXX*,n,Goto(from-internal,${EXTEN:1:4},1)
exten => _*XXXX*,n,Hangup
;
; We do normal directed pickup
exten => _*XXXX*,n(pickup),NoOp(Pickup)
exten => _*XXXX*,n,Pickup(${EXTEN:1:4})
;
; Incase directed pickup don’t work, we do pickup group type pickup
; Make sure they are in the same pickup group..but of course

exten => _*XXXX*,n,PickupChan(SIP/${EXTEN:1:4})
exten => _*XXXX*,n,Hangup

In extensions_custom.conf, you must include this in your [from-internal-custom]. If you don’t have that context, create it like this. Remember to register the relevant BLFs so that the lights are blinking correctly. In this example, there are two bosses we will “monitor” 1003 and 1004.

[from-internal-custom]
; Register BLFs
exten => *1003*,hint,SIP/1003
exten => *1004*,hint,SIP/1004

include => app-boss-sec

Now, reload asterisk dialplan #asterisk –rx “dialplan reload”.

After reloading, check the hints if they are correctly registered. You should see Watchers 1 or as many as you’ve configured on the secretary's phone. To check,

#asterisk -rx "core show hints" | grep 1003

image

Now on your secretary’s phone, setup the function key (and if you have BLF, use BLF as the function) and enter the extension as *1003*. Now when boss’s 1003 rings, the BLF will blink, if he’s busy will indicate busy light and if he’s not will indicate free light (LED colours and style may vary from phone to phone). If the boss’s phone is ringing, the secretary picks up and if is not ringing state, it will simply do a dial to his extension.

If using Asterisk 1.4 change DEVICE_STATE in the dialplan above to DEVSTATE. Transferring calls are also fine when invoking *<exten>* through the function key or manually dialling.

Do try and let us know.

 

Monday, April 11, 2011

Asternic Stats Outbound Tracking with FreePBX

We at Astiostech use Asternic (www.asternic.biz) quite extensively for basic call centres that require a simple interface for wallboards, reports and recordings.
Asternic also provides some capabilities to monitor outbound callcenters where agents make random calls to introduce new services or businesses.
In this guide, i will attempt to setup outbound call center setup using Asternic and at the same time, show you how to enable recordings that play straight off the Asternic web UI.
This guide assumes the use of Asternic 1.8, FreePBX 2.x and Asterisk 1.6 on Debian systems. I also assume you’ve got all else working with Asternic like, the ioncube loaders, the license and the website is showing you like below;
If yes, great, login with admin and the default password admin.
image

PART 1 – ENABLING OUTBOUND MONITORING

1) Firstly, you must get a valid licensed and a 1.8 version of Asternic. Write to asternic@gmail.com and Nicolas will help you get those.
2) The way Asternic identifies if a particular someone is part of the outbound campaign is by looking for the accountcode value in SIP user as shown below in the FreePBX user configuration. In deviceuser mode, this would be the device, not user.
image
Here, i am creating an account code called C1 which is my outbound campaign 1. If you put things in perspective of an inbound this would then be a queue name. So all defined as C1 in their account code will then be agents of the queue C1. Simple as that right?
3) Next is to make some dialplan changes in FreePBX. There’s a file available from Asternic’s install source (/usr/src/asternic.source.dir/FreePBX/extensions_custom_asternic_outbound_freepbx.conf). Copy this file to /etc/asterisk. Now make sure the asterisk user owns this file since it was newly added.
Now edit it, and modify like below below.
IMPORTANT, THERE’S A SMALL OUTDATED LINE YOU NEED TO MODIFY. EDIT THE extensions_custom_asternic_outbound_freepbx.conf LIKE SHOWN BELOW; there’s one part which calls the mixmonitor dialplan, change the | pipes to , commas. Asterisk 1.4 and above will not accept pipes anymore.
exten => _X.,n,MixMonitor(${QDIALER_QUEUE}-${UNIQUEID}.wav|b|/usr/local/parselog/update_mix_mixmonitor.pl ${UNIQUEID} ${QDIALER_QUEUE}-${UNIQUEID}.wav)
change to
exten => _X.,n,MixMonitor(${QDIALER_QUEUE}-${UNIQUEID}.wav,b,/usr/local/parselog/update_mix_mixmonitor.pl ${UNIQUEID} ${QDIALER_QUEUE}-${UNIQUEID}.wav)
4) Edit /etc/asterisk/extensions_customs.conf and include the above file.
At the very top of extensions_customs.conf, add the line
#include extensions_custom_asternic_outbound_freepbx.conf
Now, if you have followed the INSTALL guide inside the binary archive. It will tell you to place a parselog into /usr/local/parselog/
Inside this directory, there’s an important perl file called update_mix_mixmonitor.pl which converts the WAV file to MP3 so that it can be played using the Asternic GUI (we will show you howto with that later). Make sure you edit this file.
edit /usr/local/parselog/update_mix_mixmonitor.pl
In there, make sure you
1) edit the database connection information, like the username and password particularly
2) edit the asterisk spool location (normally /var/spool/asterisk/monitor).
3) edit the destination dir (create one like /var/spool/asterisk/monitor-mp3)
4) Then go to the end of that file to the lame execution part (to convert WAV to MP3). Make sure the path to lame is correct.
Permission. Now pay attention to this!. Make sure you set the permissions correctly.
chown –R asterisk:asterisk /var/spool/asterisk/monitor
chown –R asterisk:asterisk /var/spool/asterisk/monitor-mp3
chown asterisk:asterisk /usr/local/bin/lame

Now, reload the dialplan, #asterisk –rx “dialplan reload”.
That should do the trick. Make sure you define the account code for the extension/device which need tracking and make that outbound call. Remember, these codes invoke dialout trunk prehook dialplan in FreePBX so internal calls won’t be tracked and if you have sip trunks and what not, make sure you set the correct context to those trunks. After making a couple of calls, you should see this;
image
Where C1 was my accountcode and Agent is my Outbound CID. I made some changes in the dialplan however to reflect the user/extension and not the Outbound CID. (email me if you need the codes for that)
image
As seen above, you can see the details of the calls being made by those in C1 “queue” or accountcode.

PART 2 – ENABLE WEB BASED CALL RECORDINGS FOR INBOUND

Now, as part of Asternic’s offering, you can rightfully with the above steps done properly, be able to see the recordings on the webUI. The only thing you need to do is add a value in the SETUP tab and look for the recordings_path parameter and set it to the destination directory as defined up there.
image
By using the above extra file called extensions_custom_asternic_outbound_freepbx.conf…. file by Asternic, all outbound calls with the accountcode defined will be recorded, of course, you can turn that off by commenting out the mixmonitor dialplan function but i am sure you would want to have that function for training and QA purposes right? Unlike the inbound Queues module in FreePBX, you can choose to record or not to record from the WebUI.
So, if all turns up well, you can see your recordings and play or download it straight from the Web! You need flash to play back by the way and use Firefox for best results.
image


At Astiostech, we do lots of customization of Asternic and call centre based solutions like Aheeva, Majuda that would suite just about any CallCenter types or sizes! Do write or calls us.
sales@astiostech.com
Or call us + 60 3 86892800

Sanjay W
From the engineering desk of Astiostech.

Saturday, March 12, 2011

FreePBX Device User Mode – Enforce login



I had responded to a thread on the FreePBX forum about how to restrict calling without a user first logging in on a device/user mode in FreePBX.
Here’s a simple dialplan which you can then use for your implementation. For FreePBX users, put these lines of codes in /etc/asterisk/extension_custom.conf
[devcheck]
exten => *11,1,Goto(from-internal,${EXTEN},1)
exten => *12,1,Goto(from-internal,${EXTEN},1)
exten => _.,1,Set(USEREXIST=$[${DB(DEVICE/${CALLERID(num)}/user)}])
exten => _.,n,GotoIf($[${USEREXIST}=none]?endit)
exten => _.,n,Goto(from-internal,${EXTEN},1)
exten => _.,n(endit),Playback(pbx-invalid)
exten => h,1,Hangup

Reload the dialplan asterisk –rx “dialplan reload”
Put this in each extension under context settings like below for each device in FreePBX UI.
image
Submit and apply.
At the end that context/dialplan, play anything you like in the Playback() macro. Here, you can record stuff like “You must first log in before making any calls”. I use the above one as a simple sample.
You can put in more exceptions like emergency numbers; besides the login and logoff feature codes in FreePBX at the top.
exten => 999,1,Goto(from-internal,${EXTEN},1)
Where 999 is our Malaysian emergency number.

Saturday, February 12, 2011

Google Voice extends free calls to US and Canada for whole of 2011


Google’s awesome quality Voice service which lets you make free calls to US and Canada is now extended to 2011. There was news that it will only be for 2010 ,but now, in their blog statement they offer this all the way through 2011. Use but don’t abuse.
http://googlevoiceblog.blogspot.com/2010/12/free-calling-in-gmail-extended-through.html