I was wondering if there is any way to get this working here. I would like to be able to simply talk to people at other phones without having to call/ring. I am pasting a post I found on another site to start people talking. LET'S GET SOME FORUM ACTIVITY PEOPLE!!!!
_____________________
See this thread for background info: http://www.trixbox.org/forums/vendor-mod...te-blf-intercom
Tested with:
Polycom 650s
trixbox 2.3.0.10 (Asterisk 1.4.15 & FreePBX 2.3.1.3)
Objectives/requirements for this environment:
1.) Intercom functionality for every desktop extension. Execs like to hit one button, have their assistant's phone beep, and have a conversation. Likewise, assistants like to hit one button, announce a call to the exec, and transfer it through to him/her.
2.) BLF needed for exec and assistants--they like to look at their phones and see if the other is on the line.
3.) The ability to have #1 & #2, but additionally, allowing regular calls (non-intercom) to be made to each extension, and having BLF monitor these calls, as well as calls made over intercom.
4.) The ability to easily bridge/transfer calls using this setup, doing the best possible to minimize the number of steps involved.
Solution:
1.) How did I make it work? Let's take an example:
Assistant: Ext. 200
Exec: Ext. 201
But before--why is the extra code below necessary? Why not just tell extension 200 to auto-pickup and map the speed-dial button/BLF to extension 200? Because--you don't want calls coming from the outside or somewhere else internally to activate the intercom on the phone if each party isn't expecting it. So, in order to both 1.) get the speed-dials to signal intercom, and 2.) allow normal calls to come in, the phone needs to believe that it is communicating with two separate extensions--the solution is to use a virtual extension.
In extensions_custom.conf:
exten => 400,1,Set(__SIPADDHEADER=Call-Info: \;answer-after=0)
exten => 400,2,Set(__ALERT_INFO=Auto Answer)
exten => 400,3,Set(__SIP_URI_OPTIONS=intercom=true)
exten => 400,4,ChanIsAvail(SIP/200&SIP/400,js)
exten => 400,5,Macro(user-callerid,)
exten => 400,6,Dial(Local/200@from-internal,,A(beep),)
exten => 400,105,Macro(vm,200,BUSY)
exten => 400,106,Wait(5)
exten => 400,107,Macro(hangupcall,)
exten => 400,hint,SIP/200&SIP400
For those who haven't looked-into the various inter-workings of Asterisk, let's go through that step-by-step so that you can customize it if need be:
Lines 1-3: Sets necessary options so that when extension 400 is called, the phone is signaled to activate its intercom (you can customize the intercom behavior in sip.cfg for the Polycoms, but that's outside the scope of this write-up).
Line 4: Checks whether extension 200 is busy--if it IS busy, then skip to priority n+101 (this is logic built into the ChanIsAvail command)--n+101 in this case is line 7.
Line 5: Runs FreePBX's caller-id macro to identify caller.
Line 6: The actual dial command. It dials extension 200 after processing the commands above it, and plays a beep sound to alert the user that someone is about to speak to them. In this case, when you dial 400 from a phone, it 'actually' dials extension 200, with the special conditions listed in lines 1-5. This allows "normal" non-intercom calls to still be placed to extension 200 (by dialing 200 rather than 400).
Line 7: Used if extension 200 is busy--goes to that extension's "on-the-phone" VM box, which essentially prevents a situation where an intercom call goes to call waiting or interrupts. However, in this case, if ext. 200 called 201 while he/she was on the line, 200 would already know that 201 was busy--because of BLF. This line of code is mainly a fail-safe to ensure that if the line is busy, the call is handled propery and prevents a possible interruption, and/or Asterisk locking-up from not knowing what to do.
Lines 8-9: Tells Asterisk to wait 5 seconds after the call is dropped to close out the channel.
Line 10: Maps status of extension 200 to extension 400--this is VERY important to getting BLF to work properly--see below.
2 & 3.) So, the programming aspect for objective #1 is complete. Now, how do we make the Polycoms use this code in the intended manner? Fortunately, thanks to Polycom, this is quite easy. Essentially, activate prescence in sip.cfg, and add each person to the contact directory, but make the contact fields reference the virtual extensions, not the actual extensions the phones are registered to. In this case, enter the following into the directory (speed-dials):
Assistant - 400 (not 200)
Exec - 401 (not 201)
Why reference the virtual extensions? When you do it this way, your Polycom will ask Asterisk for the status of extension 400. Well, extension 400 is obviously not a peer (it's not another phone), but if you have your hints set-up identical to the set-up above, Asterisk will broadcast the status of extension 200 as the status of 400, which is what you want--you want to know whether the phone registered to line 200 is busy.
So, bottom line--when you push the speed-dial labeled "Assistant", Polycom dials extension 400. Asterisk executes the code provided above, and activates the intercom feature on the receiving end. The Polycom then tells Asterisk that line 200 is busy (200's status, remember, is mapped to 400), so any Polycom that has "Assistant" as a speed-dial will show it as busy.
What happens if a regular call comes in from the outside to the assistant? Extension 200 is rung, and when it is picked up, the exec's phone (and anyone else who has Assistant as a speed-dial) will show the assistant as status busy.
You get the best of both worlds.
4.) Finally, the assistant needs to be able to field a call, hit transfer, have the exec's phone beep (to announce the call), then hit transfer again to bridge the two calls together. Likewise, the exec may want the assistant to connect him/her with someone else. The assistant can do this as well. At first, I used the newer Asterisk Page() command, as it was easier to implement, since most of the coding was built-in. This worked great, until I tried to transfer the call. For some reason, a call placed through the Page() command does NOT like to be transferred, and ends up simply being dropped if you try to do it.
That's it--sorry for the length and wordiness--I hope this helps some of you who may have similar needs in your various installed environments. Please let me know if you have any questions about this set-up. I will be happy to answer them to the best of my ability.
ALSO, if you are skilled with Asterisk and would like to critique my code above, I would love that--it would be great to know if it can be made more efficient. Any additions or suggestions for changes are welcome.
Thanks!
This post has been edited 1 time(s), it was last edited by Dia on 02.05.2008 at 16:37.
|