[Asterisk-Users] Parsing a variable, or rather Splitting a variable

Derek Bruce dbruce at calgarytelecom.com
Tue Mar 9 16:12:07 MST 2004


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 at unorthodox.com>
To: <Asterisk-Users at 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 at 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




More information about the asterisk-users mailing list