<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<base href="https://wiki.asterisk.org/wiki" />
<title>Message Title</title>
<style type="text/css">@media only screen and (max-device-width: 480px) {.mobile-only {
width: auto !important;
height: auto !important;
overflow: visible !important;
line-height: normal !important;
font-size: inherit !important;
mso-hide: all;
}
.desktop-only {
display: none !important;
}
/* iPhone 3GS fix for unwanted 20px right margin */
body { min-width: 100% !important; padding: 0; margin: 0; }
#center-content-table { max-width: none; !important; }
#header-pattern-container { padding: 10px 10px 10px 10px !important; line-height: 20px !important; }
#header-avatar-image-container { padding-right: 8px !important; }
#email-content-container { padding: 0 !important; }
.mobile-expand { border-radius: 0 !important; border-left: 0 !important; border-right: 0 !important; padding-left: 26px !important;}
.mobile-resize-text { font-size: 16px !important; line-height: 22px !important; }
#page-title-pattern-header { font-size: 20px !important; line-height: 28px !important; }
#page-title-pattern-icon-image-container-cell { padding-top: 7px !important; }
#inline-user-pattern { display: block !important; }
#inline-user-pattern-avatar { padding-top: 3px !important; }
.contextual-area-pattern { border-bottom: 1px solid #ccc !important; padding: 15px 10px 0 10px !important;}
.users-involved-pattern-column-table { width: 100% !important; }
.users-involved-pattern-avatar-table-cell { padding: 3px 5px 5px 0 !important; }
.users-involved-pattern-column-container { padding-right: 0 !important; }
.contextual-excerpt-pattern, #users-involved-pattern { border: 0 !important; }
/** Aui Typography upsized for mobile **/
#content-excerpt-pattern-container, #contextual-excerpt-pattern-text-container { font-size: 16px !important; line-height: 22px !important; }
#content-excerpt-pattern-container h1, #contextual-excerpt-pattern-text-container h1 { font-size: 24px !important; line-height: 28px !important; }
#content-excerpt-pattern-container h2, #contextual-excerpt-pattern-text-container h2 { font-size: 20px !important; line-height: 28px !important; }
#content-excerpt-pattern-container h3, #contextual-excerpt-pattern-text-container h3 { font-size: 18px !important; line-height: 24px !important; }
#content-excerpt-pattern-container h4, #contextual-excerpt-pattern-text-container h4 { font-size: 16px !important; line-height: 22px !important; }
#content-excerpt-pattern-container h5, #contextual-excerpt-pattern-text-container h5 { font-size: 14px !important; line-height: 20px !important; }
#content-excerpt-pattern-container h6, #contextual-excerpt-pattern-text-container h6 { font-size: 14px !important; line-height: 20px !important; }
.user-mention { line-height: 18px !important; }
/** Aui Typography end **/
/* Show appropriate footer logo on mobile, display links vertically */
#footer-pattern { padding: 15px 10px !important; }
#footer-pattern-logo-desktop-container { padding: 0 !important; }
#footer-pattern-logo-desktop { width: 0 !important; height: 0 !important; }
#footer-pattern-logo-mobile {
padding-top: 10px !important;
width: 30px !important;
height: 27px !important;
display: inline !important;
}
#footer-pattern-text {
display: block !important;
}
#footer-pattern-links-container { line-height: 0 !important;}
.footer-pattern-links.mobile-resize-text,
.footer-pattern-links.mobile-resize-text,
#footer-pattern-text.mobile-resize-text,
#footer-pattern-links-container.no-footer-links {
font-size: 14px !important;
line-height: 20px !important;
}
.footer-link { display: block !important; }
#footer-pattern-links-container table { display: inline-block !important; float: none !important; }
#footer-pattern-links-container, #footer-pattern-text { text-align: center !important; }
#footer-pattern-links { padding-bottom: 5px !important; }
/** Team Calendar overrides, these should be removed when notifications are updated in Team Calendars. For now CSS
overrides are being used because the structure of the content can't change without rereleasing the plugin */
.mail-calendar-container .day-header + table tr td:first-child {
vertical-align: top !important;
padding-top: 5px !important;
}}
@media (min-width: 900px) {#center-content-table { width: 900px; }}
@media all {#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
/* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
body{-webkit-text-size-adjust:100%; -ms-text-size-adjust:100%;}
.ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
#background-table {margin:0; padding:0; width:100% !important; }
/* Needed to override highlighting on date and time links in iOS */
.grey a {color: #707070; text-decoration: none; }}
</style>
</head>
<body>
<table id="background-table" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; background-color: #f5f5f5">
<tbody>
<tr>
<td id="header-pattern-container" style="padding: 0px; border-collapse: collapse; padding: 10px 20px">
<table id="header-pattern" cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="header-avatar-image-container" valign="top" style="padding: 0px; border-collapse: collapse; vertical-align: top; width: 32px; padding-right: 9px"><a href="https://wiki.asterisk.org/wiki/display/~mmichelson?src=email" style="color: #3b73af; text-decoration: none"><img id="header-avatar-image" class="image_fix" src="cid:avatar_99ed0aa29d6f204db4785296f8170422" height="32" width="32" border="0" style="border-radius: 3px; vertical-align: top" /></a></td>
<td id="header-text-container" valign="middle" style="padding: 0px; border-collapse: collapse; vertical-align: middle; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">Mark Michelson <strong>edited</strong> a page</td>
</tr>
</tbody>
</table> </td>
</tr>
<!-- End Header pattern -->
<tr>
<td id="email-content-container" style="padding: 0px; border-collapse: collapse; padding: 0 20px">
<table id="email-content-table" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; border-spacing: 0; border-collapse: separate">
<tbody>
<tr>
<td class="email-content-rounded-top mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; padding: 0 15px 0 16px; height: 15px; background-color: #fff; border-left: 1px solid #ccc; border-top: 1px solid #ccc; border-right: 1px solid #ccc; border-bottom: 0; border-top-right-radius: 5px; border-top-left-radius: 5px"> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff">
<table id="page-title-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="page-title-pattern-icon-image-container" valign="top" style="padding: 0px; border-collapse: collapse; width: 16px; vertical-align: top">
<table cellspacing="0" cellpadding="0" border="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="page-title-pattern-icon-image-container-cell" style="padding: 0px; border-collapse: collapse; width: 16px; padding: 9px 8px 0px 0px; mso-text-raise: 5px; mso-line-height-rule: exactly"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?src=email" title="page icon" style="vertical-align: top;; color: #3b73af; text-decoration: none"><img style="vertical-align: top; display: block;" src="cid:page-icon" alt="page icon" title="page icon" height="16" width="16" border="0" /></a></td>
</tr>
</tbody>
</table> </td>
<td style="vertical-align: top;; padding: 0px; border-collapse: collapse; padding-right: 5px; font-size: 20px; line-height: 30px; mso-line-height-rule: exactly" id="page-title-pattern-header-container"><span id="page-title-pattern-header" style="font-family: Arial, sans-serif; padding: 0; font-size: 20px; line-height: 30px; mso-text-raise: 2px; mso-line-height-rule: exactly; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?src=email" title="Resource List Subscriptions" style="color: #3b73af; text-decoration: none">Resource List Subscriptions</a></span></td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff">
<table class="content-excerpt-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">
<tbody>
<tr>
<td class="content-excerpt-pattern-container mobile-resize-text " style="padding: 0px; border-collapse: collapse; padding: 0 0 0 24px">
<table class="diff-macro diff-block-target" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/section.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Section</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse">
<table class="diff-macro" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/column.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Column</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse">
<table class="diff-macro" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/warning.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Warning</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse"> <p style="margin: 10px 0 0 0; margin-top: 0">This page is currently incomplete. Please refrain from commenting until this warning is removed.</p> </td>
</tr>
</tbody>
</table> <p style="margin: 10px 0 0 0"> </p> <h1 id="ResourceListSubscriptions-Overview" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0">Overview</h1> <p style="margin: 10px 0 0 0">In a PBX environment, it is common for SIP devices to subscribe to many resources <span class="diff-html-removed" id="removed-diff-0" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">, especially </span><span class="diff-html-added" id="added-diff-0" style="font-size: 100%; background-color: #ddfade;">offered by the PBX. This holds especially true for </span>presence resources. <span class="diff-html-removed" id="removed-diff-1" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">For instance, consider </span><span class="diff-html-added" id="added-diff-1" style="font-size: 100%; background-color: #ddfade;">Consider </span>a small office where an Asterisk server acts as a PBX for 20 people, each with a SIP desk phone. Each of those 20 phones subscribes to the state of the others in the office. In this case, each of the phones would <span class="diff-html-removed" id="removed-diff-2" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">issue </span><span class="diff-html-added" id="added-diff-2" style="font-size: 100%; background-color: #ddfade;">create </span>19 subscriptions (since the phone does not subscribe to its own state)<span class="diff-html-removed" id="removed-diff-3" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">, meaning a total of </span><span class="diff-html-added" id="added-diff-3" style="font-size: 100%; background-color: #ddfade;">. When totaled, the Asterisk server would maintain </span>20 * 19 = 380 subscriptions. For an office with 30 people, the total number of subscriptions becomes 30 * 29 = 870 subscriptions. For an office with 40 people, the total number of subscriptions becomes 40 * 39 = 1560<span class="diff-html-removed" id="removed-diff-4" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">, </span><span class="diff-html-added" id="added-diff-4" style="font-size: 100%; background-color: #ddfade;">. That is </span>about four times the number of subscriptions for the 20-person office, despite only having twice the number of people. The number of subscriptions follows a geometric progression, leading to a situation commonly called an <em>N-squared</em> problem. In other words, the <span class="diff-html-added" id="added-diff-5" style="font-size: 100%; background-color: #ddfade;">amount of traffic generated and amount of server resources required are proportional to the square of the </span>number of <span class="diff-html-removed" id="removed-diff-5" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">devices </span><span class="diff-html-added" id="added-diff-6" style="font-size: 100%; background-color: #ddfade;">users </span>(N) <span class="diff-html-removed" id="removed-diff-6" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">is proportional to its square in the amount of activity generated and resources required</span><span class="diff-html-added" id="added-diff-7" style="font-size: 100%; background-color: #ddfade;">on the system</span>. The N-squared problem with subscriptions can be a limiting factor for PBX deployers for several reasons:</p>
<ul style="margin: 10px 0 0 0">
<li>In a situation where all phones boot up simultaneously, each of the phones will be sending out their SIP SUBSCRIBEs nearly simultaneously, placing a <span class="diff-html-added" id="added-diff-8" style="font-size: 100%; background-color: #ddfade;">larger-than-average </span>burden on the Asterisk server's CPU.</li>
<li>In the SIP stack, N-squared long-term SIP dialogs have to be maintained, tying up more <span class="diff-html-added" id="added-diff-9" style="font-size: 100%; background-color: #ddfade;">system </span>resources <span class="diff-html-added" id="added-diff-10" style="font-size: 100%; background-color: #ddfade;">(e</span>.<span class="diff-html-added" id="added-diff-11" style="font-size: 100%; background-color: #ddfade;">g. memory).</span> </li>
</ul> <p style="margin: 10px 0 0 0">These limitations can <span class="diff-html-removed" id="removed-diff-7" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">result in </span>drastically <span class="diff-html-removed" id="removed-diff-8" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">limiting </span><span class="diff-html-added" id="added-diff-12" style="font-size: 100%; background-color: #ddfade;">limit </span>the number of devices <span class="diff-html-removed" id="removed-diff-9" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">in use on </span><span class="diff-html-added" id="added-diff-13" style="font-size: 100%; background-color: #ddfade;">a PBX administrator can use with </span>an Asterisk system. Even if the hardware is capable of handling the <span class="diff-html-removed" id="removed-diff-10" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">median </span><span class="diff-html-added" id="added-diff-14" style="font-size: 100%; background-color: #ddfade;">mean </span>traffic of<span class="diff-html-added" id="added-diff-15" style="font-size: 100%; background-color: #ddfade;">, say, </span>200 users, it may be required to limit the number of users to 50 or <span class="diff-html-removed" id="removed-diff-11" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">less </span><span class="diff-html-added" id="added-diff-16" style="font-size: 100%; background-color: #ddfade;">fewer </span>because of the N-squared subscriptions problem.</p> </td>
</tr>
</tbody>
</table>
<table class="diff-macro" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/column.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Column</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; padding: 0px; border-collapse: collapse">
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">width</td>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">25%</td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse">
<table class="diff-macro" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/panel.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Panel</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; padding: 0px; border-collapse: collapse">
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">title</td>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">On this Page</td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse"> <p style="margin: 10px 0 0 0; margin-top: 0"></p>
<table class="diff-macro bodyless" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;margin: 5px 0; padding: 0; width: auto;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/images/icons/macrobrowser/dropdown/toc.png" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Table of Contents</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-properties" style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;padding: 0; border: 1px solid #dddddd;; padding: 0px; border-collapse: collapse">
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">maxLevel</td>
<td style="background-color: #fafafa; padding: 0 0 0 5px; font-size: 12px; text-align: left;; padding: 0px; border-collapse: collapse">2</td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> <p style="margin: 10px 0 0 0"></p> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-target" style="margin: 10px 0 0 0">A proposed solution to this problem is to implement <a href="http://www.rfc-editor.org/rfc/rfc4662.txt" class="external-link" rel="nofollow" style="color: #3b73af; text-decoration: none">RFC 4662 Resource List Subscriptions</a> (abbreviated RLS from here on). This RFC describes a method for SIP servers to map a single requested resource to a list of resources. In the example 20-person office from before, a list could be configured that contained all 20 users' phones. Each phone could then establish a single subscription to that list rather than having to establish 20 different subscriptions <span class="diff-html-added" id="added-diff-17" style="font-size: 100%; background-color: #ddfade;">to each individual user's phone</span>. In addition, notifications can list multiple resources in a single message, allowing for Asterisk to send fewer notifications.</p> <p class="diff-block-target" style="margin: 10px 0 0 0">In addition to resolving the N-squared problem, configurable lists also allows for more intuitive creation of useful sub-lists of users. In an office, you could have a "Sales" list, an "Engineering" list, a "Tech Support" list, etc. Lists are not restricted to being <span class="diff-html-added" id="added-diff-18" style="font-size: 100%; background-color: #ddfade;">composed </span>of individual devices; lists can <span class="diff-html-removed" id="removed-diff-12" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">also have lists as items within them</span><span class="diff-html-added" id="added-diff-19" style="font-size: 100%; background-color: #ddfade;">be made of other lists</span>. This makes it possible to have an "All" list, composed of the Sales, Engineering, and Tech Support lists, for instance.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">This first part is a behind-the-scenes improvement. Currently, the layer between Asterisk's SIP subscription handlers and the underlying dialog maintained by PJSIP is <span class="diff-html-removed" id="removed-diff-13" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">too </span>thin. Asterisk subscription handlers <span class="diff-html-removed" id="removed-diff-14" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">will </span>directly call into PJSIP in order to create NOTIFY requests to send or to accept incoming subscriptions. When using RLS, a single RLS subscription can result in multiple <span class="diff-html-removed" id="removed-diff-15" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">"</span> virtual <span class="diff-html-removed" id="removed-diff-16" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">" </span>subscriptions for the subscription handlers. Each of these <span class="diff-html-added" id="added-diff-20" style="font-size: 100%; background-color: #ddfade;">virtual </span>subscriptions should behave the same as a real subscription, but under the hood, the pubsub core in Asterisk should be capable of doing the right thing if the subscription is actually virtual. This requires <span class="diff-html-removed" id="removed-diff-17" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">an improvement for </span><span class="diff-html-added" id="added-diff-21" style="font-size: 100%; background-color: #ddfade;">improvements to </span>the pubsub API in order to <span class="diff-html-removed" id="removed-diff-18" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">create </span>abstract operations.</p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">Since the changes are <span class="diff-html-removed" id="removed-diff-19" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">quite </span>large and deal with behind-the-scenes content, the have been relegated to their own <a class="confluence-link unresolved" href="#" style="color: #3b73af; text-decoration: none">sub-page</a>.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">Once the subscription model has been abstracted, it is possible to implement support for single-server inbound RLS.</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <h2 id="ResourceListSubscriptions-Implementconfigurationmethod" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-added" id="added-diff-22" style="font-size: 100%; background-color: #ddfade;">Implement </span><span class="diff-html-changed" id="changed-diff-0" style="background-color: #d6f0ff;">configuration method</span> </h2> <p class="diff-block-context" style="margin: 10px 0 0 0">RFC 4662 is purposefully vague about how a SIP server sets up its resource lists. For Asterisk, we need to determine a configuration scheme to use for setting up lists. Configuration needs to take into acocunt</p> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-context" style="margin: 10px 0 0 0">RLMI stands for "Resource List Meta-Information". It is an XML document used by an RLS subscriber to determine what content to expect in the parts of the multi-part body to follow. In order to be able to construct an accurate RLMI body, the following information is necessary:</p>
<ul class="diff-block-target" style="margin: 10px 0 0 0">
<li>A URI for the list. <span class="diff-html-removed" id="removed-diff-21" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Can </span><span class="diff-html-added" id="added-diff-23" style="font-size: 100%; background-color: #ddfade;">This can </span>be derived from the saved resource name on the <code style="font-family: monospace">ast_sip_subscription</code>.</li>
<li>A version number. This is a monotonically increasing number to include in each RLMI document.</li>
<li>An indicator if full or partial state is to be sent in this document.</li>
<li>For each resource being reported on:
<ul style="margin: 10px 0 0 0; margin-top: 0">
<li>A display name for the resource. We can simply use the resource name saved on the subscription.</li>
<li>A unique ID for each instance of the resource. Since we currently are not dealing with forked outbound-subscriptions, the resource name should suffice here.</li>
<li>The Content ID for the body section for each subscription being reported.</li>
<li>The current subscription state (i.e. active, pending, or terminated)</li>
</ul> </li>
</ul> <p class="diff-block-context" style="margin: 10px 0 0 0">An RLMI document can be constructed using the following structure:</p>
<table class="diff-macro diff-block-target" style="background-color: #f0f0f0;border: 1px solid #dddddd;margin: 10px 1px;padding: 0 2px 2px;width: 100%;; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<thead>
<tr>
<th class="diff-macro-title" style="background-color: transparent; text-align: left; font-weight: normal;padding: 5px;"><span class="icon macro-placeholder-icon" style="background-color: ;line-height: 20px;"><img src="https://wiki.asterisk.org/wiki/s/en_GB-1988229788/4732/f543bd9a3bbc12daed85f6f5e5cba84282599932.48/_/plugins/servlet/confluence/placeholder/macro-icon?name=code" style="padding-right: 5px; vertical-align: text-bottom;" /> </span>Code Block</th>
</tr>
</thead>
<tbody>
<tr>
<td class="diff-macro-body" style="background-color: #fff;border: 1px solid #dddddd;padding: 10px;; padding: 0px; border-collapse: collapse"> <pre style="margin: 10px 0 0 0; margin-top: 0">struct rlmi_<span class="diff-html-removed" id="removed-diff-22" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">information</span><span class="diff-html-added" id="added-diff-24" style="font-size: 100%; background-color: #ddfade;">data</span> {
struct ast_sip_subscription *list_subscription;
AST_LIST_HEAD(,ast_list_subscription) child_subscriptions;
}; </pre> </td>
</tr>
</tbody>
</table> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <h2 id="ResourceListSubscriptions-ImplementRLSsubscriptions" class="diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0">Implement RLS subscriptions</h2> <h3 id="ResourceListSubscriptions-Addinboundsubscriptionhandling" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 16px; line-height: 25px; margin: 30px 0 0 0; margin-top: 10px"> <span class="diff-html-changed" id="changed-diff-1" style="background-color: #d6f0ff;">Add inbound subscription handling</span> </h3> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">When an inbound SUBSCRIBE arrives, the pubsub layer needs to be able to determine if the requested resource is a list or not. Unfortunately, there is not anything in the inbound SUBSCRIBE that can tell us if <span class="diff-html-removed" id="removed-diff-23" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">this </span><span class="diff-html-added" id="added-diff-25" style="font-size: 100%; background-color: #ddfade;">the intent </span>is <span class="diff-html-removed" id="removed-diff-24" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">a subscription </span>to <span class="diff-html-added" id="added-diff-26" style="font-size: 100%; background-color: #ddfade;">subscribe to </span>a list (the SUBSCRIBE can indicate support for RLS and application/rlmi+xml, but that does not guarantee that the requested resource is a list).</p> <p class="diff-block-target" style="margin: 10px 0 0 0"> <span class="diff-html-removed" id="removed-diff-25" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Inbound SUBSCRIBEs will need to first check if the requested resource is a list. If </span><span class="diff-html-added" id="added-diff-27" style="font-size: 100%; background-color: #ddfade;">When an inbound SUBSCRIBE is received, the first thing that needs to happen is to check the SUBSCRIBE's Supported header to see if it supports "eventlist" and check its Accept header to see if it accepts "application/rlmi+xml" and "multipart/related". If any of these conditions are not met, then the SUBSCRIBE can only be to a single resource, not a list. If all conditions are met, then Asterisk will attempt to locate a list that corresponds to the resource name. If </span>there is no corresponding list, then <span class="diff-html-removed" id="removed-diff-26" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">fall back to single-resource behavior that currently exists</span><span class="diff-html-added" id="added-diff-28" style="font-size: 100%; background-color: #ddfade;">Asterisk will attempt to subscribe to a single resource</span>.</p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">If the requested resource is a list, then a single real <span class="diff-html-added" id="added-diff-29" style="font-size: 100%; background-color: #ddfade;">list </span>subscription is created, and a corresponding set of virtual <span class="diff-html-added" id="added-diff-30" style="font-size: 100%; background-color: #ddfade;">child </span>subscriptions is added for each of the resources in the list. These virtual subscriptions will be distributed to the subscription handlers for the event package being subscribed to. The subscription handlers will treat this virtual subscription exactly the same way they treat real subscriptions.</p> <p class="diff-block-context" style="margin: 10px 0 0 0">Keep in mind that resources in a list may themselves be lists. This means that for each individual resource within the list, it will be necessary to again check if the resource is a list first before passing the named resource into the subscription handler.</p> <h3 id="ResourceListSubscriptions-AddnecessaryNOTIFYhandling" class="diff-block-target" style="margin: 10px 0 0 0; font-size: 16px; line-height: 25px; margin: 30px 0 0 0"> <span class="diff-html-changed" id="changed-diff-2" style="background-color: #d6f0ff;">Add necessary NOTIFY handling</span> </h3> <p class="diff-block-context" style="margin: 10px 0 0 0">With the abstraction being completed in Task 1, notifiers should now be calling a single method in the pubsub API in order to send a notification. This task involves modifying that method to work properly for RLS.</p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">When the pubsub API is asked to send a notification, it needs to determine if the subscription is virtual or real. If <span class="diff-html-added" id="added-diff-31" style="font-size: 100%; background-color: #ddfade;">the subscription is </span>real, then the <span class="diff-html-removed" id="removed-diff-27" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">notification is sent.If the subscription is virtual, then the notification body needs to be built and that needs to be passed up to the parent subscription. The parent subscription, while not necessarily real, will definitely be a list. The list will create an appropriate multipart body (this may be a full or partial body, depending on configuration). If this list subscription is real, then the notification is sent out. If the list subscription is virtual, then the created multipart body is passed up to the parent and the process is repeated</span><span class="diff-html-added" id="added-diff-32" style="font-size: 100%; background-color: #ddfade;">current algorithm for sending SIP NOTIFYs is followed (i.e. the NOTIFY is constructed and sent).</span> </p> <h4 id="ResourceListSubscriptions-VirtualsubscriptionNOTIFYalgorithm:" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Virtual subscription NOTIFY algorithm:</span> </h4>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Create a NOTIFY body indicating the state of the resource being monitored.</span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Save the body on the subscription (possibly using a datastore, though we may end up adding a field to </span></span><code style="line-height: 1.4285715;; font-family: monospace"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">ast_sip_subscription</span></code><span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> to hold the body instead).</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Set a flag on the subscription (possibly using the same datastore the body is stored in indicating that this subscription has had a state change).</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Call </span></span><code style="line-height: 1.4285715;; font-family: monospace"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">ast_sip_subscription_notify</span></code><span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> on the parent list subscription.</span></span> </li>
</ol> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">From here, the duty to create the NOTIFY has been passed up the chain to the list subscription.</span> </p> <h4 id="ResourceListSubscriptions-ListsubscriptionNOTIFYalgorithm:" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">List subscription NOTIFY algorithm:</span> </h4>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Check the configured </span></span><code style="line-height: 1.4285715;; font-family: monospace"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">full_state</span></code><span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> value for the subscription</span></span>
<ol style="margin: 10px 0 0 0">
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">If set to "yes" then iterate over all child subscriptions and gather the saved NOTIFY bodies on each.</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">If set to "no" then iterate over the child subscriptions and gather the saved NOTIFY bodies on the ones that indicate they have had a state change. As each body is gathered, clear the flag indicating that the state had changed.</span></span> </li>
</ol> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Create an application/rlmi+xml body that properly identifies the gathered bodies.</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Create multipart/related body that contains the application/rlmi+xml body and the gathered child bodies.</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Check if the list subscription is virtual</span></span>
<ol style="margin: 10px 0 0 0">
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">If the subscription is not virtual, then send out a NOTIFY with the constructed multipart/related body.</span></span> </li>
<li> <span style="line-height: 1.4285715;"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">If the subscription is virtual, then follow virtual subscription NOTIFY algorithm, starting at step 2 since the body has already been constructed</span><span class="diff-html-changed" id="changed-diff-3" style="background-color: #d6f0ff;">.</span></span> </li>
</ol> </li>
</ol> <h3 id="ResourceListSubscriptions-Implementbatchednotifications" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 16px; line-height: 25px; margin: 30px 0 0 0"> <span style="color: rgb(133,120,102);"><span class="diff-html-changed" id="changed-diff-5" style="background-color: #d6f0ff;">Implement batched notifications</span></span> </h3> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">This alters notification behavior by accumulating data and sending the data out in a batch rather than sending individual state changes in real time. Notification batching behavior is based on configuration for a list. </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">If batching is enabled, then a notification is to be sent on a real list subscription, the notification is not actually sent. Instead, the data to be sent is kept in memory and a timer is started. Any additional changes to resources in the list can be added to the batch if they occur before the timer expires. When the timer expires, the stored resource state is sent in a single NOTIFY.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Note that list subscriptions that are virtual do not implement any batching behavior. This is because it is unnecessary to do so since batching should occur on a parent real subscription. If a virtual list subscription has batching enabled, the setting is ignored.</span> </p> <h4 id="ResourceListSubscriptions-Batchingalgorithm" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Batching algorithm</span> </h4> <p class="diff-context-placeholder" style="margin: 10px 0 0 0">...</p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" id="added-diff-33" style="font-size: 100%; background-color: #ddfade;">Batching is configured using the </span><code style="font-family: monospace"><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">notification_batch_interval</span></code><span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;"> configuration option for a list. If set to a positive value, then batching is enabled for the list.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">If batching is enabled on a real list subscription, then the List subscription NOTIFY algorithm is replaced as follows:</span> </p>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Check if there is currently a batch </span>in progress.
<ol style="margin: 10px 0 0 0">
<li>If there is<span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;"> </span><span class="diff-html-removed" id="removed-diff-29" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">no batch in progress, follow the batch creation algorithm</span><span class="diff-html-added" id="added-diff-34" style="font-size: 100%; background-color: #ddfade;">, then do nothing.</span> </li>
<li>If there is <span class="diff-html-removed" id="removed-diff-30" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">a batch in progress, follow the batch update algorithm</span> </li>
</ol> </li>
</ol> <h4 id="ResourceListSubscriptions-Batchcreationalgorithm" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Batch creation algorithm</span> </h4>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">A datastore is placed on the list subscription that indicates that there is now a batch in progress.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">The body provided by the child subscription is placed in a datastore on the child subscription.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">A batch dispatch task is scheduled. The expiration is based on the notification_batch_interval setting for the list. The argument to the dispatch task is a reference to the list subscription.</span> </li>
</ol> <h4 id="ResourceListSubscriptions-Batchupdatealgorithm" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Batch update algorithm</span> </h4>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">If the child subscription whose state has updated has a body datastore on it, then the old body is replaced with the new body.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">If the child subscription whose state has updated does not have a body datastore on it, then the body is placed in a datastore on the child subscription.</span> </li>
</ol> <h4 id="ResourceListSubscriptions-Batchdispatchalgorithm" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 14px; line-height: 20px; margin: 20px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Batch dispatch algorithm</span> </h4>
<ol class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Each child subscriptions that has a body datastore on it has its body added to a multipart body to be sent in a NOTIFY.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">A NOTIFY multipart body is generated. It will contain an RLMI element along with each of the body parts from step 1.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">All body datastores are removed from the child subscriptions.</span> </li>
<li> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">The datastore indicating that a batch is in progress is removed from the list subscription</span>
<ol style="margin: 10px 0 0 0">
<li> <span class="diff-html-added" id="added-diff-35" style="font-size: 100%; background-color: #ddfade;">not, then schedule a batch dispatch task to occur.</span> </li>
</ol> </li>
</ol> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">It's a pretty simple algorithm. The batch dispatch task follows the exact same steps as the List subscription NOTIFY algorithm from the previous section.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Batching tasks will, at times, need to be canceled since a NOTIFY needs to immediately be sent out. Batching cancellation will occur if:</span> </p>
<ul class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The subscriber resubscribes to the list.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The subscriber terminates its subscription to the list</span><span class="diff-html-changed" id="changed-diff-7" style="background-color: #d6f0ff;">.</span> </li>
</ul> <h1 id="ResourceListSubscriptions-Task3:Multi-ServerSupport" class="diff-block-context" style="margin: 10px 0 0 0; font-size: 24px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0">Task 3: Multi-Server Support</h1> <p class="diff-block-context" style="margin: 10px 0 0 0">With Task 2 accomplished, Asterisk will have RLS support on a single server. RLS support would be richer if Asterisk had the ability to subscribe to, receive notifications from, publish to, and receive publications from other SIP servers. With these facilities in place, Asterisk could set up mixed lists of local and remote resources.</p> <h2 id="ResourceListSubscriptions-Outboundsubscriptions" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-removed" id="removed-diff-31" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">Outbound subscriptions</span> </h2> <h2 id="ResourceListSubscriptions-"Passthrough"subscriptions" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">"Passthrough" subscriptions</span> </h2> <h2 id="ResourceListSubscriptions-PUBLISHsupport" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">PUBLISH support</span> </h2> <h2 id="ResourceListSubscriptions-RLSmodifications" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;">RLS modifications</span> </h2> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-removed" style="font-size: 100%; background-color: #ffe7e7; text-decoration: line-through;"> </span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" id="added-diff-36" style="font-size: 100%; background-color: #ddfade;">While multi-server support would be nice to have, it adds a load of work to be accomplished. With the looming feature freeze of Asterisk 13, this likely will have to wait until the next version of Asterisk to be completed. For now, here are some notes on what would be required to have multi-server support for RLS.</span> </p> <h2 id="ResourceListSubscriptions-PUBLISHsupport" class="diff-block-target diff-block-context" style="margin: 10px 0 0 0; font-size: 20px; font-weight: normal; line-height: 30px; margin: 40px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">PUBLISH support</span> </h2> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">While RLS could be implemented by passing subscriptions through Asterisk to external servers, a preferred method would be to terminate the subscription on the Asterisk server and receive SIP PUBLISHes to update state on remote resources. When a subscription arrives, the resource being subscribed to may or may not exist on the Asterisk server. If the resource does not exist, then instead of rejecting the SUBSCRIBE request, Asterisk will instead accept the request and keep the subscription in a pending state if state cannot be determined for the requested resource. External resources can then PUBLISH state to Asterisk, and Asterisk can NOTIFY interested parties of the state of the resource.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">The flip-side of this is that Asterisk could also be configured to PUBLISH the state of local resources to remote servers. This would allow for a cluster of Asterisk boxes to be able to share the state of various resources between each other and allow for devices on any individual Asterisk server to be given the state of resources on any of the servers.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">As far as RLS is concerned, this would allow for resource lists to consist of both local and remote resources.</span> </p> <p class="diff-block-target diff-block-context" style="margin: 10px 0 0 0"> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">We already have a bit of a head start on PUBLISH support since we have an API for handling incoming PUBLISH in res_pjsip_pubsub.c. However, there is much more work that would need to be done in order to have full multi-server support, including:</span> </p>
<ul class="diff-block-target diff-block-context" style="margin: 10px 0 0 0">
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Modifying the core PBX code such that it is not dependent on handling only local extension states.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Modifying the pubsub API to know about pending subscriptions and how to indicate these properly.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Writing parsers for body documents that can be received in incoming PUBLISH requests.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">Writing an API for sending outbound PUBLISHes. Initially, it was thought we would use PJSIP's API directly, but given that we will have the same abstraction requirements for publications that we have for RLS, using the PJSIP API directly is not an option. This API would need to include resource list publication support as well.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">While stasis currently has the concept of internal and external resources built into it, it's probably important for this to be built into the pubsub core as well. For instance, URIs generated for resources are currently only concerned with the user portion, since the domain part corresponds to the local Asterisk box. However, with remote resources, the URI will need to be constructed differently.</span> </li>
<li> <span class="diff-html-added" style="font-size: 100%; background-color: #ddfade;">A configuration section that illustrates what to publish and to whom, and whether to publish the resources as a list or as individual publications.</span> </li>
</ul> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-main mobile-expand action-padding last-row-padding" style="padding: 0px; border-collapse: collapse; border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: 0; border-bottom: 0; padding: 0 15px 15px 16px; background-color: #fff; padding-bottom: 10px; padding-bottom: 10px">
<table id="actions-pattern" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 1px">
<tbody>
<tr>
<td id="actions-pattern-container" valign="middle" style="padding: 0px; border-collapse: collapse; padding: 15px 0 0 24px; vertical-align: middle">
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?src=email" title="View page" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" src="cid:confluence.mail.templates.view.page" alt="View page-icon" title="View page-icon" height="16" width="16" border="0" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?src=email" title="View page" style="color: #3b73af; text-decoration: none">View page</a></td>
<td class="actions-pattern-action-bull" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; color: #999; padding: 0 5px">•</td>
</tr>
</tbody>
</table>
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?showComments=true&showCommentArea=true#addcomment" title="Add comment" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" src="cid:confluence.mail.templates.add.comment" alt="Add comment-icon" title="Add comment-icon" height="16" width="16" border="0" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscriptions?showComments=true&showCommentArea=true#addcomment" title="Add comment" style="color: #3b73af; text-decoration: none">Add comment</a></td>
<td class="actions-pattern-action-bull" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; color: #999; padding: 0 5px">•</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td class="actions-pattern-action-icon-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 0px; vertical-align: middle"><a href="https://wiki.asterisk.org/wiki/plugins/likes/like.action?contentId=28934182&src=email" title="Like" style="color: #3b73af; text-decoration: none"><img class="actions-pattern-action-icon-image" src="cid:likes.like" alt="Like-icon" title="Like-icon" height="16" width="16" border="0" style="vertical-align: middle" /></a></td>
<td class="actions-pattern-action-text-container" style="padding: 0px; border-collapse: collapse; font-family: Arial, sans-serif; font-size: 14px; line-height: 20px; mso-line-height-rule: exactly; mso-text-raise: 4px; padding-left: 5px; white-space: nowrap"><a href="https://wiki.asterisk.org/wiki/plugins/likes/like.action?contentId=28934182&src=email" title="Like" style="color: #3b73af; text-decoration: none">Like</a></td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td class="email-content-rounded-bottom mobile-expand" style="padding: 0px; border-collapse: collapse; color: #fff; height: 5px; line-height: 5px; padding: 0 15px 0 16px; background-color: #fff; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-top: 0; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; border-right: 1px solid #ccc; mso-line-height-rule: exactly"> </td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td id="footer-pattern" style="padding: 0px; border-collapse: collapse; padding: 12px 20px">
<table id="footer-pattern-container" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333">
<tbody>
<tr>
<td id="footer-pattern-links-container" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<table align="left" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<tbody>
<tr>
<td class="footer-pattern-links mobile-resize-text" style="padding: 0px; border-collapse: collapse"><a href="https://wiki.asterisk.org/wiki/users/removespacenotification.action?spaceKey=AST&src=email" title="" style="color: #3b73af; text-decoration: none">Stop watching space</a></td>
<td class="footer-pattern-links-bull" style="padding: 0px; border-collapse: collapse; padding: 0 5px; color: #999">•</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px">
<tbody>
<tr>
<td class="footer-pattern-links mobile-resize-text" style="padding: 0px; border-collapse: collapse"><a href="https://wiki.asterisk.org/wiki/users/editmyemailsettings.action?src=email" title="" style="color: #3b73af; text-decoration: none">Manage notifications</a></td>
</tr>
</tbody>
</table> </td>
</tr>
<tr>
<td id="footer-pattern-text" class="mobile-resize-text" width="100%" style="padding: 0px; border-collapse: collapse; color: #999; font-size: 12px; line-height: 18px; font-family: Arial, sans-serif; mso-line-height-rule: exactly; mso-text-raise: 2px; display: none">This message was sent by Atlassian Confluence 5.4.3</td>
</tr>
</tbody>
</table> </td>
</tr>
</tbody>
</table>
<table id="sealed-section" border="0" cellpadding="0" cellspacing="0" width="0" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #333; display: none">
<tbody>
<tr>
<td style="padding: 0px; border-collapse: collapse; border: 0; font-size: 0px; line-height: 0; mso-line-height-rule: exactly"></td>
</tr>
</tbody>
</table>
</body>
</html>