Plantronics + Polycom. Now together as Poly Logo

Server-based DND using FAC/NOTIFY?

SOLVED
Advisor

Re: Server-based DND using FAC/NOTIFY?

It doesn't appear that the recently-released 3.3.2 update has addressed this, has it?  Initial testing suggests not, but let me know if I missed something. This still appears to be the most-viewed topic in the VoIP community, so I certainly hope that Polycom isn't turning a deaf ear to this issue.

Message 11 of 30
Polycom Employee & Community Manager

Re: Server-based DND using FAC/NOTIFY?

Hello Portalmedia,

 

please see the official answer from Product Management:

 

“The signaling information pertaining to this feature is specific to a certain call server implementation and is not able to be publicly disclosed at this time.”

 

Best Regards

 

Steffen Baier

 

Polycom Global Services




<======== Signature / Disclaimer ========>
Please be aware:For questions about the type of support to expect please check here

Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's

Please remember, if you see a post that helped you , and it answers your question, please mark it as an "Accept as Solution".

The title Polycom Employee & Community Manager is an automatic setting within the community and any forum reply or post is based upon my personal experience and does not reflect the opinion or view of my employer.
Poly employee participation within this community is not mandatory and any post or FAQ article provided by myself is done either during my working hours or outside working hours, in my private time, and maybe answered on weekends, bank holidays or personal holidays.
Message 12 of 30
Advisor

Re: Server-based DND using FAC/NOTIFY?

Very well.  My official response to Product Management is as follows:

 

"This feature should not have been mentioned in the product documentation in the first place, if the intention was to keep its workings a secret due to its specificity to a single call server. Its current inclusion in the documentation is completely worthless and only results in frustrating members of the community who are trying to deploy advanced solutions based on your products. As such, this is a show-stopper for several clients of mine, and I will not be recommending Polycom products to any of my customers until the community can at least be shown information that we can use so we can adapt this feature for other call servers (and share our solutions with the community, of course)."

Message 13 of 30
Polycom Employee & Community Manager

Re: Server-based DND using FAC/NOTIFY?

Hello portalmedia,

 

I have liaised with the Product Management and we can only apologize for referencing undocumented parameters and the confusion caused by this.

 

Please feel free to work via your Reseller or Polycom Support to raise a Feature Request in order for the Product Management to possibly add this functionality in a different form to the Polycom UCS Software.

 

Best Regards

 

Steffen Baier




<======== Signature / Disclaimer ========>
Please be aware:For questions about the type of support to expect please check here

Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's

Please remember, if you see a post that helped you , and it answers your question, please mark it as an "Accept as Solution".

The title Polycom Employee & Community Manager is an automatic setting within the community and any forum reply or post is based upon my personal experience and does not reflect the opinion or view of my employer.
Poly employee participation within this community is not mandatory and any post or FAQ article provided by myself is done either during my working hours or outside working hours, in my private time, and maybe answered on weekends, bank holidays or personal holidays.
Message 14 of 30
Frequent Advisor

Re: Server-based DND using FAC/NOTIFY?

Wow.  I found this thread and read it with eagerness and anticipation of a working solution coming at the end... I was really sad to see this response from Polycom Management.  Why is this feature being kept a hidden secret?  Is having the phone be aware of its own DND state really such an industry-shaking groundbreaking feature that it needs to be locked away only to be used by a single vendor?  I wrestled with this problem for a long time too (although I admit not nearly as in depth as portalmedia) and I can only hope that Polycom comes around on this issue and takes a more friendly stance towards it's non-behemoth integrators.

Message 15 of 30
Polycom Employee & Community Manager

Re: Server-based DND using FAC/NOTIFY?

Hello luckman212,

 

Portalmedia followed above suggestion and should have received some feedback from Product Management.

 

The Features have been developed with our Partners and are under NDA so Polycom cannot officially provide Information around the functionality and the implementation.

 

Best Regards

 

Steffen Baier

 

Polycom Global Services




<======== Signature / Disclaimer ========>
Please be aware:For questions about the type of support to expect please check here

Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's

Please remember, if you see a post that helped you , and it answers your question, please mark it as an "Accept as Solution".

The title Polycom Employee & Community Manager is an automatic setting within the community and any forum reply or post is based upon my personal experience and does not reflect the opinion or view of my employer.
Poly employee participation within this community is not mandatory and any post or FAQ article provided by myself is done either during my working hours or outside working hours, in my private time, and maybe answered on weekends, bank holidays or personal holidays.
Message 16 of 30
Advisor

Re: Server-based DND using FAC/NOTIFY?

BTW, Steffen, still waiting to hear back from the Product Management people.  I don't know how fast things move with that, though.  I'm content to be patient.

Message 17 of 30
Advisor

Re: Server-based DND using FAC/NOTIFY?

After much time with this and working with some people at Polycom who were helpful enough to get me the information necessary to complete this puzzle, here is the WORKING solution for getting Server-side DND working with Asterisk and FreePBX. You need to jump through a few hoops, but otherwise this has been a solid setup with our phone system.

 

First off, the requirements, which are kinda specific:

1. Polycom UCS release 3.3.1revF or 3.3.2*

2. Ability to edit chan_sip.c and sip.h in the Asterisk source, and recompile (re-running 'make') it to get a new chan_sip.so. If you have installed your Asterisk server by building it from the source, this is actually not as daunting as it may sound, especially if you can muddle around existing code. Note that I don't really know C, and I did this just fine.

 

* Note about the Polycom UCS version:  This is known to work in 3.3.1revF and 3.3.2.  I do not know about 3.3.3, but you can try it, let me know, and I can update this accordingly. This will NOT WORK with UCS 4.0.0 and UCS 4.0.1!!!  The SIP messages it sends to Asterisk on the new version are incomplete and do not work.  Additionally, some of the configuration parameters for this have conspicuously disappeared from the administration guide in the new version of the software, and the current word is that this feature was never intended to be published in the manual. This is possibly due to the original stink I made about this issue, here. As I know there are many of us interested in this feature, I encourage you to lobby a complaint with Polycom here or as a feature request to encourage them to reinstate this as a documented and supported feature. Strength in numbers, people. Your participation would be appreciated.

 

OK, onto the setup....

 

1) Asterisk dialplan configuration

The assumption is that you already have a dialplan configured to have feature codes that enable and disable DND on the server. The stock dialplan configuration with FreePBX will suffice, though you can edit it to be quicker if you'd like by removing the part where Asterisk waits and speaks back to you.  On my system, these feature codes to turn on and off DND are *78 and *79, respectively. These are the defaults for FreePBX.

 

2) Polycom phone configuration

There are a few parameters that you will need to add to each line registration for which you wish to have server-side DND features on. As I run a home office, I have two line reigstrations on my phone.  So the configuration I have below is set up separately on each line registration/extension:

 

reg.x.serverFeatureControl.signalingMethod="inviteFACSubscribePresence"
reg.x.serverFeatureControl.activateCodeSequence.dnd="*78"
reg.x.serverFeatureControl.deActivateCodeSequence.dnd="*79"
reg.x.serverFeatureControl.dnd="1"
reg.x.serverFeatureControl.subscribeToUri="sip:[EXT]@your.sipserver.addr"

 

... where "x" is the line registration (1, 2, 3, etc), "*78" and "*79" are the feature codes that the phone needs to dial, "[EXT]" is the extension number for your line, and "your.sipserver.addr" is the address of your Asterisk server that the phone registers on.  Example:  reg.1.serverFeatureControl.subscribeToUri="sip:101@my.sipserver.com"

 

Note that these all-important parameters for FAC/NOTIFY are no longer documented!  It is a travesty.  Word is that this was implemented for one large customer of theirs. I am hoping that one day Polycom realizes that the Asterisk community is another large customer of theirs. :-)

 

Lastly, ensure that your phone configuration executes the default behavior on the DND button.  If you have it hardcoded to run a softkey/macro/feature code, remove those settings.

 

3) Editing the Asterisk source

The final piece is editing Asterisk to send the right XML syntax back to the Polycom so that it knows to toggle its DND status. Admittedly, this is the trickiest part, and unfortunately while I can muddle around in code, as a web developer I'm not personally savvy enough to produce you official "patch" files that you run against your source. What I can tell you, however, is what I've changed.  I was making these edits using Asterisk 1.8.2.1.  This will probably work similarly with other Asterisk versions, though these may be small changes in what/where you need to edit things.  To the best of your ability, carry on with the following edits, and please, create backup copies of the two files you will edit, just in case you make a mistake.

 

3a) First file to edit, channels/sip/includes/sip.h:

 

Find the line that begins "enum subscriptiontype {" and add "POLYCOM_FAC" as one of its values.  The entire block should appear as follows:

 

enum subscriptiontype {
	NONE = 0,
	XPIDF_XML,
	DIALOG_INFO_XML,
	CPIM_PIDF_XML,
	PIDF_XML,
	POLYCOM_FAC,
	MWI_NOTIFICATION,
	CALL_COMPLETION,
};

 

3b) Final file to edit, channels/chan_sip.c

 

First, find the line that begins "static const struct cfsubscription_types {".  We will be adding a definition for POLYCOM_FAC to this block.  The entire block should result in the following:

 

static const struct cfsubscription_types {
	enum subscriptiontype type;
	const char * const event;
	const char * const mediatype;
	const char * const text;
} subscription_types[] = {
	{ NONE,		   "-",        "unknown",	             "unknown" },
	/* RFC 4235: SIP Dialog event package */
	{ DIALOG_INFO_XML, "dialog",   "application/dialog-info+xml", "dialog-info+xml" },
	{ CPIM_PIDF_XML,   "presence", "application/cpim-pidf+xml",   "cpim-pidf+xml" },  /* RFC 3863 */
	{ PIDF_XML,        "presence", "application/pidf+xml",        "pidf+xml" },       /* RFC 3863 */
	{ XPIDF_XML,       "presence", "application/xpidf+xml",       "xpidf+xml" },       /* Pre-RFC 3863 with MS additions */
	{ POLYCOM_FAC,       "as-feature-event", "application/x-as-feature-event+xml",       "x-as-feature-event+xml" },       /* Proprietary Polycom feature-key synchronization */
	{ MWI_NOTIFICATION,	"message-summary", "application/simple-message-summary", "mwi" } /* RFC 3842: Mailbox notification */
};

 

Second, and this is the biggest part, find the static method "static void state_notify_build_xml" in the file.  Scroll down to the case statements where it is building the XML for presence, and we will be inserting a case POLYCOM_FAC: to this area. Note: I added this as a new case before "case PIDF_XML", but it doesn't matter exactly where, just so long as you get the syntax right.

 

case POLYCOM_FAC:
	ast_str_append(tmp, 0,
		"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
		"<DoNotDisturbEvent xmlns=\"http://www.ecma-international.org/standards/ecma-323/csta/ed3\">\n");
	ast_str_append(tmp, 0, "<device>%s</device>\n", exten);
	ast_str_append(tmp, 0, "<doNotDisturbOn>%s</doNotDisturbOn>", (local_state ==  NOTIFY_OPEN) ? "false" : (local_state == NOTIFY_INUSE) ? "false" : "true");
	ast_str_append(tmp, 0, "</DoNotDisturbEvent>\n");
	break;

 

Third, go further down in the file and find the static method "static int transmit_state_notify", go to its case statement, and add a new case for POLYCOM_FAC.  Note: this essentially is the same as what the other cases do, so I suppose you could just as easily add a "case POLYCOM_FAC" to one of the other cases like XPIDF_XML and it would work just as well. In any case, here's the full case statement for POLYCOM_FAC:

 

case POLYCOM_FAC: /* Polycom Feature Key Synchonization */
	add_header(&req, "Event", subscriptiontype->event);
	state_notify_build_xml(state, full, p->exten, p->context, &tmp, p, p->subscribed, mfrom, mto);
	add_header(&req, "Content-Type", subscriptiontype->mediatype);
	p->dialogver++;
	break;

 

Last, but certainly not least, we are changing one important line in the Asterisk source that hardcodes all presence requests received by a Polycom.

 

Find this code:

 

/* Older versions of Polycom firmware will claim pidf+xml, but really
* they only support xpidf+xml. */
if (pidf_xml && strstr(p->useragent, "Polycom")) {
	subscribed = XPIDF_XML;

 

... and change it to ...

 

/* Older versions of Polycom firmware will claim pidf+xml, but really
* they only support xpidf+xml. */
if (pidf_xml && strstr(p->useragent, "Polycom")) {
	subscribed = POLYCOM_FAC;

 

(we are swapping out "XPIDF_XML" for "POLYCOM_FAC")

 

4) Finishing up

Once you are done with the edits, go to the main directory for your Asterisk source and re-run "make".  If you previously compiled Asterisk from its source, it should be smart and only need to build the changed files based on what you edited.  The new compiled file that you will be concerned with is "chan_sip.so".  Once compliation is done, backup/replace the existing shared object in the "modules" directory with this new one (mine is located in /usr/lib/asterisk/modules/).

 

Afterwards, bounce your Asterisk server, reboot your phones, and try this out.  If you have multiple line registrations, hitting "Do Not Disturb" on your phones will bring up a menu to choose which line you wish to DND, with "Set All" and "Clear All" being options.  For each line listed in the menu "Disabled" means that DND is off, and "Enabled" means that DND is on.  For myself, I tend to use "Set All" and "Clear All" to toggle my DND status.  If you have a single line registration, I imagine there would be no menu that appears, and pressing the button will simply toggle the status.  By the way, even though this is dialing a feature code, it'll do this separately from any call that you might currently be in, so this feature will work even if you are currently in a call!

 

5) How you know it's working

Before I got the proper XML schema from Polycom, one thing I noticed when trying to set this up is that I could press the button to enable DND and the phone would dial the feature codes for each line and set the DND, and the main display of the phone will show "Do Not Disturb", but because the phone wasn't receiving XML status back from the server to tell it that it was in DND, the "X" icons would never flash for each line, and consequently I could never again press the DND button to disable the DND.....the only way out was to pick each line and dial the feature code to turn it off.  (My boss joked that I had created DED....Don't Ever Disturb.)  So you will know that this is working once you toggle it and see the "X" icons toggle on and off for each line registration...that is the key to this.

 

Note in the above Asterisk source edits that I included the XML schema that the Polycom needs from the server.  This is from a private document I received from Polycom that I cannot share, but for your interest, and for other call servers, the schema for DND status is basically as follows:

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<DoNotDisturbEvent xmlns="http://www.ecma-international.org/standards/ecma-323/csta/ed3">
  <device>[EXTNUM]</device>
  <doNotDisturbOn>[true/false]</doNotDisturbOn>
</DoNotDisturbEvent>

 

... where [EXTNUM] is the extension number and [true/false] indicates whether or not DND is on.

 

If you have a FreePBX installation running with Fop2 (the updated version of the flash operator panel) and everything is configured correctly, you can also see the DND status as it exists on the server-side when you toggle DND on the Polycom phone.

 

I apologize in advance that this isn't a "run this installer/patch" type of solution, but I hope that this knowledge at least gives you the information necessary to implement this with your Polycom phones and your Asterisk server (or another call server).  I believe this covers everything, but let me know if you have any problems, and the symptoms, and I'll go back to double-check if I missed a step.  Know that you edit the Asterisk source at your own risk, although once you get used to it, this is by no means rocket science.

 

Happy server-side DND-ing with Polycom and Asterisk!

Message 18 of 30
Frequent Advisor

Re: Server-based DND using FAC/NOTIFY?

Wow, this is an amazing write-up, thank you portalmedia for taking the time to post your findings!  I have implemented server side DND using softkeys (EFK) mapping them to *76 (DND toggle) and then subscribing to that hint via buddy watch but your solution is much more elegant. 

 

Unfortunately the fact that they have removed the ability to do this with 4.x firmware is a show-stopper for me, as I was preparing to upgrade my desk sets to UCS4 in the coming weeks.  I was really sad to read that.  I don't know what manager made this decision but PLEASE for 4.0.2 can we have this feature back?  I fail to understand just who benefits from yanking features out or hiding config options from users.  A customer is a customer, big or small you never know who-knows-who.  Maybe a guy with a small shop running his own Asterisk server will attract the next "whale" customer.  Every time I see things like this it makes me give a 2nd look at Aastra, Yealink, snom and others.  I love the Polycom build & sound quality that's why I have exclusively used them and recommended them to others but if we're going to be paying the same price for crippled hardware then -- ?? 

Message 19 of 30
Polycom Employee & Community Manager

Re: Server-based DND using FAC/NOTIFY?

Hello Portalmedia & Luckman,

 

 

1st Thanks to Portalmedia for writing this tutorial for the community !

 

Just as an explanation for the community here regarding this DND Functionality.

 

Portalmedia had been provided with a PDF File detailing another originally implemented method working with a Subscribe utilizing a Server Side DND.

 

Every other member of the Community can request this documentation via a Feature Request.

 

The method being discussed in this Post, that was originally documented in the Release Notes only, was not intended for the public and implemented for a project for a Customer under NDA. Polycom is unable to share the exact details and it was implemented in UCS 3.3.x only.

 

The new UCS 4.0.0 or 4.0.1 build have not been tested or verified for this Customer yet so a later release may add/fix the current non working FAC / Notify for UCS 4.0.x

 

Polycom is always interested in the Community Feedback and I will forward this post to the relevant product manager.

 

A working Solution can be developed with the original DND Documentation that can be provided upon request.

 

Best Regards

 

Polycom Global Services




<======== Signature / Disclaimer ========>
Please be aware:For questions about the type of support to expect please check here

Please also ensure you always check the VoIP , Video Endpoint , Skype for Business , PSTN or RPM FAQ's

Please remember, if you see a post that helped you , and it answers your question, please mark it as an "Accept as Solution".

The title Polycom Employee & Community Manager is an automatic setting within the community and any forum reply or post is based upon my personal experience and does not reflect the opinion or view of my employer.
Poly employee participation within this community is not mandatory and any post or FAQ article provided by myself is done either during my working hours or outside working hours, in my private time, and maybe answered on weekends, bank holidays or personal holidays.
Message 20 of 30