[Freeswitch-users] String manipulation in the dialplan

Alexander Haugg Alexander.Haugg at c4b.de
Fri Nov 11 10:46:42 MSK 2016


Hi,

the examples on „ https://wiki.freeswitch.org/wiki/Manipulating_Channel_Variables “ are working successfully.
But I need the function like ${var:0:-7}.
For example:
                My dialplan app return a value like this “from number”|”location” ->123456|intern.
                The length of the “from number” is unknown, but the length of the location is fix (it could be intern or extern only).
                Now I am trying ${var:0:-7} to extract the “123456”, but I get the complete string 123456|intern.

What can I do with this function?

Or is the only possibility to solve this via a regular expression ^([0-9]+)[|](intern|extern)$ -> (not tested ;-)?

Thanks a lot!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20161111/63305f5d/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list