Summary: | ASTERISK-12834: [patch] Shortcut for duplicating the last extension, so the pattern doesn't need to be repeated | ||
Reporter: | Leif Madsen (lmadsen) | Labels: | |
Date Opened: | 2008-10-06 18:42:20 | Date Closed: | 2008-10-10 13:21:20 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | PBX/pbx_config |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20081006__bug13632.diff.txt | |
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> | ||
Comments: | By: Tzafrir Cohen (tzafrir) 2008-10-08 02:41:51 'same =>' has to have an 'n' priority? 'n' is not a real priority. It is interpreted at configuration reading anyway. By: Leif Madsen (lmadsen) 2008-10-08 07:32:30 It does if you want to have a priority label. By: Leif Madsen (lmadsen) 2008-10-09 19:39:22 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? By: Leif Madsen (lmadsen) 2008-10-09 20:34:35 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: ==!!== Unknown directive: same at line 425 -- IGNORING!!!</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> By: Tilghman Lesher (tilghman) 2008-10-10 12:57:48 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? By: Digium Subversion (svnbot) 2008-10-10 13:21:18 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 |