[asterisk-bugs] [JIRA] (ASTERISK-26464) Pickup() semantics changed between 1.4 and 1.8

Rusty Newton (JIRA) noreply at issues.asterisk.org
Thu Oct 13 13:09:01 CDT 2016


     [ https://issues.asterisk.org/jira/browse/ASTERISK-26464?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rusty Newton closed ASTERISK-26464.
-----------------------------------

    Resolution: Workaround Available

Thanks for pointing this out Walter. I'm sure it will be useful to others.

I'll go ahead and close it out since there isn't anything else to do with it at the moment. 

We are not likely to change this behavior since it has been this way for a long while now with no complaints and pickup is a commonly used feature.

It is odd that we seemed to have missed that change way back then. 

You are always welcome to bring up a conversation on the dev list about changing it , if you felt it was worth it of course!

Thanks!

> Pickup() semantics changed between 1.4 and 1.8
> ----------------------------------------------
>
>                 Key: ASTERISK-26464
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-26464
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_directed_pickup
>            Reporter: Walter Doekes
>         Attachments: ASTERISK-26464_add_PickupOld1v4_application.patch
>
>
> Imagine this dialplan:
> {noformat}
> [incoming]
> exten => 200,1,Goto(outgoing,call,1)
> exten => *200,1,Goto(pickup,both,1)
> [outgoing]
> exten => call,1,Dial(SIP/alice)
> [pickup]
> exten => both,1,Pickup(call at incoming)
> exten => both,n,PickupOld1v4(call at outgoing)
> {noformat}
> Bob calls Alice by calling '200' ({{core show channels}}):
> {noformat}
> SIP/bob-0000000  call at outgoing:1  Ring     Dial(SIP/alice)
> SIP/alice-00000  call at incoming:1  Ringing  AppDial((Outgoing Line))
>                       ^
>                       |
> {noformat}
> There is no call at incoming, yet that's what exten+context contain. (I'm not sure if this is a bug or a feature, but it's how it is and tampering with that would probably inflict all sorts of havoc.)
> So, when Charlie tries to pick up the call using {{Pickup()}}, we have to use the odd {{call at incoming}} identifier instead of {{call at outgoing}}.
> This was unintentionally changed in commit {{cba19c8a671}} (in 2009, merged into what became Asterisk 1.8) when this code got changed:
> {noformat}
> --- a/apps/app_directed_pickup.c
> +++ b/apps/app_directed_pickup.c
> ...
> -static int find_by_exten(struct ast_channel *c, void *data)
> -{
> -       struct pickup_criteria *info = data;
> -
> -       return (!strcasecmp(c->macroexten, info->exten) || !strcasecmp(c->exten, info->exten)) &&
> -               !strcasecmp(c->dialcontext, info->context) &&
> -               can_pickup(c);
> -}
> ...
> -       target = ast_channel_search_locked(find_by_exten, &search);
> +       if (!(iter = ast_channel_iterator_by_exten_new(0, exten, context))) {
> ...
> {noformat}
> Unlike the find_by_exten above, the new iterator uses 'context':
> {noformat}
> --- a/main/channel.c
> +++ b/main/channel.c
> ...
> +                       if (i->context && strcasecmp(chan->context, i->context) &&
> +                                       strcasecmp(chan->macrocontext, i->context)) {
> ...
> {noformat}
> The check that used the 'dialcontext' now uses the checks used by ast_channel_iterator_by_exten_new; which is 'context'.
> This breaks Pickup semantics between pre-1.8 (e.g. Asterisk 1.4) and 1.8 and higher.
> ----
> While I don't think it makes sense to change {{Pickup()}} again, I've filed this ticket for future reference: for those still migrating from Asterisk 1.4 upwards, this could pose an upgrade hurdle.
> On the other hand, I don't really see how the *new* semantics are worth anything. Who would use Pickup referencing exten+context where the combination doesn't exist in the dialplan, unless they're intimately familiar with the inner workings?
> Attached a patch that adds {{PickupOld1v4()}} with the old semantics.



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



More information about the asterisk-bugs mailing list