Summary: | ASTERISK-08281: Enhance CUT function to allow range variable | ||
Reporter: | Richard Miller (ulogic) | Labels: | |
Date Opened: | 2006-12-05 12:00:26.000-0600 | Date Closed: | 2011-06-07 14:03:13 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Functions/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) app_cut.c ( 1) app_cut.patch ( 2) func_cut.patch | |
Description: | The CUT(stringvariable,delimiter,range-spec) function presently does not allow a variable for the range. Allowing a variable range specification makes it easier to parse strings in the dialplan. A patch is provided for both 1.2 and 1.4 versions. For 1.2, the change is in apps\app_cut.c For 1.4, the change is in funcs\func_cut.c ****** ADDITIONAL INFORMATION ****** [macro-allavail] ; See if none of the destinations is busy ; ARG1 is in the form DEST1&DEST2&...&DESTN as used in the Dial() application ; Returns to calling priority+1 if anyone in destination list is busy ; Returns to calling priority+2 if nobody in destination list is busy ; exten => s,1,Set(anyavail=0) exten => s,2,Set(i=1) exten => s,3(availoop),Set(peerchan=${CUT(ARG1,&,${i})}) exten => s,4,GotoIf($["${peerchan}" = ""]?allfree) exten => s,5,ChanIsAvail(${peerchan},s) exten => s,106,goto(6) exten => s,6,NoOp(AVAILSTATUS for ${peerchan} is ${AVAILSTATUS}) ; Not busy if device state is: 0 unknown, 1 not in use, ; 4 invalid (not configured), or 5 unavailable (not registered) ; Busy if: 2 in use, 3 busy, 6/7 ringing, or 8 on hold exten => s,7,GotoIf($[${REGEX("[0145]",${AVAILSTATUS})}]?:availexit) exten => s,8,Set(i=$[ ${i} + 1 ]) exten => s,9,GotoIf($[{$AVAILSTATUS} > 1]?availoop) exten => s,10,Set(anyavail=1) exten => s,11,Goto(availoop) exten => s,12(allfree),Set(MACRO_OFFSET=${anyavail}) exten => s,13(availexit),NoOp(allavail returns ${MACRO_OFFSET}) | ||
Comments: | By: Jason Parker (jparker) 2006-12-05 12:17:17.000-0600 All variables are already dereferenced before functions and applications are even called. This already works as expected. If you're seeing different behavior, something is very seriously wrong with your installation. |