Steven Sokol
2003-Nov-03 11:13 UTC
[Asterisk-Users] Proper syntax for the "Cut" application?
Hi. I am looking for the proper syntax for the Cut application. I am working on a "Feature Code" extension that drops a caller directly into a voicemail box. Here is what I have: exten => _55.,1,Answer() exten => _55.,2,Cut(VMEXT=EXTEN|55|2) exten => _55.,3,Voicemail(u${VMEXT}) exten => _55.,4,Hangup() When I dial 551100, the system tries to process this but I get dropped immediately. Here is the output: -- Executing Answer("SIP/ppc-6aa2", "") in new stack -- Executing Cut("SIP/ppc-6aa2", "VMEXT=EXTEN|55|2") in new stack -- Executing Voicemail("SIP/ppc-6aa2", "u") in new stack == Parsing '/etc/asterisk/voicemail.conf': Found WARNING[1234379840]: File app_voicemail.c, Line 836 (leave_voicemail): No entry in voicemail config file for '' Obviously the new variable VMEXT is empty. Why is that? I read the source for app_cut.c and the syntax looks correct. I am asking for the second field which should be '1100'. I have tried several versions of this, including changing the line from: exten => _55.,2,Cut(VMEXT=EXTEN|55|2) to: exten => _55.,2,Cut(VMEXT=${EXTEN}|55|2) I have also tried changing the parsing function by parsing as such: exten => _55.,2,Cut(VMEXT=EXTEN|5|2). None of these put ANYTHING into the ${VMEXT} variable. Please help!
Tilghman Lesher
2003-Nov-03 12:17 UTC
[Asterisk-Users] Proper syntax for the "Cut" application?
On Monday 03 November 2003 12:13, Steven Sokol wrote:> Hi. I am looking for the proper syntax for the Cut application. I > am working on a "Feature Code" extension that drops a caller > directly into a voicemail box. Here is what I have: > > exten => _55.,1,Answer() > exten => _55.,2,Cut(VMEXT=EXTEN|55|2)Here's your first problem. Cut uses a single character to separate fields. So the delimiter is '5' and the second field is indeed empty.> exten => _55.,3,Voicemail(u${VMEXT}) > exten => _55.,4,Hangup() > > When I dial 551100, the system tries to process this but I get > dropped immediately. Here is the output: > > -- Executing Answer("SIP/ppc-6aa2", "") in new stack > -- Executing Cut("SIP/ppc-6aa2", "VMEXT=EXTEN|55|2") in new stack > -- Executing Voicemail("SIP/ppc-6aa2", "u") in new stack > == Parsing '/etc/asterisk/voicemail.conf': Found > WARNING[1234379840]: File app_voicemail.c, Line 836 > (leave_voicemail): No entry in voicemail config file for '' > > Obviously the new variable VMEXT is empty. Why is that? I read > the source for app_cut.c and the syntax looks correct. I am asking > for the second field which should be '1100'. I have tried several > versions of this, including changing the line from: exten => > _55.,2,Cut(VMEXT=EXTEN|55|2) to: exten => > _55.,2,Cut(VMEXT=${EXTEN}|55|2)There is a far simpler syntax for doing what you're doing, which is fixed string parsing. Cut() is intended to be used when fixed won't work (i.e. variable width before the delimiter). Instead, use ${EXTEN:2}. -Tilghman