[asterisk-users] Finding the position of a character in a string

giovanni.v iax at keybits.org
Tue Jul 24 05:45:04 CDT 2012


Il 24/07/2012 10.37, Ishfaq Malik ha scritto:
> It there a native asterisk dialplan function which will tell me the
> position of a specific character in a given string?
>
> eg if I wanted to find what position the '@' was at in ${SIPURI}

if you are trying to extract parts from a string then look at the 
function called 'CUT'.

verbose example:
exten => s,1,NoOp(set DID from SIP TO header)
exten => s,n,Set(DID_INFO=${SIP_HEADER(To)})
exten => s,n,Set(DID_INFO=${CUT(DID_INFO,@,1)})
exten => s,n,Set(DID_INFO=${CUT(DID_INFO,:,2)})
exten => s,n,Goto(sip-routing,${DID_INFO},1)


-- 
TeeBX VoIP communication platform (coming soon)
http://code.google.com/p/teebx/
-----------------------------------------------
Lightweight++ User Friendly++ Open++



More information about the asterisk-users mailing list