Intercom functionality for internal calls

Hi,

I’m trying to replicate a behavior from our (previous) 3Com NBX system, where any phone would auto-answer if the call originated internally, and if auto-answer was enabled on the phone. The phones even had an auto-answer button on the front panel. We really (really) loved this workflow – that is basically how we’ve called each other for years, and suddenly having to pick up the phone to answer each other is a bummer, when before we could just say “Melinda you there?”, and she would “Yeah, I’m out in the hall, hang on” and then walks over to her phone.

So I’m trying to basically get every extension to add the SIP header “answer-after:0”, so that when they dial, any receiving phone that is an internal phone will auto-answer, provided that auto-answer is otherwise enabled on the phone itself.

I’m new to Asterisk but not to programming, and the thing I’m not getting is that with FreePBX, you’re supposed to put this in the _custom.conf file. But how the devil do you figure out which Priority/Sequence/Line-number to give this? The obvious place to put this would be in [from-internal], but there’s already a ton of includes and ‘exten’ code. If I just barge in and do an exten => s,5,SIPAddHeader(“etc.etc.”), won’t I overwrite whatever is already on code line 5? Or does every context have new line-numbering starting from 1? Aren’t they then fighting over which context gets the call? What I really want is to squeeze this SIPAddHeader command in between code line 1 and code line 2 in whatever is already happening – essentialli placing it on line 1 1/2.

Is there a way to get all extensions to add this header when they dial out? This header won’t travel beyond the phone system, so only internal phones will understand it, and thus, we get our auto-answer for all internal calls if auto-answer is enabled on the phone functionality. We’d really love to get that back, as it is the one thing we sorely miss from the 3Com system. We’re not keen on the *80 workflow, neither are we keen on having different extensions for everyone so that you can intercom them, i.e. Bob is on 105, but if I want to incercom him, he’s on 205. Finally, we’re not interested in paging groups at all.

I’m saying this because I know that these workflows exists, but internal-to-internal auto-answer is what we’re after. If we can get the auto-answer NATIVE on the extension, then it can be used in combination with Busy Lamp Field, so an Extension Button on f.ex. a Grandstream phone not only shows someone’s line-activity, you can press the Extension Button to call them, auto-answer and all. If not, then you have to have your whole left row of buttons be the BLF, and the whole right row be the button you use to actually call people, which is a crazily wasteful workaround.

So, I’m hoping that someone is able to help, and I want to thank the FreePBX guys for their effort in building this system.

Best,

Per

You might like to take this for a read.

Asterisk: The Future of Telephony 2nd Edition (ISBN 0-596-51048-9) — Order yours at http://www.oreilly.com/catalog/9780596510480/ — Free downloadable PDF http://downloads.oreilly.com/books/9780596510480.pdf — HTML at http://tfot.leifmadsen.com

You want to read chapter 5 and understand how include works. It does a good job of describing it without me re-writing everything it covers.

Hi,

Well, definitely that’s a great resource, and this is also how I understood includes to work, that essentially the contexts are ‘overlaid’, and then whichever context first matches, gets the call.

But it doesn’t answer the question for how to get all extensions to add the auto-answer SIP header when dialing other extensions, and an include doesn’t seem like the way to do it, because includes are no way to add to or modify specific sequences that already exist – rather they are meant for adding new extensions, or new and original ways of processing extensions that already exist.

I know there’s a keycode *80 that enables intercom and adds the header. Would there be a way to hardcode it so that *80 is always enabled? I don’t think the phones (Grandstream) allows for a “speed dial prefix” so you could get *80 prefixed to all BLF push-button extension dialing.

Or would there be any way to hardcode all extensions to add this header always? I’m thinking if it would be possible to edit the macro for extension generation itself, but I’ve looked through all the .conf files, and I can’t find it anywhere. Does anyone know exactly where the default call path for an extension is coded? I know I’m not supposed to hard-code it, but it seems that it’s the only way.

Any ideas?

Best,

Per

I might have an idea. Can’t test it, because we don’t have the Grandstream phones yet.

But am I right in assuming that if an extension is matched in more than one context and included together, then it is executed in both places? Meaning that if I have:

[context1]
exten => s,1,DoSomething()
[context2]
exten => s,1,DoSomethingElse()
[realcontext]
include => context1
include => context2

… then BOTH DoSomething() and DoSomethingElse() get executed?

Because in that case, I can simply add a context to extensions_custom.conf that says:

[intercom-header]
exten => s,1,SIPAddHeader(Call-Info: answer-after=0)

And then in extensions.conf, I could add to:

[from-internal]
include => intercom-header <<<— New
include => from-internal-xfer
include => bad-number

Would this work? Or would I need to add some logic to make sure that [intercom-header] only gets called when it’s a direct extension-to-extension dial, and not a transfer or a ring group or anything?

Thanks,

Per

I finally found something that might work. I’ll test it when the Grandstream phones arrive tomorrow. Posting it here for the benefit of others.

I would only add that since this is an extremely prevalent workflow in the traditional PBX world, and apparently not too hard to implement, this really ought to be a feature in FreePBX. Perhaps each extension could even have a list of extensions that it will accept auto-answer calls from. This would so rock.

This was written by Ken Williams on asterisk-users on 11-15-2006:


We use intercom 100% inter-office. To get FreePBX to do this with
Grandstreams by default without having to create intercom or paging
groups, just change the following line (line #58) in your
extensions.conf from:

exten => s,10,Dial(${ds}) ; dialparties
will set the priority to 10 if $ds is not null

to:

exten => s,10,SIPAddHeader(Call-Info: answer-after=0) ;dialparties will
set the priority to 10 if $ds is not null
exten => s,11,Dial(${ds})

Hope this helps someone in the future.

1 Like