JR Richardson
2010-Jan-20 20:57 UTC
[asterisk-users] Using SIPPEER status with CUT function? SOLVED
On Wed, Jan 20, 2010 at 2:42 PM, JR Richardson <jmr.richardson at gmail.com> wrote:> Hi All, > > I'm using Asterisk 1.4 branch and checking the status of some SIP > Peers with the functions ${SIPPEER(101:status)} and the result is "OK > (48 ms)". ?Seems to work fine. > > Now I would like to use the function CUT to set a variable with the > 'OK' portion of the status "OK (48 ms)" and then do some follow on > stuff if the status is OK. > > I'm running into syntax errors in the Set command, I think due to the > spaces in the SIPPEER status. > > Any suggestions on how to deal with the 'spaces' in the status? >Disregard, I figured it out: Set(stat102cut=${CUT(stat102, ,1)}) Just put a space in the deliminator field. I guess I could have tried that first. JR -- JR Richardson Engineering for the Masses
Tilghman Lesher
2010-Jan-21 05:10 UTC
[asterisk-users] Using SIPPEER status with CUT function? SOLVED
On Wednesday 20 January 2010 14:57:38 JR Richardson wrote:> On Wed, Jan 20, 2010 at 2:42 PM, JR Richardson <jmr.richardson at gmail.com>wrote:> > I'm using Asterisk 1.4 branch and checking the status of some SIP > > Peers with the functions ${SIPPEER(101:status)} and the result is "OK > > (48 ms)". ?Seems to work fine. > > > > Now I would like to use the function CUT to set a variable with the > > 'OK' portion of the status "OK (48 ms)" and then do some follow on > > stuff if the status is OK. > > > > I'm running into syntax errors in the Set command, I think due to the > > spaces in the SIPPEER status. > > > > Any suggestions on how to deal with the 'spaces' in the status? > > Disregard, I figured it out: > > Set(stat102cut=${CUT(stat102, ,1)}) > > Just put a space in the deliminator field. I guess I could have tried > that first.Set(stat101=${CUT(SIPPEER(101:status), ,1)} Remember that the CUT() function takes a NAME, not a value. Otherwise, you'd be trying to cut the variable ${OK (48 ms)}, which appears to the dialplan to be a function, which isn't defined. -- Tilghman Lesher Digium, Inc. | Senior Software Developer twitter: Corydon76 | IRC: Corydon76-dig (Freenode) Check us out at: www.digium.com & www.asterisk.org