The blog of Michael Rice

7/15/2008

Asterisk Dual Servers with SIP

Filed under: Linux, asterisk, freepbx, phones — errr @ 9:06 am

I have found about a million articles on the net for connecting 2 asterisk boxes using IAX2. What I have not found is many describing how to do this with SIP, so thats what Im going to talk about. Now since I am a FreePBX user I am going to talk about how to do this using the FreePBX web GUI. You can use this method if you use TrixBox, or Elastix, or PBX In A Flash, or if you just use FreePBX with your own distro.

I have 2 systems. To make this simple Im going to call them pbx1 (which for this example is in San Antonio) and pbx2 (which we will pretend is in our Houston office). First we need to log into the web interface on pbx1 and then get to the section where you configure trunks. Click Add SIP Trunk. Im not going to mess with any of the General Settings, or the Dial Rules. I am going to go straight to the Outgoing Rules. In trunk name Im going to call this trunk-hou-peer. Next I jump into the PEER Details box. I put the following into the box:

context=from-internal
host=pbx2.mhipriv.com
secret=strong_password
type=peer
username=trunk-sa-peer

Next, Remove all the settings from the Incoming Section. Hit submit, and then apply the changes.

Next we need to log on the web gui for pbx2. Now we are going to go from Houston back to San Antonio with this trunk. We need to add a new SIP trunk here. Follow the same steps as before, but now name this trunk: trunk-sa-peer You may notice that the name of this trunk is the username we used in the peer details on pbx1. Now in the Peer details on pbx2 add the following:

context=from-internal
host=pbx1.mhipriv.com
secret=strong_password
type=peer
username=trunk-hou-peer

Now you will notice that the username on this peer is what we named our trunk on pbx1. The context used in both is the same. This will give you access from pbx2 to dial an extension that is on pbx1 and vise versa. Now all we need to do is submit this and apply the changes.

Next all we need to do is create an outbound route to use our new trunk. For the sake of keeping it super simple lets assume you have extension 100-199 on pbx1 and 200-299 on pbx2. We need to go to the outbound route section and create a route on pbx1, name it toHouston and it needs a dial pattern that looks like this:

2XX

Click on the Intra Company Route. Then select our Houston trunk. Next submit and apply changes. Now head over to the pbx2 web gui and do the same steps only name this route toSanAntonio and for its dial pattern use:

1XX

Click Intra Company Route select the San Antonio Trunk, hit submit and apply. Now from extension 100 in San Antonio dial 200 and bamo thats it. You can take this a step further and even do toll-by-pass now.

7/10/2008

The best course is to answer No and try again later.

Filed under: Linux, openldap, samba — errr @ 10:28 am

I have been working on a Domain Controller at work using Samba 3.0.28 and openLDAP. I was trying to setup my windows client computers to login then map some drives from various other samba servers we have. My logon.bat file looked like this:

@echo off
REM # SYNC THE TIME WITH THE SERVER
net time \\pdc01.mhipriv.com /set /y
REM # DELETE ALL MAPPED DRIVES
net use h: /delete
net use h: “\\pdc01.mhipriv.com\homes”
net use g: /delete
net use g: “\\server.mhipriv.com\apps”

This was working but causing some weird issues when you would log in from a windows client. I would get this error on windows that said:

There are open files and/or incomplete directory searches pending on the connection to pdc01.mhipriv.com

So I went over to microsoft google and did a search for the error. #1 google result led me here So I am reading and sure enough this is my problem. So then on to the answer.. WTF!!! You mean seriously you want me to wait and try it again.. Im thinking to my self “You have to be fu**ing kidding me” So I wait, and wait, and wait, and then went home for the day and then today I try again and still the same shit. So I decided to find the real solution. What happened is that in my smb.conf I set the logon drive = H: so samba was already mapping it for me and then I was trying to /delete it and then remap it, and somewhere in that process was the problem. All you really need to do is either set

logon drive =

Because the default drive is Z:\ if its not set, or

logon script = logon.bat
logon path = \\%L\PROFILES\%U
logon drive = H:
logon home = \\%L\%U

And make sure your logon.bat looks like this

@echo off
REM # SYNC THE TIME WITH THE SERVER
net time \\pdc01.mhipriv.com /set /y
net use g: /delete
net use g: “\\server.mhipriv.com\apps”

I hope someone out there finds this more useful than the “The best course is to answer No and try again later.” crap answer I found on the M$ site.

7/1/2008

My New Cell Phone - Nokia n95 8GB

Filed under: Linux, amarok, asterisk — errr @ 10:53 am

Yeah, hate me.. I got one. Its so freakin awesome. here are a few things that really kick ass so far about this phone:

  • I am able to sync music to the phone via amarok using Linux
  • I am able to browse the web using WIFI or my 3g data service.
  • I have configured my n95 as a sip client and have it registered with my Asterisk server.
  • The phone supports mobile bar codes
  • The camera takes WONDERFUL pictures. The quality is very high!! And you can export them directly to flickr!!
  • The phone takes really great video
  • Did I mention I didnt need windows to add music to this thing??

Im sure there are other really great things about this phone too but I have only had it a couple days so I havent had time to check all the features out yet.

5/13/2007

Centralized Voicemail server for multiple Asterisk systems using FreePBX and IAX2

Filed under: Linux, Trixbox, asterisk, phones — errr @ 10:18 am

Well I never really finished up my asterisk tips posts… I’m lazy and most of the free time I do have I dont like to spend on the computer anymore (what can I say). Im going to make it up to you though by sharing with you how to make a very slick asterisk setup.

So why would anyone want to have a stand alone voicemail server anyway?? Well thats pretty simple. Lets pretend you have a small to medium sized company. Maybe 100-500 employees, maybe more maybe less… You have 3 or 4 office locations, they span several cities or maybe even other states.. It doesnt really matter where they are. The important thing is that they all need to be connected. You need to be able to call from one office to another, and at times you will even need to forward voicemails from one location to another. Asterisk does not just automaticly support this. Even if you have routes in place that make it so you can call each person on your network with a SIP call if their voicemail box isnt on the same server as yours you cant forward them a message. This can become a big problem real fast. Infact at our company we were considering not using asterisk because of this. The good news is that its really simple to do.

First off Im not going to cover how to connect the multiple servers. This has been articled to friggin death. Its covered on many sites, one of them not being this one. Next Im going to assume you have figured out how to make connections from 1 asterisk system to another using IAX2. If not please check out this guide. It works great.

Now on to the fun stuff. I used FreePBX on our 3 PBX servers to get our dial plan setup and have a nice easy to manage user interface. I kept thinking that this would keep me from being able to customize my dial plan like i needed to but I was all wrong about that. Im now going to point you over to the guide I followed: Click me!!!

This guide is fairly good. It doesnt cover doing it with FreePBX though. If you use FreePBX you may have found that if you edit one of its config files you lost your changes once you entered the gui, or made an update to FreePBX. I went to the IRC and asked how to get around this. It was simple, at the top of the config files you see a line that says #include somefile_custom.conf All you have to do is edit that custom.conf file and over ride the context you need to edit. So if you have in your sip.conf file a [foo] context you go to sip_custom.conf and make [foo] in there and then the settings for the [foo] context from your sip_custom.conf file will be whats used instead of the [foo] from sip.conf

In the article I asked you to click to see how to do the setup it said you needed to edit a macro in extensions.conf. The context you need to edit is called [macro-vm] First what I did was copy and pasted the [macro-vm] context from extensions.conf and pasted it into extensions_custom.conf then I edited the following:

; over riding the below for our central voicemail server
exten => s-BUSY,n,Dial(IAX2/toVMail/b${ARG1})
exten => s-BUSY,n,Goto(exit-${VMSTATUS},1)

exten => s-DIRECTDIAL,1,NoOp(DIRECTDIAL voicemail)
exten => s-DIRECTDIAL,n,Macro(get-vmcontext,${ARG1})
; over riding the below for our central voicemail server
exten => s-DIRECTDIAL,n,Dial(IAX2/toVMail/${ARG1})
exten => s-DIRECTDIAL,n,Goto(exit-${VMSTATUS},1)

From there I just followed the rest of the guide the other nice fellow provided and saved my settings, then setup a plain jane asterisk server for my voicemail server. I didnt use FreePBX on it at all. Managing that server is braindead simple so I didnt see the need. I hope this little tidbit will help others out there who have to set this up.

3/15/2007

Asterisk tips #1

Filed under: Fedora, Linux, asterisk — errr @ 9:45 am

I have been building an asterisk system at work for testing stuff. I started with a Fedora Core 6 box and then installed asterisk from source. Since we will be using a PRI we had to buy a T-1 card. We decided to go with sangoma. For our testing purpose we just got an A102. I installed the card and then went to the sangoma site for the latest wanpipe drivers. After installing them and setting up my zaptel.conf and zapata.conf I found nothing worked. I found out I needed to compile the wanpipe stuff first, and install zaptel from source instead of using the Fedora RPM because the wanpipe package needs to patch the zaptel stuff. Once I finished this and loaded the wanpipe modules and loaded ztdummy and then rebuilt asterisk I had a working sangoma card. I started with a very very basic config for asterisk. I just wanted to have 2 extensions and make them able to call each other using SIP, then I wanted to take 2 of the DID’s provided to me by our phone company and have them ring into the extensions. The SIP part of this was just plain simple. Here is what my sip.conf looks like for asterisk.

[231]
;Test Guy1
type=friend
username=231
secret=231
host=dynamic
context=local_test

[205]
;Test Guy2
type=friend
username=205
host=dynamic
context=local_test

The important thing to note here is the context=local_test Next to get this working completely we need a very basic extension.conf file. Mine looks like this:

; SIP extensions
[local_test]
;Test Guy1
exten => 231,1,Dial(SIP/231)
;Test Guy2
exten => 205,1,Dial(SIP/205,10)
exten => 205,2,PlayBack(vm-goodbye)
exten => 205,3,HangUp()

Thats it, this simple example will now make it so from 231 we can dial 205 then if after 10 seconds we dont answer the phone system will automaticly pick up and play the message vm-goodbye.gsm and then hangup the phone. Remember I said to note the context=local_test Well in our extensions.conf file if we had named our context block something else it wouldnt have worked because the context wouldnt have matched. You can name your context blocks what ever you want, but keep in mind they must match or nothing will work.

Now we need to expand on this just a little bit to get our calls from the outside to ring in. I will cover that later today or Friday. Its very simple so check back soon for the tip.

1/19/2007

The end of week 1

Filed under: Fedora, Linux, Nintendo, Wii, freebsd, life — errr @ 8:52 pm

Im still alive, and I still have a job. This job is really sweet. We use a lot of FreeBSD at work. We do use a little bit of linux, and I managed to get though a whole week using Fedora for my desktop. Im looking forward to a project I have been handed. I have to complete a pretty large router setup. It will all be run on some form of FreeBSD. Its a very challenging project that will test my abilities very well.I setup a wiki at work using media wiki. Its going to be for internal use only but will be used to document the router I am building, as well as most other aspects of my job and any one elses job who cares to document how to preform their job. I really like the people I work with, they are very sharp and I will be able to learn a whole lot from them.

This week has been really cold here in San Antonio. We had a hard freeze a couple days in a row and lots of places lost power (thankfully not me). I have found an H-E-B on just about every street corner. From my apartment there is like 2 in what I consider to be walking distance… I have looked around while I have been out driving around lost for other stores that we had in Odessa but I have not found anything other than WalMart. I guess H-E-B has run everyone else out of town… I really like the people I have met so far, although I havent met anyone out side of work… I pretty much stay home and play nintendo wii most of the time anyway. I joined a gym called anytime fitness. They are a 24hr gym. I like this because sometimes when I cant sleep the thing that will make me tired is tossing around some heavy weights or running a mile or so on the cross trainer. Im missing my little girl April very much and I wish she were able to be here…

12/14/2006

Conky now in Fedora Extras

Filed under: Fedora, Linux, packages — errr @ 9:18 pm

After nearly 3 months, maybe more, conky has been approved and I have commited it to CVS today A huge thanks goes out to the conky development team for adding countless legal fixes, and even some major fixes to the code to get it included in fedora. Im not planning on making a Fedora Core 5 Branch because when I last checked there was some missing deps and I dont feel like maintaing seperate spec files. I will however be willing to do so if enough people ask for it. If you are one of these people who would like to have it in FC5 please file a bug report on bugzilla about it.

12/3/2006

Compaq Presario 15.4″ Widescreen Notebook PC (V6120US) CPQ V6120US + Linux == Success!!

Filed under: Fedora, Linux, compaq, fluxbox, google, laptop — errr @ 12:38 am

Well I posted about the hardships I had trying to get linux installed on my new laptop the other day. I would just like to sy that I now have everything working, and even have the nvidia drivers working on my video for the 3d functionality. Here is what I did to fix:

linux noapic

I stuck in my fedora core 6 DVD and at the boot prompt thats what I typed. Please note that this is not the same as noacpi (the power management stuff). I must thank my good buddy Joe Burnett for doing some googling for me while I was sleeping and posted some info he found which gave me the step. If you have this laptop passing this option at install time will fix the random locking and freezes. I verified this with Fedora, Ubuntu, and Gentoo. I hope this will help someone out there.

12/1/2006

Compaq Presario 15.4″ Widescreen Notebook PC (V6120US) CPQ V6120US + Linux == Waste of time

Filed under: Fedora, Linux, compaq, laptop, life, unix — errr @ 1:16 am

Well I got a Compaq Presario 15.4″ Widescreen Notebook PC (V6120US) CPQ V6120US as my christmas gift this year from my mom, she paid for about 400 of it and I had to cover the cost of the rest (which was close to 600 dollars). I wish I had done more research about linux on this system. I started tonight by install Debian Etch amd64. The install was really quick. In under 30 mins I had a fully installed debian system. The problem was that it would lock up if the system beep was triggered, or if I tried to start X as a user instead of as root, or if I tried to boot the box in any other run level than single user mode. Next I gave Ubuntu 6.10 a shot both the i386 and the amd64. Both system had the same problem, just randomly locking up for no good reason. Next on to Fedora Core 6 both i386 and x86_64. The i386 was a huge waste of ime, it was constantly locking up, it was lucky to even boot. The x86_64 was just as bad, I managed to get it to boot every time into single user mode but when trying to boot to init 3 with gdm turned off it will lock in a diff spot every time. I went in to init 1 and turned off every service I could think of but it still locked in a diff spot every time.

My advise is this: If you plan to use linux on this system, please dont waste your money

Over this weekend I will be trying to find some Open Source OS that will run, but Im not keeping my hopes up. I refuse to use windows on this box so if I dont have any luck getting linux working Im gonna try to sell this thing and get a 32 bit system. As of right now I feel like I took about 1000 bucks and flushed it down the crapper. Had I gone with a 32 bit system I would have been able to score one hell of a system I think… If you have any hints on what can be done to get this system working please feel free to comment and let me know. Thanks.

10/14/2006

Fluxbox Pod Cast

Filed under: Linux, fluxbox — errr @ 10:22 pm

Hey I was in #fluxbox IRC the other day when a buddy of mine came in and told us about a fluxbox pod cast. We all had to go tune in and give it a listen. The guy did ok but he sure missed on some of what I feel are the best features, like the keys and apps file. If you give it a listen please make sure to investigate what he says because not all of it is true, he says fluxbox doesnt support icons and it does.. Other minor things like this are said though out the show, but over all publicity is publicity. Oh and there is an ogg of the show too. If you enjoy his show make sure to visit his forums and let him know.. can he do better..? if so let him know, he is a very good guy. Its got to be hard working putting a show up like that.

10/12/2006

PekWM, its whats for breakfast!

Filed under: Fedora, Linux, packages, pekwm, programming, python — errr @ 2:09 pm

I have been trying to get a package built for fedora for pekwm. PekWM is a nice light weight window manager for X-11. I decided to give it a shot using it because it supported dynamic menus. I built a package and filed a bug report so it could be included in fedora extras. After my first couple of comments it was suggested to me to create something more fedora friendly for my package. As it is the default menu provided by pekwm has a lot of apps in it. I didnt even have 1/2 of them my self. This was a minor problem to provide a package to a user who in turn cant use 1/2 of whats in the menu. It doesnt take an expert to figure out that bugs would be filed about things “not working”. I decided to take the code from fluxbox-xdg-menu and fork it to work for pekwm. After about an hour or so of hacking I removed all the unneeded stuff from its code base and had a fully functional dynamic menu generator using freedesktop.org standards. Tonight I plan to repackage pekwm and post an updated .spec file and src rpm. I hope that by the first of next week I will be commiting pekwm to fedora extras cvs.

10/6/2006

Fedora Extras Sponsered!!

Filed under: Fedora, Linux, packages — errr @ 3:05 pm

Hey, thats right!! I have now been sponsered and I got my CVS access yesterday to the fedora extras project. Patrice Dumas has sponsered me so now it looks like I will be able to add some of my packages to the Fedora Extras so you can now install them offically via yum. Right now I have been approved to add scrot, wmctrl, and root-tail. Look for these packages soon in a repo near you.

9/27/2006

More Fedora RPMS

Filed under: Fedora, Linux, packages, programming — errr @ 10:19 am

I have been on a kick lately building packages for Fedora. I have started to build packages for:

And several others which are slipping my mind right now. I plan to add as many new packages each day as I can. I am still building fluxbox and fluxbox-svn packages too. All the packages are built using mock to help make sure that all the deps are met during build time, and that they are built in a clean env every time (just like in the fedora extras project :) ) In the next couple of weeks I will be submitting all the packages I have been building for review to the fedora extras project (I really hope they get accepted and find their way in so I can yum install them on my other systems :P ).

Google hosting for t3h win!!

Filed under: Linux, google, programming, python — errr @ 10:02 am

Many of you may not know that google is now offering project hosting. This is great. I have been needing svn access for a project I work on, and this made it simple. I just went and filled out a short form and started using the service. Thanks google :)

9/13/2006

Fluxbox RPMS for Fedora

Filed under: Fedora, Linux, fluxbox, packages — errr @ 9:54 am

I started building RPMS for Fedora Core 3 4 5 and 6 of the latest versions of fluxbox. Right now I have SVN versions of fluxbox built for Fedora Core 5 and 6, and will have RPMS for version 3 and 4 by weeks end. I will also have 1.0rc2 release packages up sometime tonight for core 5 and 6 with 3 and 4 to follow.

Fluxmod is Back!!

Filed under: General, Linux, fluxbox — errr @ 9:35 am

Well, after who knows how long of being gone an old site so many fluxbox users grew to love for styles and an overall community is back. This time fluxmod is not run by ikaro though. This time a small group comprised of Meltir, Tenner, and my self are in charge of whats going on. As many of you already know Tenner is famous from his wonderful styles he makes and excellent tech support in IRC, Meltir is famous around the fluxbox IRC chat room for being an excellent tech support guy and over all great fellow, and I am just known for always being in the IRC room (hey someone has got to hold down the fort :P ). Right now there is already a large ammount of styles up for download. We will be working on getting forums, and other features added as soon as possible. We are looking forward to building a solid stable community for the worlds best Window Manager fluxbox.

8/8/2006

Fedora Core 5 irssi scripts

Filed under: Fedora, Linux, perl, programming — errr @ 7:16 pm

I have been using irssi as my IRC client on gentoo for years. I loved it, I would run it in screen so when I was out in the “real world” I could ssh into my system and “pick up” my IRC session and chat with my buds. When I installed fedora a few weeks ago I made sure to install irssi as well

yum install irssi

For those of you who wanted to know how to install it for your self. I noticed after I installed it I wasnt able to load any of the scripts I have written for it. I was missing the vital command “/script”. To solve this problem all that has to be done is to run the following command

/load perl

This will give you the “/script” command, and with out it you cant load or run any perl scripts. To keep from typing this every time you start irssi simply add it to your startup script for irssi. From the command prompt run the following command

echo "load perl" >> ~/.irssi/startup

I hope this will help someone out there.

7/23/2006

Fedora Core 5 Win32 Codecs

Filed under: Fedora, Linux — errr @ 3:31 pm

I was trying to play some video clips today that were wmv files. I had installed the mplayer stuff from the livna repo, and I have been able to play most of the files I had fine. Today I found it didnt get all the codecs I needed to play the windows media file stuff. What I did was went to the mplayer site and downloaded the essential codecs package. Next as root I did

mkdir /usr/local/lib/win32

Then simply unpacked the tarball in this dir

tar xjvf essential-20060611.tar.bz2 && mv essential-20060611/* /usr/local/lib/win32

After that I just started using mplayer as normal and my wmv files played fine. I hope this will help someone else out getting these types of files to play.

12/16/2005

fluxbox news

Filed under: Linux, fluxbox — site admin @ 10:56 am

Well I am not exactly sure how this slipped my mind but back around the 1st of November G.A. Heath and I started hosting a new site for fluxbox. Fluxbox has been in need of its own wiki for some time. Many other wikis had a page dedicted to fluxbox but there is so much stuff for fluxbox that really it needed its own site. So started http://fluxbox-wiki.org/ The site has filled with content really fast. It started with only a couple of people working on it, and now who knows; lots of people are making changes and adding helpful tidbits of information everyday. It has with out a doubt become the most active site we are hosting right now. The fluxbox community has really stepped up and helped make the wiki a great resource.

10/2/2005

Making a button inactive using PYGTK + GLADE

Filed under: Linux, glade, programming, pygtk, python — site admin @ 8:15 am

I have been working on a little app in my spare time. It is for calculating your GPA. Its nothing special, I have even made a similar app in Java as an assignment in class. This app has (at the time of this writting) only 3 buttons. An “add” button, a “calculate” button, and a “quit” button. I decided I wanted to make it so once you hit calculate you could not press add or calculate again, this will prevent you from adding the same info to the display once it has been calculated (with out selecting something from the file menu to reset the form). I searched all over the net and couldnt find anything on how to make this happen but some of the wonderful people in #pygtk were able to help me so I thought I would pass that info along for anyone else.

I made a really simple example to show how this is done with pygtk and glade2. You can d/l the example here. If you have any questions, comments, or suggestions on how I could/should/needed to do this please feel free to comment. I do have moderation enabled for comments so it might take a day or so for it to show but I will allow (and will be open to) any comments that are not spam.

Next Page »