Hadar Pedhazur
2004-Mar-09 15:25 UTC
[Asterisk-Users] Parsing a variable, or rather Splitting a variable
The wiki page on ChanIsAvail says: "Thus, if you are going to use the value of AVAILCHAN, you need to strip the session ID off." I understand why this is necessary (from seeing what is returned in the CLI), but I don't see any commands that can accomplish this since the session id after the "-" is of variable length (so you can't use ":" notation, or StripLSD, etc.). I would like to avoid making an external AGI call if possible, and I'm hoping I'm just missing something obvious here. Thanks in advance!
Derek Bruce
2004-Mar-09 16:12 UTC
[Asterisk-Users] Parsing a variable, or rather Splitting a variable
given: exten => 2001,1,ChanIsAvail(SIP/2001&SIP/3001) exten => 2001,2,SubString,ToDial=${AVAILCHAN}|0|8 exten => 2001,3,Dial(${ToDial},20) you know that your dialstring will be 'SIP/2001', your technology prefix ('SIP/' 4 characters) length plus your extention length (4 characters) = 8 characters... a fixed length... for a variable length extention use: exten => _1.,1,ChanIsAvail(SIP/$EXTEN}) exten => _1.,2,SubString,ToDial=${AVAILCHAN}|0|${LEN(EXTEN)}+4 ) exten => _1.,3,Dial(${ToDial},20) ----- Original Message ----- From: "Hadar Pedhazur" <hadar@unorthodox.com> To: <Asterisk-Users@lists.digium.com> Sent: Tuesday, March 09, 2004 3:25 PM Subject: [Asterisk-Users] Parsing a variable, or rather Splitting a variable> The wiki page on ChanIsAvail says: > > "Thus, if you are going to use the value of AVAILCHAN, you need to > strip the session ID off." > > I understand why this is necessary (from seeing what is returned in > the CLI), but I don't see any commands that can accomplish this since > the session id after the "-" is of variable length (so you can't use > ":" notation, or StripLSD, etc.). > > I would like to avoid making an external AGI call if possible, and I'm > hoping I'm just missing something obvious here. > > Thanks in advance! > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users