[asterisk-bugs] [JIRA] (ASTERISK-25373) Deprecation of CALLERPRES() function requires duplicate dialplan code

Walter Doekes (JIRA) noreply at issues.asterisk.org
Sun Sep 6 05:17:33 CDT 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=227497#comment-227497 ] 

Walter Doekes commented on ASTERISK-25373:
------------------------------------------

So, I started one. But then I found out the functionality exists, but is intentionally undocumented:

{noformat}
commit ec37ffbdaf4c8e9c134efd4e1fe7fd8bd72632ed
Author: Richard Mudgett <rmudgett at digium.com>
Date:   Wed Jul 14 15:48:36 2010 +0000

    ast_callerid restructuring
...
{noformat}
{noformat}
    * CALLERPRES() is now deprecated because the name and number have their
    own presentation values.
...
+/*
+ * Do not document the CALLERID(pres) datatype.
+ * The name and number now have their own presentation value.  The pres
+ * option will simply live on as a historical relic with as best
+ * as can be managed backward compatible meaning.
...
+ * Do not document the CONNECTEDLINE(pres) datatype.
...
+ * Do not document the REDIRECTING(pres) datatype.
{noformat}

I do mind the need for duplicate code. In SIP it's rare to hide only the display-name or only the user-addr. We either hide the whole caller or we don't. (At least for the CALLERID(pres) bit, I haven't had use for CONNECTEDLINE/REDIRECTING presentation yet.)

[~rmudgett]: can we get documentation that CALLERID(pres) gets/sets both name and num presentation?

Currently you would end up with something like this:

{noformat}
[incoming]
Set(is_public=$["${CALLERID(name-pres):0:7}"="allowed"]) ; either name-pres or num-pres will work if the call comes in on chan_sip
;; do stuff

[outgoing]
Set(CALLERID(name-pres)=${IF(${is_public}?allowed_passed_screen:prohib_passed_screen)})
Set(CALLERID(num-pres)=${IF(${is_public}?allowed_passed_screen:prohib_passed_screen)})
;; dial out
{noformat}

Failing to set one of them on the outgoing end will mess up (at least) the chan_sip presentation.

> Deprecation of CALLERPRES() function requires duplicate dialplan code
> ---------------------------------------------------------------------
>
>                 Key: ASTERISK-25373
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25373
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Functions/func_callerid
>    Affects Versions: 11.19.0, 13.5.0
>            Reporter: Walter Doekes
>            Assignee: Walter Doekes
>            Severity: Minor
>
> If you use:
> {noformat}
> Set(CALLERPRES()=allowed_passed_screen)
> {noformat}
> You get a deprecationwarning:
> {noformat}
>         if (!callerpres_deprecate_notify) {
>                 callerpres_deprecate_notify = 1;
>                 ast_log(LOG_WARNING, "CALLERPRES is deprecated."
>                         "  Use CALLERID(name-pres) or CALLERID(num-pres) instead.\n");
>         }
> {noformat}
> Right now it does this:
> {noformat}
>                 chan->caller.id.name.presentation = pres;
>                 chan->caller.id.number.presentation = pres;
> {noformat}
> Which in dialplan terms would be:
> {noformat}
> Set(CALLERID(name-pres)=allowed_passed_screen)
> Set(CALLERID(num-pres)=allowed_passed_screen)
> {noformat}
> And you need to set both, because chan_sip reads it as a single value -- through {{ast_party_id_presentation()}} -- where value with the most privacy wins.
> So, I don't consider two dialplan statements an improvement over one.
> Suggested fix: add a 'all-pres' item to CALLERID.
> {noformat}
> Set(CALLERID(all-pres)=allowed_passed_screen)
> {noformat}
> Preferably in the release branches so one can get rid of deprecationwarnings sooner.
> Thanks :)



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list