Welcome to The Tech 
Guide
Google
 
Web www.thetechguide.com
Geeks with attitude
Navigation
  • Home
  • How-To's
  • Tweaks
  • Hardware
  • Software
  • Games
  • Our Picks
  • Downloads
  • FAQ's
  • Forum
  • Chat
  • Tech Deals
  • Links
  • Email

  • Site News
    Our Black Friday section is now online! Click here to check it out.

    Active Discussions
    [an error occurred while processing this directive]


      

    Unlimited Incoming/Outgoing cellphone calls with Asterisk


    Part 2, making and recieving calls, plus some workarounds.

    Quick note! This guide is incomplete. If you have a decent understanding of linux and asterisk, you can probably fill in the huge gaping holes. Otherwise, I'd stay far far away! At the very least, don't try this on your production box!

    To receive calls, you must setup a [bluetooth] context in extensions.conf. You answer the call just like you would any other call. I would insert a delay of a second or two if you have an ivr setup, as the phone does not answer right away. Here is an over-simplified entry in extensions.conf to get you started:

    [bluetooth]

    exten => s,1,Answer
    exten => s,2,Wait,1
    exten => s,3,Playback(custom/greeting)
    exten => s,4,Dial(${ALLPHONES},30,r)

    This setup will answer the call, wait one second, then play a greeting, and ring your phones (I used a variable named ${ALLPHONES}, this is set to all my internal sip extensions).

    Next, you have to make sure your phone is setup to automatically answer calls when connected to a headset. Use the shortest setting available, on both my Motorola phones this was 2 seconds. If you don't have the phone automatically answer the call, then asterisk will believe it has answered and will process your dialplan, but the phone will keep ringing (and eventually go to voicemail).

    Now we'll setup outgoing calls. The command is Dial(BLT/Phonename/${EXTEN}) (substitute the name you gave your phone in bluetooth.conf for "Phonename", in the example given previously it was set to "Motorola"). Here's an example context you can use:

    [cell-out]

    exten => _1NXXNXXXXXX,1,SetGroup(cellout)
    exten => _1NXXNXXXXXX,2,CheckGroup(1)
    exten => _1NXXNXXXXXX,3,Dial(BLT/Motorola/${EXTEN})

    Notice the first two lines. The first sets the group name, the second sets the limit. We don't want more than one call going out the same cellphone, otherwise bad things happen (the first caller gets put on hold, the second caller is connected fine, when he hangs up then the two callees on line one and two are connected, a situation we wish to avoid). Using a group will force a limit of only one call out at a time, if a call is already in progress and another call is attempted, it will jump to priority +101 (and if it doesn't exist, the call simply fails, which is acceptable).

    Now, we have incoming calls working, and outgoing, so how can we use this to get unlimited incoming and outgoing calls on your cellphone? Simple, someone calls a normal (non-cellular) number that is connected to your asterisk box (can be a normal pstn line, a sip line, iax, etc.). From there, asterisk can be configured to call out via bluetooth (which is connected to a cellphone nearby) and dial your remote cellphone number. The reverse is also possible, you can call from your remote cellphone to the one next to asterisk, which picks up, then use DISA to get a dialtone, and dial any number you wish. The only call charges you incur are what you would get charged if you were at the same physical location of the asterisk box. Quite simply, if your asterisk box is setup at home, and you can dial a local number for free, then when you are out and dial in through your cellphone and call the same number, there are no charges whatsoever. If you dial a number that is long-distance and don't have an unlimited long-distance plan setup on your asterisk box, then you will get charged for long-distance. You will NOT use any of your cellphone minutes. As anyone who has gone over their plan knows, even expensive long-distance is cheaper than overage fees or even paying for a higher plan with more minutes. On my cingular plan, an extra 100 minutes costs $10; with voxee 100 minutes will cost $1.10, with voicepulse it would cost $2.90 (I personally use voxee as my primary long-distance provider, and have voicepulse setup as a backup). And this is just for long-distance calls, any local calls are free, as are toll-free numbers.

    Now that you made sense of that, you're wondering if there's a catch. Surely the cellular companies won't let you get away with this! Well, you're partly right. I checked the TOS, and Verizon has a section that talks about mobile to mobile calls if one phone is always stationary (which it would be in our case). You could work around this by some fancy coding and switching phones every so often if you desired. Due to this, I decided to go with Cingular instead. I could not find any clause in the TOS that prohibits using the unlimited mobile to mobile feature in this manner (if you notice that they do, please let me know). I did not check other providers such as Sprint. Note that if you have Nextel, you can ignore this whole howto! Just get a plan with unlimited incoming minutes, setup asterisk to recognize when you call (but don't answer), have it call you back, enter a password, and get dialtone! Unfortunately, Nextel doesn't have as much coverage as Cingular or Verizon, and doesn't offer service at all in my area, hence the need for this howto.

    Ok, so you've decided to go with Cingular since they have a more lenient TOS, now you want to know how to setup DISA to get remote dialtone when you call from one cellphone to another next to the asterisk machine. Great, except for one thing. Cingular does not pass DTMF between two cellphones! You can call from your cellphone to a regular line (regular as in not a cellphone, doesn't matter if it's pstn, sip, etc.) or from a regular line to your cellphone and DTMF works fine. Call from one cellphone to another (which is what we want, so we can use unlimited mobile to mobile minutes instead of anytime minutes) and DTMF does NOT WORK! Try for yourself, dial one phone from the other, press some keys, and see if you hear the tones on the other phone. If you don't, then you will be unable to call from one cellphone to another that's next to asterisk, have asterisk pickup, give you dialtone, and let you call another number. Note that this may not be limited to Cingular, other providers may not pass DTMF between two cellphones, and it may just be how Cingular is setup in my area (in other words, try it manually, if you hear tones great, otherwise read on for a solution).

    So, how do we get around this? There's two possible solutions. One, is to use text messaging. You'll need to be able to send an email to the asterisk server. Just send the phone number you wish to dial as the body of the email, nothing else. Have asterisk parse this email, it can check the From: to get your phone's number (and match it against a list of phone numbers that are allowed to use this feature), call you, once it reaches you then dial the number in the body of the message. You could possibly get creative with this, for example using IM instead. Personally, I didn't want to pay extra for text messages, so I opted for the second solution. The second solution is to dial a normal number, which will use your minutes, but you are only on the line long enough to tell asterisk the number you want to call. I have yet to use more than one minute during this initial call. Asterisk will then call you back, then call the number you instructed it to, and bridge the call. You can talk as long as you want now, and will only use mobile to mobile minutes. The only downside to this solution is that you will have to use one of your minutes each time you want to make a call, but the upside is that other than that you don't use any of your minutes. BTW, you only have to use a workaround when you want to call out, people can still call in, tell asterisk who they want to call, and asterisk can call out via the local cellphone to the remote cellphone, and you will only use mobile to mobile minutes.

    Of course, you only need to go through this when you'd use your anytime minutes, on nights and weekends you can dial numbers directly. Now, this means that the cellphone connected to asterisk is going to go unused during nights and weekends, right? Wrong! Using the GotoIfTime function, we can setup asterisk to make long-distance calls via the bluetooth connection during nights and weekends, and through your normal long-distance provider all other times. No need to let your unlimited minutes go to waste! Note that you will not be able to set your outgoing callerid if asterisk dials out through the local cellphone, so let friends and family know that they may see another number when you call them.

    Click here for Page 3 for some examples of how I set things up. Again, still under construction and not complete.


    Questions? Ask in the forum or email me.

    For the Privacy Policy, click here.
      
    Past Articles
  • Build your own Apple Clone
  • AllofMP3 Review
  • Tutorial to Basic Windows 2000 DOS
  • Extracting and joining MPG2 files from SVCD
  • Modifying your Windows XP Boot Logo
  • Unlocking WinXP's setupp.ini
  • Making a Full Screen Bios Logo
  • Making your WinMe CD bootable
  • Auto-insert your Win9x serial
  • Auto-insert your Office2kserial
  • Why FedEx Sucks