<p>Sean Bright has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10510">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">func_callerid: Remove deprecated CALLERPRES() function.<br><br>Change-Id: Ia1b2b386505b3102136dab02c45eaaf09f0f89c5<br>---<br>M UPGRADE.txt<br>M funcs/func_callerid.c<br>2 files changed, 6 insertions(+), 123 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/10510/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/UPGRADE.txt b/UPGRADE.txt</span><br><span>index b7bbf3b..cbaa87a 100644</span><br><span>--- a/UPGRADE.txt</span><br><span>+++ b/UPGRADE.txt</span><br><span>@@ -25,3 +25,7 @@</span><br><span> === UPGRADE-16.txt  -- Upgrade info for 15 to 16</span><br><span> ===========================================================</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+From 16 to 17:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+* The CALLERPRES() dialplan function, deprecated in Asterisk 1.8, has been</span><br><span style="color: hsl(120, 100%, 40%);">+  removed.</span><br><span>diff --git a/funcs/func_callerid.c b/funcs/func_callerid.c</span><br><span>index 0b6ab51..80cca9a 100644</span><br><span>--- a/funcs/func_callerid.c</span><br><span>+++ b/funcs/func_callerid.c</span><br><span>@@ -152,48 +152,6 @@</span><br><span>                   </enumlist></span><br><span>            </description></span><br><span>         </function></span><br><span style="color: hsl(0, 100%, 40%);">-       <function name="CALLERPRES" language="en_US"></span><br><span style="color: hsl(0, 100%, 40%);">-         <synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-                        Gets or sets Caller*ID presentation on the channel.</span><br><span style="color: hsl(0, 100%, 40%);">-             </synopsis></span><br><span style="color: hsl(0, 100%, 40%);">-               <syntax /></span><br><span style="color: hsl(0, 100%, 40%);">-                <description></span><br><span style="color: hsl(0, 100%, 40%);">-                     <para>Gets or sets Caller*ID presentation on the channel.</span><br><span style="color: hsl(0, 100%, 40%);">-                 This function is deprecated in favor of CALLERID(num-pres)</span><br><span style="color: hsl(0, 100%, 40%);">-                      and CALLERID(name-pres) or CALLERID(pres) to get/set both</span><br><span style="color: hsl(0, 100%, 40%);">-                       at once.</span><br><span style="color: hsl(0, 100%, 40%);">-                        The following values are valid:</para></span><br><span style="color: hsl(0, 100%, 40%);">-                    <enumlist></span><br><span style="color: hsl(0, 100%, 40%);">-                                <enum name="allowed_not_screened"></span><br><span style="color: hsl(0, 100%, 40%);">-                                      <para>Presentation Allowed, Not Screened.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                            </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="allowed_passed_screen"></span><br><span style="color: hsl(0, 100%, 40%);">-                                     <para>Presentation Allowed, Passed Screen.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                           </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="allowed_failed_screen"></span><br><span style="color: hsl(0, 100%, 40%);">-                                     <para>Presentation Allowed, Failed Screen.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                           </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="allowed"></span><br><span style="color: hsl(0, 100%, 40%);">-                                   <para>Presentation Allowed, Network Number.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                          </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="prohib_not_screened"></span><br><span style="color: hsl(0, 100%, 40%);">-                                       <para>Presentation Prohibited, Not Screened.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                         </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="prohib_passed_screen"></span><br><span style="color: hsl(0, 100%, 40%);">-                                      <para>Presentation Prohibited, Passed Screen.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                                </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="prohib_failed_screen"></span><br><span style="color: hsl(0, 100%, 40%);">-                                      <para>Presentation Prohibited, Failed Screen.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                                </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="prohib"></span><br><span style="color: hsl(0, 100%, 40%);">-                                    <para>Presentation Prohibited, Network Number.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                               </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                           <enum name="unavailable"></span><br><span style="color: hsl(0, 100%, 40%);">-                                       <para>Number Unavailable.</para></span><br><span style="color: hsl(0, 100%, 40%);">-                            </enum></span><br><span style="color: hsl(0, 100%, 40%);">-                   </enumlist></span><br><span style="color: hsl(0, 100%, 40%);">-               </description></span><br><span style="color: hsl(0, 100%, 40%);">-    </function></span><br><span>    <function name="CONNECTEDLINE" language="en_US"></span><br><span>           <synopsis></span><br><span>                     Gets or sets Connected Line data on the channel.</span><br><span>@@ -892,76 +850,6 @@</span><br><span>      return status;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/*! TRUE if we have already notified about CALLERPRES being deprecated. */</span><br><span style="color: hsl(0, 100%, 40%);">-static int callerpres_deprecate_notify;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \internal</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief Read values from the caller-id presentation information struct.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \param chan Asterisk channel to read</span><br><span style="color: hsl(0, 100%, 40%);">- * \param cmd Not used</span><br><span style="color: hsl(0, 100%, 40%);">- * \param data Caller-id presentation function datatype string</span><br><span style="color: hsl(0, 100%, 40%);">- * \param buf Buffer to fill with read value.</span><br><span style="color: hsl(0, 100%, 40%);">- * \param len Length of the buffer</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \retval 0 on success.</span><br><span style="color: hsl(0, 100%, 40%);">- * \retval -1 on error.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int callerpres_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!chan) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);</span><br><span style="color: hsl(0, 100%, 40%);">-               return -1;</span><br><span style="color: hsl(0, 100%, 40%);">-      }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!callerpres_deprecate_notify) {</span><br><span style="color: hsl(0, 100%, 40%);">-             callerpres_deprecate_notify = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_log(LOG_WARNING, "CALLERPRES is deprecated."</span><br><span style="color: hsl(0, 100%, 40%);">-                      "  Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-        }</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_copy_string(buf,</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_named_caller_presentation(ast_party_id_presentation(&ast_channel_caller(chan)->id)), len);</span><br><span style="color: hsl(0, 100%, 40%);">-   return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*!</span><br><span style="color: hsl(0, 100%, 40%);">- * \internal</span><br><span style="color: hsl(0, 100%, 40%);">- * \brief Write new values to the caller-id presentation information struct.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \param chan Asterisk channel to update</span><br><span style="color: hsl(0, 100%, 40%);">- * \param cmd Not used</span><br><span style="color: hsl(0, 100%, 40%);">- * \param data Caller-id presentation function datatype string</span><br><span style="color: hsl(0, 100%, 40%);">- * \param value Value to assign to the caller-id presentation information struct.</span><br><span style="color: hsl(0, 100%, 40%);">- *</span><br><span style="color: hsl(0, 100%, 40%);">- * \retval 0 on success.</span><br><span style="color: hsl(0, 100%, 40%);">- * \retval -1 on error.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-static int callerpres_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- int pres;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!chan) {</span><br><span style="color: hsl(0, 100%, 40%);">-            ast_log(LOG_WARNING, "No channel was provided to %s function.\n", cmd);</span><br><span style="color: hsl(0, 100%, 40%);">-               return -1;</span><br><span style="color: hsl(0, 100%, 40%);">-      }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       if (!callerpres_deprecate_notify) {</span><br><span style="color: hsl(0, 100%, 40%);">-             callerpres_deprecate_notify = 1;</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_log(LOG_WARNING, "CALLERPRES is deprecated."</span><br><span style="color: hsl(0, 100%, 40%);">-                      "  Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-        }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-       pres = ast_parse_caller_presentation(value);</span><br><span style="color: hsl(0, 100%, 40%);">-    if (pres < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">-              ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show function CALLERPRES')\n", value);</span><br><span style="color: hsl(0, 100%, 40%);">-   } else {</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_channel_caller(chan)->id.name.presentation = pres;</span><br><span style="color: hsl(0, 100%, 40%);">-               ast_channel_caller(chan)->id.number.presentation = pres;</span><br><span style="color: hsl(0, 100%, 40%);">-     }</span><br><span style="color: hsl(0, 100%, 40%);">-       return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*!</span><br><span>  * \internal</span><br><span>  * \brief Read values from the caller-id information struct.</span><br><span>@@ -1825,13 +1713,6 @@</span><br><span>   .write = callerid_write,</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static struct ast_custom_function callerpres_function = {</span><br><span style="color: hsl(0, 100%, 40%);">-     .name = "CALLERPRES",</span><br><span style="color: hsl(0, 100%, 40%);">- .read = callerpres_read,</span><br><span style="color: hsl(0, 100%, 40%);">-        .read_max = 50,</span><br><span style="color: hsl(0, 100%, 40%);">- .write = callerpres_write,</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static struct ast_custom_function connectedline_function = {</span><br><span>         .name = "CONNECTEDLINE",</span><br><span>   .read = connectedline_read,</span><br><span>@@ -1855,8 +1736,7 @@</span><br><span> {</span><br><span>     int res;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    res = ast_custom_function_unregister(&callerpres_function);</span><br><span style="color: hsl(0, 100%, 40%);">- res |= ast_custom_function_unregister(&callerid_function);</span><br><span style="color: hsl(120, 100%, 40%);">+        res = ast_custom_function_unregister(&callerid_function);</span><br><span>        res |= ast_custom_function_unregister(&connectedline_function);</span><br><span>  res |= ast_custom_function_unregister(&redirecting_function);</span><br><span>    return res;</span><br><span>@@ -1873,8 +1753,7 @@</span><br><span> {</span><br><span>     int res;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    res = ast_custom_function_register(&callerpres_function);</span><br><span style="color: hsl(0, 100%, 40%);">-   res |= ast_custom_function_register(&callerid_function);</span><br><span style="color: hsl(120, 100%, 40%);">+  res = ast_custom_function_register(&callerid_function);</span><br><span>  res |= ast_custom_function_register(&connectedline_function);</span><br><span>    res |= ast_custom_function_register(&redirecting_function);</span><br><span>      return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10510">change 10510</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10510"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ia1b2b386505b3102136dab02c45eaaf09f0f89c5 </div>
<div style="display:none"> Gerrit-Change-Number: 10510 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>