Asterisk
  1. Asterisk
  2. ASTERISK-12834

[patch] Shortcut for duplicating the last extension, so the pattern doesn't need to be repeated

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: PBX/pbx_config
    • Labels:
      None
    • SVN Revision Number:
      146799
    • Mantis ID:
      13632
    • Regression:
      No

      Description

      As discussed with Leif Madsen at Astricon, this creates a shortcut in extensions.conf, such that the last pattern used in extensions.conf is repeatable by defining a "same" variable. The value of the "same" variable starts with the corresponding priority (usually "n"), such that an example might be:

      <pre>exten => _1NXXNXXXXXX,1,NoOp(long distance number)
      same => n,DoSomethingElse
      ...</pre>

        Activity

        Hide
        Tzafrir Cohen added a comment -

        'same =>' has to have an 'n' priority? 'n' is not a real priority. It is interpreted at configuration reading anyway.

        Show
        Tzafrir Cohen added a comment - 'same =>' has to have an 'n' priority? 'n' is not a real priority. It is interpreted at configuration reading anyway.
        Hide
        Leif Madsen added a comment -

        It does if you want to have a priority label.

        Show
        Leif Madsen added a comment - It does if you want to have a priority label.
        Hide
        Leif Madsen added a comment -

        I've developed a bunch of things on this development box before, and never had it fail at bison before. Is that a new necessary package moving forward?

        Show
        Leif Madsen added a comment - I've developed a bunch of things on this development box before, and never had it fail at bison before. Is that a new necessary package moving forward?
        Hide
        Leif Madsen added a comment -

        With a standard Asterisk I get:

        <pre> – Added extension '_[lL][mM][eE]nterprises' priority 1 to complex_pattern
        [Oct 9 21:43:14] WARNING[3656]: pbx_config.c:1511;40m pbx_load_config: ==!Unable to render embedded object: File ( same at line 425 – IGNORING) not found.!!</pre>

        But I get no such error with the patched version. However it only seems to load the first extension:

        <pre>development*CLI> dialplan show complex_pattern
        [ Context 'complex_pattern' created by 'pbx_config' ]
        'FLY' => 1. Verbose(2|Theres a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log) [pbx_config]
        '_[lL][mM][eE]nterprises' => 1. Verbose(2|We matched on this extension: $

        {EXTEN}) [pbx_config]

        = 2 extensions (2 priorities) in 1 context. =</pre>


        And here is the dialplan I'm testing:
        <pre>
        [complex_pattern]
        exten => _[lL][mM][eE]nterprises,1,Verbose(2,We matched on this extension: ${EXTEN}

        )
        same => n,Verbose(2,Who's here? $

        {CALLERID(name)}

        )
        same => n,Verbose(2,Perform a flip!)
        same => n,Set(FROG_FLIPPING=1)
        same => n,While($[$

        {FROG_FLIPPING} < 10])
        same => n,Verbose(2,The frog jumped!)
        same => n,Exec(${IF($[${FROG_FLIPPING}

        = 6]?Set(DISTRACTION=FLY):Verbose(2,Hanging out on a log))})
        same => n,ExecIf($[${EXISTS($

        {DISTRACTION})}],Verbose,2\,OMG A FLY!
        same => n,Exec(${IF($[${EXISTS(${DISTRACTION}

        )}]?Verbose(2,This is how I would prefer to do the fly... Exec still needs an arg?))})
        same => n,GotoIf($[${EXISTS($

        {DISTRACTION})}]?${DISTRACTION}

        ,1)
        same => n(finish_loop),Set(FROG_FLIPPING=$[$

        {FROG_FLIPPING}

        + 1])
        same => n,EndWhile()
        same => n,Verbose(2,That's all folks!)
        same => n,Hangup()

        exten => FLY,1,Verbose(2,There's a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log)
        same => n,Goto(lmenterprises,finish_loop)
        </pre>

        Show
        Leif Madsen added a comment - With a standard Asterisk I get: <pre> – Added extension '_ [lL] [mM] [eE] nterprises' priority 1 to complex_pattern [Oct 9 21:43:14] WARNING [3656] : pbx_config.c:1511;40m pbx_load_config: ==! Unable to render embedded object: File ( same at line 425 – IGNORING) not found. !!</pre> But I get no such error with the patched version. However it only seems to load the first extension: <pre>development*CLI> dialplan show complex_pattern [ Context 'complex_pattern' created by 'pbx_config' ] 'FLY' => 1. Verbose(2|Theres a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log) [pbx_config] '_ [lL] [mM] [eE] nterprises' => 1. Verbose(2|We matched on this extension: $ {EXTEN}) [pbx_config] = 2 extensions (2 priorities) in 1 context. = </pre> And here is the dialplan I'm testing: <pre> [complex_pattern] exten => _ [lL] [mM] [eE] nterprises,1,Verbose(2,We matched on this extension: ${EXTEN} ) same => n,Verbose(2,Who's here? $ {CALLERID(name)} ) same => n,Verbose(2,Perform a flip!) same => n,Set(FROG_FLIPPING=1) same => n,While($[$ {FROG_FLIPPING} < 10]) same => n,Verbose(2,The frog jumped!) same => n,Exec(${IF($[${FROG_FLIPPING} = 6]?Set(DISTRACTION=FLY):Verbose(2,Hanging out on a log))}) same => n,ExecIf($[${EXISTS($ {DISTRACTION})}],Verbose,2\,OMG A FLY! same => n,Exec(${IF($[${EXISTS(${DISTRACTION} )}]?Verbose(2,This is how I would prefer to do the fly... Exec still needs an arg?))}) same => n,GotoIf($[${EXISTS($ {DISTRACTION})}]?${DISTRACTION} ,1) same => n(finish_loop),Set(FROG_FLIPPING=$[$ {FROG_FLIPPING} + 1]) same => n,EndWhile() same => n,Verbose(2,That's all folks!) same => n,Hangup() exten => FLY,1,Verbose(2,There's a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log) same => n,Goto(lmenterprises,finish_loop) </pre>
        Hide
        Tilghman Lesher added a comment -

        Okay... I just tried this with:
        <pre>exten => 8133,1,Answer
        same => n,Record(8133.Wav)
        same => n,Playback(8133)
        same => n,Hangup</pre>
        and it worked perfectly. Let me try your dialplan.

        <pre>*CLI> dialplan show complex_pattern
        [ Context 'complex_pattern' created by 'pbx_config' ]
        'FLY' => 1. Verbose(2,There's a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log) [pbx_config]
        2. Goto(lmenterprises,finish_loop) [pbx_config]
        '_[lL][mM][eE]nterprises' => 1. Verbose(2,We matched on this extension: $

        {EXTEN}

        ) [pbx_config]
        2. Verbose(2,Who's here? $

        {CALLERID(name)}

        ) [pbx_config]
        3. Verbose(2,Perform a flip!) [pbx_config]
        4. Set(FROG_FLIPPING=1) [pbx_config]
        5. While($[$

        {FROG_FLIPPING} < 10]) [pbx_config]
        6. Verbose(2,The frog jumped!) [pbx_config]
        7. Exec(${IF($[${FROG_FLIPPING}

        = 6]?Set(DISTRACTION=FLY):Verbose(2,Hanging out on a log))}) [pbx_config]
        8. ExecIf($[${EXISTS($

        {DISTRACTION}) [pbx_config]
        9. Exec(${IF($[${EXISTS(${DISTRACTION}

        )}]?Verbose(2,This is how I would prefer to do the fly... Exec still needs an arg?))}) [pbx_config]
        10. GotoIf($[${EXISTS($

        {DISTRACTION})}]?${DISTRACTION}

        ,1) [pbx_config]
        [finish_loop] 11. Set(FROG_FLIPPING=$[$

        {FROG_FLIPPING}

        + 1]) [pbx_config]
        12. EndWhile() [pbx_config]
        13. Verbose(2,That's all folks!) [pbx_config]
        14. Hangup() [pbx_config]
        </pre>
        What am I missing?

        Show
        Tilghman Lesher added a comment - Okay... I just tried this with: <pre>exten => 8133,1,Answer same => n,Record(8133.Wav) same => n,Playback(8133) same => n,Hangup</pre> and it worked perfectly. Let me try your dialplan. <pre>*CLI> dialplan show complex_pattern [ Context 'complex_pattern' created by 'pbx_config' ] 'FLY' => 1. Verbose(2,There's a frog on the bump on the log that caught the fly and now the frog is sitting on the bump on the log) [pbx_config] 2. Goto(lmenterprises,finish_loop) [pbx_config] '_ [lL] [mM] [eE] nterprises' => 1. Verbose(2,We matched on this extension: $ {EXTEN} ) [pbx_config] 2. Verbose(2,Who's here? $ {CALLERID(name)} ) [pbx_config] 3. Verbose(2,Perform a flip!) [pbx_config] 4. Set(FROG_FLIPPING=1) [pbx_config] 5. While($[$ {FROG_FLIPPING} < 10]) [pbx_config] 6. Verbose(2,The frog jumped!) [pbx_config] 7. Exec(${IF($[${FROG_FLIPPING} = 6]?Set(DISTRACTION=FLY):Verbose(2,Hanging out on a log))}) [pbx_config] 8. ExecIf($[${EXISTS($ {DISTRACTION}) [pbx_config] 9. Exec(${IF($[${EXISTS(${DISTRACTION} )}]?Verbose(2,This is how I would prefer to do the fly... Exec still needs an arg?))}) [pbx_config] 10. GotoIf($[${EXISTS($ {DISTRACTION})}]?${DISTRACTION} ,1) [pbx_config] [finish_loop] 11. Set(FROG_FLIPPING=$[$ {FROG_FLIPPING} + 1]) [pbx_config] 12. EndWhile() [pbx_config] 13. Verbose(2,That's all folks!) [pbx_config] 14. Hangup() [pbx_config] </pre> What am I missing?
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 148325

        U trunk/CHANGES
        U trunk/pbx/pbx_config.c

        ------------------------------------------------------------------------
        r148325 | tilghman | 2008-10-10 13:21:17 -0500 (Fri, 10 Oct 2008) | 8 lines

        Add keyword "same", which allows you to create multiple steps in a dialplan,
        without needing to respecify an extension pattern multiple times.
        (closes issue ASTERISK-12834)
        Reported by: blitzrage
        Patches:
        20081006__bug13632.diff.txt uploaded by Corydon76 (license 14)
        Tested by: blitzrage, Corydon76

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=148325

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 148325 U trunk/CHANGES U trunk/pbx/pbx_config.c ------------------------------------------------------------------------ r148325 | tilghman | 2008-10-10 13:21:17 -0500 (Fri, 10 Oct 2008) | 8 lines Add keyword "same", which allows you to create multiple steps in a dialplan, without needing to respecify an extension pattern multiple times. (closes issue ASTERISK-12834 ) Reported by: blitzrage Patches: 20081006__bug13632.diff.txt uploaded by Corydon76 (license 14) Tested by: blitzrage, Corydon76 ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=148325

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development