Monday, August 30, 2010

Free Outlook/Windows Dialer For Astrisk

I have been using Asterisk as the PBX for my business and I am a big fan.
I am not a Guru by any means but I was able to get it to do what I need so far so I am pretty happy with the technology.

I am very bad with reading and dialing numbers - not sure why that is but If I try to manualy dial a phone number, especially one I don't usualy dial I have a success rate of about 60%.
Since most of the phone numbers I use are in outlook or in Windows somewhere I thought it would be great if I can have a "Click To Dial" button on my computer or something similar to that feature. It took a while to research and through different forum posts I found out there is such a plug in that is free from a company called ThirdLane. In order to obtain this dialer you need to register and it is available foor download.

Note to readers - after my inital post I found a different product which I like better because it has more features under Asterisk. The product is called Outcall from Bicom systems. Free and Open Source available: http://www.bicomsystems.com/

I left the inital instructions.

The instructions I saw on the site were not very clear so I figured I would document the process a little better.

Installing the dialer:
Go to http://www.thirdlane.com/ select download, register if needed and download the dialer.
After you install the product you will have a small window on the right top corner of the desktop.
Because the dialer is not registered with Asterisk it will be red.






Configuring Asterisk
In order to allow the dialer to speak to asterisk you will need to edit a single configuration file.
The file to be edited is in /etc/asterisk/manager_custom.conf. It might be somewhere else in your system.



If you are using Windows like I do - you can use WinSCP to connect and edit the file.



We will add a new section to the file, detailing a username, passord and permissions. These permissions will allow the dialer to log in to the Asterisk Manager Interface and originate the calls for you:







.








The text will look something like:

[outlook]

secret = PASSWORD

deny=0.0.0.0/0.0.0.0

permit=192.168.XXX.XXX/255.255.255.XXX

read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate

write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate





You will need to change the following:
Set username:
The part that says [outlook] specifies the username so you can make it anything you want. Don't use admin or any of the other ones specified in previous sections on the page
Set Password:
The word PASSWORD in this sample (the value for secret) should be replaced by a password that you assign and note for yourself.
Set IP ACL:
The permit keyword lists the IP address and netmask for the addresses that the username is allowed to connect. For example, if you use the adress range 192.168.0.1-192.168.0.254 in your network and want to allow access to any computer on that network you would specify:
192.168.0.1/255.255.255.0 if you only want ip address 192.168.5.9 to access you would specify:192.168.5.9/255.255.255.255.
If you want to specify multiple ranges, you can add additional lines.

Apply Settings
The next step is to apply the settings - log on to an Asterisk Console.
(I do this using putty to ssh my asterisk computer).
Once logged in type the following:


asterisk -r


And hit enter
Once logged in


reload





You can keep this window open to see how things progress.





Configuring the dialer
Next step is to configure the dialer. Right Click the dialer (anywhere in the red zone) in windows and select Options. Click on the Connection tab.
You will see the following window:






The settings to edit:

Connection Type: Asterisk Manager Interface
Host: the IP address of the Asterisk server
Port: Default is 5038
Manager User:This is the username from before
Manager Password: The password from before
My Phone (Channel):This is the channel that the calls will be transfered to - for example, if you have a SIP extension number 200 you would fill it with SIP/200. When you click the call button the call will be initiated and you phone will ring.
Context:The appropriate Asterisk Context, in Elastix and TrixBox this is "from-internal"

Click OK and wait a few seconds.
If everything was alright - the dialer box will turn green.

Testing/troubleshooting:
In order to test this you can simply try to place a call. using the dialer. If you are running into problems do the following:
Go back to your console window and type:


core set verbose 999

and hit enter
And try to place a call.
You can look in the console window and see what is going on.
If you see something like:


== Connect attempt from '192.168.xxx.xxx' unable to authenticate



It means your username and password are worong.



You can

This tuturial was done on Elastix 2.01, Outlook 2007 and Windows 7



Happy Dialing!

Wednesday, May 5, 2010

Parsing Search Terms from URL in SQL Server

I often have the save the referrer URL for sites I work on to see where the visitors are coming from.
I needed a quick way to figure out what were people searching when they came from a search engine.
Most search engines will have the search term in the query string as q=search+term it could be in the middle, end or beginning of the query string.
I created a quick UDF to parse these and return the search term:

CREATE FUNCTION fnGetSearchTerms (@MyUrl nvarchar(1000))
RETURNS VARCHAR(500)
AS
BEGIN

DECLARE @idx int --Index of the search term
DECLARE @iex int --Index of the seperator after the search term

SET @idx =1

--Return value
DECLARE @Ret varchar(500)

WHILE ((SUBSTRING(@MyUrl,@idx,3)!='&q=') AND (SUBSTRING(@MyUrl,@idx,3)!='?q=') ) AND @idx < LEN(@MyUrl)
BEGIN
SET @idx = @idx+1
END

IF ((SUBSTRING(@MyUrl,@idx,3)='&q=') OR (SUBSTRING(@MyUrl,@idx,3)='?q=') )
BEGIN

SET @idx=@idx+3
SET @iex=Charindex('&',@MyUrl,@idx+3)
if @iex=0
BEGIN
SET @iex = LEN(@MyUrl)+1
END

SET @Ret=SUBSTRING(@MyUrl, @idx, @iex-@idx)

END
SET @Ret=REPLACE(@Ret,'+',' ')

RETURN @Ret

END
go

Quick and simple



Friday, April 23, 2010

Free downloads every programmer needs

So everyone has a go to list of favorite programs/util that go on your machine as soon as it is setup - these are mine:
Putty - your ssh telnet machine to log into your various unix/linux/asterisk boxes
Winscp - moving files in and out of your various unix/linux boxes and the occasional editing
Wink - create annotated screen captures and tuturials quickly
Notepad++ - Quick and dirty text/code editor on steriods
IrfanView - Resize and manipulate images, change format, compress etc.
WinMerge - Find differences between files and directories and merge versions of the same file
WinDirStat - graphic representation of hard drive usage
Audacity- A great sound editor