Blabla

Asterisk IPPBX and Nagios network monitoring solution consultants, implementer, training provider, integration with 3rd party systems, programming and support. Postings are provided as is without warranty of any kind what so ever.

Saturday, March 10, 2012

TechDay Asia - My Slides

TechDayAsia | TechDayAsia on FacebookTechday Asia 2012 During TechDay Asia 2012 (in Kuala Lumpur), i presented about Asterisk but more on a business pitch. The idea of the presentation is to let people know about how to start using Asterisk in various ways without changing much from the current setup you may have. Sort of like an integration.So, i gave a couple of scenarios and case studies from our years of requests by various customers. I wanted to share this to everyone out there who wants to get to know Asterisk and start using it without the hassle of a greenfield approach or complete makeover.TechDay-Asia - Sanjay
View more PowerPoint from sanjayws

And here's me presenting. And some pictures from TechDay which was a huge success. Spanning across three countries and cities.

Well done Intuit boys!




Asterisk / FreePBX limit incoming calls based on DID (on ZAP/Dahdi) with(out) FreePBX


This small article is intended to limit the number of incoming calls from that particular DID from PSTN using ZAP/DAHDI. The following dialplan can be integrated into FreePBX or run standalone if you like.
Steps in general
1) Setup the dialplan using a custom context and the DID to MAX channels and internal destination (normally an Extension)
2) Copy the SH (or AGI) script into Asterisk AGI directory
3) Setup a Custom Destination in FreePBX to hit the custom context above
4) Setup Inbound Routes to that Custom Destination
5) Test a call
NOTE:
-This is not to limit outbound calls, and that is normally do-able using FreePBX trunk settings already.
- Should work on Asterisk 1.6 or higher, Debian 4 or higher, FreePBX 2.5 or higher

1) Setup the dialplan through the use of extensions_custom.conf
# nano /etc/asterisk/extensions_custom.conf
Paste the following:

[destination-limits]
exten => s,1,NoOp(Define max channels and destination here)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323021"],Set,MAXCHANS=2)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323021"],Set,INTERNALDST=1003)
exten => s,n,Macro(call-limiter-routing,${MAXCHANS},${INTERNALDST})

[macro-call-limiter-routing]
exten => s,1,NoOp(Checking limits and routing to destinations)
exten => s,n,NoOp(The DID is ${CALLERID(dnid)})
exten => s,n,Set(MAXCHANNELS=${ARG1})
exten => s,n,Set(ACTUALCHANNELS=${SHELL(/var/lib/asterisk/agi-bin/check_chans.sh ${CALLERID(dnid)})});
exten => s,n,GotoIf($["${MAXCHANNELS}" = ""]?proceed)
exten => s,n,GotoIf($["${MAXCHANNELS}" >= "${ACTUALCHANNELS}"]?proceed)
exten => s,n,GotoIf($["${ACTUALCHANNELS}" > "${MAXCHANNELS}"]?hangup)
exten => s,n,Busy(5)
exten => s,n,Hangup()
exten => s,n(proceed),Goto(from-did-direct,${ARG2},1)
exten => s,n,Hangup()
exten => s,n(hangup),Busy(5)
exten => s,n,Hangup()
a) Edit the items in bold to match your own DID, this could be a 4 digit or whatever the telco sends to you.  Make sure you modify the DID, MAXCHANS and INTERNALDST values above.
b) If you want to limit more numbers, add those two lines with the ExecIf inside [destination-limits], like example below;
[destination-limits]
exten => s,1,NoOp(Define max channels and destination here)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323021"],Set,MAXCHANS=2)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323021"],Set,INTERNALDST=1003)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323022"],Set,MAXCHANS=5)
exten => s,n,ExecIf($["${CALLERID(dnid)}" = "230323022"],Set,INTERNALDST=1004)

exten => s,n,Macro(call-limiter-routing,${MAXCHANS},${INTERNALDST})
Save and exit.
Do a dialplan reload
# asterisk -rx “dialplan reload”
2) Add the the AGI/SH script into AsteriskAGI directory
# nano /var/lib/asterisk/agi-bin/check_chans.sh
Paste the following
#!/bin/bash
#
sanjay@intuit.my
didnum=$1
#
if [[ $didnum == "" ]]; then
        numofcalls=0
        exit 1
fi
#
asteriskbin=`/usr/bin/which asterisk`
checkzap=`/usr/bin/which zttool`
#
if [[ "$?" == "0" ]]; then
        technology="zap"
fi
#
checkdahdi=`/usr/bin/which dahdi_tool`
if [[ "$?" == "0" ]]; then
        technology="dahdi"
fi
#
countdids=`$asteriskbin -rx "$technology show channels" | grep -c $didnum`
if [[ "$countdids" == "0" ]]; then
        numofcalls=0
elif [[ "$countdids" != "0" ]]; then
        numofcalls=$countdids
fi
echo $numofcalls
exit 0
# chmod +x /var/lib/asterisk/agi-bin/check_chans.sh
The above assumes the agi directory is as shown above
# chown asterisk:asterisk /var/lib/asterisk/agi-bin/check_chans.sh
The above command assumes asterisk runs as user asterisk in group asterisk

3) Setup a Custom Destination in FreePBX to hit the custom context above
Get into FreePBX, click on Tools > Custom Destination
Add like the following
image
Submit Changes.
4) Setup Inbound Routes to that Custom Destination for each inbound route you wish to limit calls, but be sure to setup the variables above in item 1(b).
Click on Setup > Inbound Routes, add like the following
image
Above: Enter your DID number
image
image
Above: Shoot to the Custom Destination you just created to limit inbound calls
Submit then Apply Configuration.

5) Test a call. When you reach the limits, the call will end up with a busy tone in premedia state.

Rules can be changed by changing the GotoIf, currently
a) If the maximum channels are not set, it will assume no limit
b)  If the maximum channels is the same or more as the actually used channels, it will proceed with the call
b) If the maximum channels is lesser than then actual used channels, it will hangup
actual channels used = current number of channels used + this current call

Well, that’s it, should fine when using PRI or Analogs especially. Feel free to comment, change or improvise as needed.
Have a good weekend !
Sanjay

Friday, December 2, 2011

How to explain Nagios to grandma

So I visited grandma couple of days back and while talking about work and politics and all, she asked, so what’s this Nagios thing you guys are experts at?

I replied, its an “Enterprise Monitoring Solution” and she went like “Enterprise what now….”, and that actually got me thinking deep (something that i rarely do).

So anyway, to answer gramps pressing question, I gave this analogy.

 

Take for example a car

 

One thing cars these days come with are essential gauges to let us know what’s going on inside this technically complex electrical and mechanical marvel. This is called a dashboard.

So dashboards in a car gives us all these really cool information; and while cool, they’re also very essential for the well being and running of that car.

Most modern cars, you can tell the fuel levels, battery status, gear status, hand breaks statuses and what not. All essential right? And some more expensive cars like beamers, will even tell you that you’re due for a service soon!. Now, like many of us, the first thing I do when I power up my baby is to check this dashboard and see all that’s going on and when things are fine, engage gear, pull down that windscreen and breathe all the lovely smog from Kuala Lumpur air. {deep chesty cough x 2}

Now here’s where it gets difficult, lets take the challenge of watching over 10, or 100 or even 1000 cars all at the same time and to know at point in time and accuracy if one of these babies of yours isn’t behaving properly. While its possible to do one at a time but sometimes, it may be too late before you reach car no 99 to know that the battery has been completely discharged. Ouch!..can’t use that car until it gets fixed now… :-(

Fear not car lover, here’s where Nagios comes to play. It is designed in such a way, doesn’t matter which type of car you drive and how the dashboard works, if it is in that dashboard, we can take all the important status information and put them in an easy to use web page for all those cars you manage.

Not only that, when a car reaches a fuel level of less than 10% (or anything you think its important to know about before it goes bonkers), Nagios can..

a) email you
b) send you smses
c) call you
d) put up a message on facebook for you
e) set an appointment with you mechanic

And there ya go, she got it, and thereafter, she went back straight to her room to sleep. But I knew she understood, I do….

Now back in geek-land…

Imagine those cars as servers, devices, applications/software, virtual or cloud infrastructure and what not. Each of these in some small or elaborate way have their own “dashboards” that come in a form of a simple log entry to a popups on your device saying something is wrong and what not. Again, to manage just this one, perhaps its very fine. But imagine managing hundreds, on top of that, a single server can potentially host tens of important apps, making it alone “a lot” to monitor.

The cool thing about Nagios is, you can really literally monitor whatever that server/apps/device  shows you, no gimmicks no joke..Monitor just about any type of hardware, OS, application and of a bare minimum, a plain ole log file!

Give it a try and see the power of Nagios for yourself.

Happy weekend.

Thursday, December 1, 2011

Celebrity Top 7 Asterisk Related Products & Solutions

Asterisk, the world leading Open Source complete IPPBX based system has got the world talking. With thousands of features and growing at an almost exponential rate, it comes as no surprise, it is widely used everywhere you can put your finger on that Atlas…like in organizations, government bodies, NGOs, schools, universities and just about all open source and IPPBX enthusiasts out there. Here’s some of the top apps and solutions chosen by your friendly and techy celebs for you to understand types of solutions and products Asterisk can have. These are merely a tiny number, but are game changing and significantly changing the world of PBXes even as we read this! Enjoy!


FreePBX
FreePBX yo is my first application around Asterisk systems that comes to mind. I mean, compared to my old PBX, I’d pay a couple of hundreds of bucks just to create a new voicemail. With FreePBX, I just pop open my laptop and browser and I’m done in a few seconds. Seriously, hundreds of features, modules and applications, this is the ultimate tool to provision, manage and maintaining my Asterisk box at home.

Will Smith
Digium Hardware
My vote is Digium cards, hands down. Takes mere minutes to set up and I’ve got PRI and analog connections through plug and play. I setup a whole Asterisk system with just a small guide and got it up and running in less than 2 hours. Now the entire office uses it and we’ve had no problems for over 4 years and counting. Loving it…

Will Farrell
AvantFax
Wo, you got me a tough one, they all are fine pieces of work but if you put a schioppi on me, I’d put my money on Avantfax. Faxing through Asterisk and free. Can’t get any better, with its intuitive web UI and easy to use inbound and outbound faxing, saving my peeps money,….{deep intake of cigarette} this is the stuff I tell ya!

Al-Pacino
DRBD & Heartbeat
Thanks darlin’ for asking. I have to go with DRBD and Heartbeat, yep. With my busy schedule and appointments made through Asterisk Voicemails, I cannot afford downtime. I’d say setup an Asterisk cluster just like that with DRBD and Heartbeat with just about any type of standard off the shelf hardware, you’ve got a maintenance free, robust and frisky quick redundant and resilient PBX system!. Love <3

Your Foxy gal. xxx
Majuda
Yes yes I invented it all but heck I couldn’t figure out call recording and how to make that work. Now with Majuda Enterprise Call Recording and Quality Management, I’ve got the whole call center under my watchful and hairy ears. No more hanky panky and its all serious business. Extremely cost effective, complies with full regulatory requirements, easy to use Web UI and works straight off with Asterisk. You heard me dawg!…you got pw0ned!

Alexander Graham Bell (The)
BigBlueButton
Well I’d be dammed if no one put em BigBlueButton conferencing solution up here {spits tobacco}. Best conferencing for free integrated straight into Asterisk, nuff said, now get my some hamburgers!




Willie Nelson
OpenFire IM
I’m gonna go with OpenFire IM server. Keeps me connected through chat and voice through Asterisk with all my {nerdy} friends. It’s free, sets up in mere minutes and works with just about all Jabber clients (and a flash based web one). Managing this solution is a piece of cake, all through the WebUI, click and kapawww!! …done.


Daniel Radcliff (if you don’t know who he is and yes, its okay you’re normal, he’s the Harry Potter fella)
   
Disclaimer:
In no related or unrelated ways is this opinions or views of these awesome artists and celebrities, they are all made for fiction and for fun. These also do not represent Intuittech’s opinions or views on products and its merely preferences and for the purpose of education and information dissemination by the author for fun sake. Please don’t sue me, im not rich. Thanks.

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 sales@intuit.my. 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: <0320355803>
MaxRetries: 0
RetryTime: 1
WaitTime: 10
Context: from-internal
Extension: 20355800
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 / Exten Defined"
    exit 2
fi

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

# get user/device
#
getdev=`/usr/sbin/asterisk -rx "database show" | grep $user | grep device | awk {'print $3'}`


# 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/2000@from-internal/n
CallerID: <0320355803>
MaxRetries: 0
RetryTime: 1
WaitTime: 10
Context: from-internal
Extension: 20355800
Priority: 1
Archive: no
Set: AMPUSER=2000" > /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 920355800 (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. 920355800, 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)

Green Telephone Clip Art

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 Intuit’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. Intuittech 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 Intuit (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 Intuittech 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

Tuesday, May 3, 2011

Intuit techday–Report

28 April 2011 – Securities Commissions, Kuala Lumpur.

An unprecedented turnout of over 400 people attended Intuit’s techday held in the Securities Commission, Kuala Lumpur, Malaysia. The event keynote speakers Mark Spencer and Ethan Galstad, creators of Asterisk and Nagios respectively via a video call joined in for half an hour and updated us with what’s installed for us in both platforms.

We also had the CEO of MDeC and the special operations unit of the Prime Minister’s department.

Other distinguished speakers and exhibitors.

From here, i let the pictures do the talking. Enjoy and thanks for everyone’s participation and help.

Friday, April 15, 2011

Intuittech Technology Day 2011

(from Daniel’s blog)

Yes, in a little over a month we will host the first ever Intuittech Technology day here in Kuala Lumpur, Malaysia.

We are excited that we could get 12 sponsors on-board helping us to make this possible.

The sponsors are:

Aheeva
Allied Telesys
Avnet
Digium
JCMEX
Microtel
Nagios
Netregy
P1
Polycom
Skali
Vino Group

We are specially proud that Mark (founder of asterisk) and Ethan (founder of Nagios) will start the event with their respective keynote speeches via live video conference call.
The right time for you to ask questions!

Datuk Dr. Kamal Jit Singh (CEO UIK, Prime Ministers Office) and Datuk Badlisham Ghazali (CEO MDeC) will for sure give us some interesting insights into the goverments ICT and specially open source plans!

During the day we will have 2 tracks with over 15 speakers in total.
The detailed plan should be ready in the next couple of days.

Please book this day and be ready for a great day, with lots of interesting people
and presentations.

The only thing you need to bring is you, we take care of the rest (food, drinks and parking).

And yes it's free of charge! Just sign up and show-up!
See you soon.

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 Intuit 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

If you wish to know how to enable the recordings and to call the mixmonitor script from Asternic for inbound, you can follow the guide from Daniel here

At Intuit, 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.

..support[[[atttt@]]]intuit.my

Or call us + 60 3 20355800

 

Sanjay W
From the engineering desk of Intuit.

Thursday, March 24, 2011

Cisco SIP IP Phone corporate directory integrated into FreePBX

Back sometime we wrote a guide on how to dynamically read and display searchable directory information straight out of a Yealink phone here.

Currently, we have a customer that migrated from Cisco Callmanager to Asterisk! (YAY) and a little bit of research with my colleague Wan Azwin, we managed to use the same concept on Yealink with Cisco phones. Most of the phones work except for 7912 which we are still figuring out how to even set the directory information. We must say that Cisco product ranges have so many variations in their formats it’s just a nightmare to figure them out sometimes. Also, if you need how-tos for to convert Cisco phones, try this link.

Here, we take this functionality and add it to the FreePBX directory meaning, it is truly realtime to the adding and removal of users in FreePBX as it uses the asterisk.users directory in FreePBX MySQL table.

Test on:

1) FreePBX 2.x

2) Debian 5

3) Apache 2 with PHP support

NOTE: If the codes appear truncated, simply copy the whole table and paste into a text editor

Features

  • Wildcard searching capability using backend PHP engine
  • Searches directly from FreePBX no need to maintain separate DB/files, thus making it dynamic
  • Some security tips plus Database access is limited with very low privileges for the user that connects to FreePBX / MySQL
  • May work for just about any type of phones that support the search function

Security Notice
Do not allow this file to be exposed in the public domain it can disclose your corporate directory and users/people

- Enforce ACL on this website/page so that only internal users can enumerate
- Try to use a complex name for the php file so that it’s difficult for someone to guess it.

Assumptions/notes:
1) You have a running apache server which support PHP5 and does not force SSL on virtual directories
2) Apache runs as asterisk in group asterisk
3) There's no other service listening on port 80
4) Use freepbx asterisk database with users table found (default)
5) Using IP 10.10.10.1 as example web server
6) Using SIP based firmware on Cisco

IMPORTANT: YOU MUST USE NON SSL BASED WEBSITE AS THE PHONES MAY NOT KNOW HOW TO INTERPRET SSL TRANSACTIONS

We will use a very low privileged user for this requests.

Create DB user with very low privileges (change the username and password accordingly to connect to your MySQL box, here, its a local box). This below is give access to the database asterisk, table user and column name. Change the passwords accordingly ..first one for connecting to your DB and the second for the new user called “directory” that you are allowing access to the table users and extensions respectively in the database asterisk (freepbx defaults).

At the command prompt run:

mysql -h localhost -u root -ppassword  mysql --execute="GRANT SELECT (name) ON asterisk.users TO directory@localhost IDENTIFIED BY p@ssword1';"

mysql -h localhost -u root -ppassword  mysql --execute="GRANT SELECT (extension) ON asterisk.users TO directory@localhost IDENTIFIED BY 'p@ssword1';"

mysql -h localhost -u root -ppassword mysql --execute="flush privileges;"

Basically, now you need to create the menu files and the search file. You will now create:

1) menu.xml
2) menu2.xml
3) search.php

Assuming your webroot is in /var/www/

mkdir /var/www/ciscodir

nano menu.xml

Paste the following into menu.xml

<CiscoIPPhoneMenu>
  <Prompt>Intuittech Sdn Bhd</Prompt>
  <MenuItem>
    <Name>Search for a person..</Name>
    <URL>http://10.10.10.1/ciscodir/menu2.xml</URL>
  </MenuItem>
</CiscoIPPhoneMenu>

nano menu2.xml

Paste the following into menu2.xml

<CiscoIPPhoneInput>
  <Title>Intuittech Sdn Bhd</Title>
  <Prompt>Enter The Search Criteria</Prompt>
  <URL>http://10.10.10.1/ciscodir/search.php</URL>

  <InputItem>
    <DisplayName>Enter Name</DisplayName>
    <QueryStringParam>sn</QueryStringParam>
    <InputFlags>U</InputFlags>
  </InputItem>

</CiscoIPPhoneInput>

nano search.php

Paste the following into search.php. BE SURE TO CHANGE THE

1) $URL
2) Username and Password in $mysql_conn which you created in the mysql command line above

<?
header ("content-type: text/xml");
// Created by Intuit
// with credit to JOYCE CR, s.r.o. http://www.joyce.cz/produkt-soubory/searching_remote_phonebook_manual.pdf
// Make sure you configure the allowable settings only
// This script directly integrates with FreePBX and picksup the asterisk.users table
// Should work for both device-user mode or extensions mode
// Works by searching from anywhere of the person's name
// feedback to sanjay@intuit.my

// Change here to match the webaddress absolute path
$URL = 'http://10.10.10.1/ciscodir/';

// Choose how many results to return if search term produces a lot of output
$per_page = '100';

// Change here to match your own passwords
$mysql_conn = mysql_connect('localhost', 'directory', 'p@ssword1');

// Dont change anything from here unless you know what you are doing
mysql_select_db('asterisk', $mysql_conn );

$NAME=$_GET["sn"];
$FROM=$_GET["FROM"];
$TO=$_GET["TO"];
if ( ($FROM=='') and ($TO=='') )
{
   //check to see how many
   $result= mysql_query("SELECT count(users.name) as total
                         FROM users
                         WHERE users.name LIKE '%$NAME%' ", $mysql_conn);
   $howmany = mysql_fetch_row($result);

   if ($howmany[0] > $per_page)
   {
    $start = 0;
    $index = 0;
    $total = $howmany[0];
    $remain = $per_page;
    print("\n");
    print("<CiscoIPPhoneDirectory>\n"); 
  
    while ($start < ($total + 1))
    {
      $limitstart = 'LIMIT '.$start.','.$per_page;
      $result = mysql_query("SELECT name,extension
                             FROM users
                             WHERE name LIKE '%$NAME%' ORDER BY name $limitstart", $mysql_conn);

      $row = mysql_fetch_row($result);
      $from = $row[0];
      if (($total - $start) < $per_page) { $remain = $total - $start; }
      for ($i = 1; $i < $remain; ++$i) { $row = mysql_fetch_row($result); }
      $to = $row[0];
   
      print("<SoftKeyItem>\n");
      print("\t<Name>");
      print($index);
      print("</Name>\n");
      print("\t<URL>");
      print($URL."search.php?FROM=".$from."&TO=".$to);
      print("</URL>\n");
      print("</SoftKeyItem>\n");

      $start = $start + $per_page;
      $index = $index+1;


    }
    print("</CiscoIPPhoneDirectory>\n");

   } else {
$result = mysql_query("SELECT name,extension,extension
                           FROM users
                           WHERE users.name LIKE '%$NAME%'
                           ORDER BY name ", $mysql_conn);

    print("\n");
    print("<CiscoIPPhoneDirectory>\n"); 
    while($row = mysql_fetch_row($result))
    {
     
     

      print("<DirectoryEntry>\n");
      print("\t<Name>");
      print($row[0]."- ".$row[1] );

      print("</Name>\n");
      print("\t<Telephone>");
      print($row[2]);
      print("</Telephone>\n");
      print("</DirectoryEntry>\n");
    }
    print("</CiscoIPPhoneDirectory>\n");
   }
  
  

} else {

  $result = mysql_query("SELECT name,extension,extension
                         FROM users
                         WHERE name>='$FROM' AND name<='$TO'
                         ORDER BY name", $mysql_conn);

   print("\n");
   print("<CiscoIPPhoneDirectory>\n");
   print("<Title>Intuittech Directory</Title>\n");
   print("<Prompt>Intuittech Directory</Prompt>\n");
  
   while($row = mysql_fetch_row($result))
   {
     print("<DirectoryEntry>\n");
     print("\t<Name>");
     print($row[0]."- ".$row[1] );
     print("</Name>\n");
     print("\t<Telephone>");
     print($row[2]);
     print("</Telephone>\n");
     print("</DirectoryEntry>\n");
   }
   print("</CiscoIPPhoneDirectory>\n");
}


?>

Save and close. Give proper permissions to the file

chown asterisk:asterisk /var/www/ciscodir/search.php

Try on browser, assuming a user Sanjay is being searched for, you can also use ja, nj, as long as it's within the correct sequence

http://10.10.10.1/ciscodir/search.php?sn=san

Also, do ensure your webserver interprets .xml files as text by modifying the mime types. In apache, this is done by editing the /etc/mime.types file. Add an entry

text/xml                                   xml

Finally, edit your SEP<MACADDRESS>.cnf.xml, look for directory info and set it to menu.xml, this is an example for Cisco 7941

<directoryURL>http://10.10.10.1/ciscodir/menu.xml</directoryURL>

Restart the phone.

If you need help, please contact us sanjay@intuit.my and azwin@intuit.my

Good night!