<div dir="ltr"><div dir="ltr">On Thu, Oct 20, 2022 at 8:23 PM <<a href="mailto:asterisk@phreaknet.org">asterisk@phreaknet.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, all,<br>
<br>
     Something I have been working on recently is adding support to <br>
PJSIP for device feature key synchronization (the as-feature-event <br>
Broadworks spec that many common IP phones, e.g. Polycom support) to <br>
control server-side features from endpoints. It's using the PJSIP <br>
pub/sub capabilities; I had to add the ability to execute a custom <br>
module callback when a SUBSCRIBE is refreshed, but with that addition, <br>
it works as it's supposed to.<br></blockquote><div><br></div><div>You should further elaborate on all of the server-side features you expect to implement, if it extends beyond DND.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I wanted to solicit some input on what an ideal way of triggering <br>
updates should be. Currently we have hints, which actually work <br>
reasonably all right for Do Not Disturb, which is simply a boolean <br>
on/off, easily represented with a hint and custom device state for DND. <br>
The PJSIP module emits an AMI event, the user can process it and change <br>
the device state if needed, which will trigger a NOTIFY to go out to the <br>
endpoint.<br></blockquote><div><br></div><div>What user? An outside AMI application? An internal consumer in Asterisk?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
This sort of came up about 12 years ago[1]. The actual SIP stuff is not <br>
complicated; it's the user interface to it that requires more thought. <br>
For call forwarding, there are more moving pieces and abusing <br>
hints/custom device state for that is super clunky. You can't <br>
communicate the call forwarding target, # of rings, etc. in a device <br>
state, so additional hints are then needed for that. It works but it's <br>
super clunky and I don't think this is a great pipeline.<br></blockquote><div><br></div><div>Okay, so this covers call forwarding as well.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
I'm wondering if people have thoughts on what an ideal mechanism would <br>
be for users, once they process a request to enable/disable a feature <br>
from the phone, to communicate that to the PJSIP module. The problem <br>
with abusing hints, especially for call forwarding, is it's not a good <br>
way to communicate details into the module. One option perhaps is to <br>
have dialplan extensions, setup in a manner similar to use with <br>
EVAL_EXTEN, where it returns the current value needed, as any relevant <br>
function, DB, ODBC, CURL, custom function, etc. could be used to <br>
retrieve the current feature value. The clunky part is more signaling to <br>
the PJSIP module that it needs to send the phone the updated status (by <br>
checking those extensions, for example). The device state callback <br>
happens to be convenient for this kind of signaling but not really <br>
appropriate here. It would be better to push the info into the module <br>
directly rather than the signaling it and making it retrieve the updated <br>
data in some arbitrary way.<br>
<br>
So with this in mind, I'm currently leaning in the direction of a <br>
dialplan function/AMI action that could be used to set the appropriate <br>
info for a subscription, which would trigger the NOTIFY, and then <br>
nothing would actually need to be added to the dialplan at all (inasmuch <br>
as hints and things of that nature). One d I think starting purely from that perspective</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">isadvantage of this is that <br>
for every single update, unlike callbacks, we have to traverse the <br>
entire list of subscriptions (though maybe that's not a big deal). The <br>
bigger problem is this is push only and the PJSIP module still needs to <br>
be able to "pull" feature statuses on demand, which is where the <br>
hint/lookup model is useful. A potential middle ground solution is use <br>
the dialplan function/AMI action to push only, but cache all of this in <br>
AstDB (as subscriptions themselves are), so that we can retrieve the <br>
latest/most current value at any point if needed. Then we don't need to <br>
be concerned at all with how the user is managing state as that is fully <br>
decoupled, although obviously this would lead to a little <br>
duplication/redundancy. Any thoughts?<br></blockquote><div><br></div><div>You've thrown a lot of lower level implementation details at us and to be quite honest it's overwhelming. There's no full user facing examples of how it would all work, beyond the bits and pieces in your text that we'd then have to deduce and after reading a few times it doesn't feel very friendly. To start off with: Is this a developer API and interface, or is this also meant for the common everyday user? I would hope it's for the common everyday user, in which case it should be approached from that perspective first with implementation details following.</div><div><br></div><div>As an everyday user I'd expect not to have to deal with AMI or complex dialplan. I'd expect to be able to set and get the information from the dialplan using dialplan functions (or a single function) so I could use that in the dialplan, and have it "just work" with my phones that support the feature. I'd expect it to persist across Asterisk restarts. For example ${EXTENSION_DND(alice)} for retrieving DND status of Alice, and if Asterisk restarted then that should stay the same.</div><div><br></div><div>For developers the same thing could apply except having AMI actions to set and get.</div><div><br></div><div>Functionally this is a simple storage mechanism of data. The AstDB is used to persist such information. It could use sorcery to then be backed by a real database. The manipulation could be like I said previously, using dialplan functions with also AMI actions. To get the information to consumers it would be a defined API to allow setting/getting/subscribing/anything else, and for pushing to consumers it would use stasis which would also give AMI events when things changed. It's sorta like device state, but with persistent data and simpler.</div><div><br></div><div>This would also need explicit configuration to ensure that stale data doesn't persist in the persistent storage.</div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div style="font-family:tahoma,sans-serif"><font color="#073763">Joshua C. Colp</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Asterisk Project Lead</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Sangoma Technologies</font></div><div style="font-family:tahoma,sans-serif"><font color="#073763">Check us out at <a href="http://www.sangoma.com" target="_blank">www.sangoma.com</a> and <a href="http://www.asterisk.org" target="_blank">www.asterisk.org</a></font><br></div></div></div></div></div></div></div></div></div></div></div>