here’s an infrastructure suggestion. The dialplan that generates the beep for intercom and extnesions looks like:
intercom:
exten => _*80.,n,Macro(autoanswer,${DEVICES})
exten => _*80.,n(check),ChanIsAvail(${DIAL},sj)
exten => _*80.,n,Dial(${DIAL},5,A(beep))
paging:
exten => _PAGE.,n,Macro(autoanswer,${EXTEN:4})
exten => _PAGE.,n,Dial(${DIAL},5, A(beep))
The key is that the autoanswer macro is called, which is auto generated, can do per phone type things, and can have per device overrides. (It is what sets all the ALERT_INFO type headers and even the ${DIAL} string you see listed. So for starters, we can modify the dialplan to look like the following:
exten => _PAGE.,n,Dial(${DIAL},${DOPTIONS})
and then we can make the time and the options be configurable in the database, and returned in the DOPTIONS variable. Furthermore, we can allow for per sip useragent overrides for specific types of phones (like ones that may provide their own beep. Lastly, you can always override a specific device by calling a macro which is part of the autoanswer macro ability to make per device custom changes. For reference, this is an example of macro-autoanswer on my system:
[macro-autoanswer]
include => macro-autoanswer-custom
exten => s,1,Set(DIAL=${DB(DEVICE/${ARG1}/dial)})
exten => s,n,GotoIf($["${DB(DEVICE/${ARG1}/autoanswer/macro)}" != "" ]?macro)
exten => s,n,Set(phone=${SIPPEER(${CUT(DIAL,/,2)}:useragent)})
exten => s,n,Set(ALERTINFO=Alert-Info: Ring Answer)
exten => s,n,Set(CALLINFO=Call-Info: <uri>\;answer-after=0)
exten => s,n,Set(SIPURI=intercom=true)
exten => s,n,Set(ANSWERMACRO=)
exten => s,n,ExecIf($["${phone:0:5}" = "Mitel"],Set,CALLINFO=Call-Info: <sip:broadworks.net>\;answer-after=0)
exten => s,n,ExecIf($["${phone:0:4}" = "snom"],Set,ANSWERMACRO=snom-autoanswer)
exten => s,n,ExecIf($["${phone:0:9}" = "testphone"],Set,CALLINFO=Call-Info: \;answer-after=0)
exten => s,n,GotoIf($["${ANSWERMACRO}" != ""]?macro2)
exten => s,n,ExecIf($["${ALERTINFO}" != ""],SipAddHeader,${ALERTINFO})
exten => s,n,ExecIf($["${CALLINFO}" != ""],SipAddHeader,${CALLINFO})
exten => s,n,ExecIf($["${SIPURI}" != ""],Set,__SIP_URI_OPTIONS=${SIPURI})
exten => s,n+2(macro),Macro(${DB(DEVICE/${ARG1}/autoanswer/macro)},${ARG1})
exten => s,n+2(macro2),Macro(${ANSWERMACRO},${ARG1})
Note this line:
exten => s,n,GotoIf($["${DB(DEVICE/${ARG1}/autoanswer/macro)}" != "" ]?macro)
allows you to do what ever you want for a specific device. Note that lines such as:
exten => s,n,ExecIf($["${phone:0:9}" = "testphone"],Set,CALLINFO=Call-Info: \;answer-after=0)
are auto-generated out of the database. So we can do something similar, along with the defaults, and set the DOPTIONS variable as needed.
What this would not lend itself well to is an environment where phones, on a case by case basis, wanted to enable/disable their own beeps. If that is what is desired, then it can still be handled but not through the generic macro facility that is already there. We we would want to add some functionality in the autoanswer macro for this purpose, that looked at a device setting similar to what it already does for the macro, but limited to adjusting the beep only.
So … a bit of rambling / thinking out loud but that should help as a starting point to discuss or if someone wants to have a go at it …