How to count ${EXTEN}?

Hi folks

I want to set some in asterisk database based on a dialed extension. For example if someone dials 88101102103 I want to but in the database:

/family1/key1 101
/family2/key2 102
/family3/key3 103

Removing 88 is easy with ${EXTEN:2}. But how can I split the others? Can I count how many numbers there is in ${EXTEN}? Then it gets easy to :N or :-N the result.

Any ideas?

Hi

${EXTEN:2:3} will give you 101
${EXTEN:5:3} =102
as would
${EXTEN:-6:3} = 103

${EXTEN:-3:3} = 103

Ian

(check them to be sure , but thats the way.

Yes, I’ve just completed my dial plan :smiley:
Thanks