[Freeswitch-users] read function returns corrupted values

Tihomir Culjaga tculjaga at gmail.com
Tue Aug 10 05:34:11 PDT 2010


hello guys,

i got a problem with read function (
http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_read) in dialplan.



  <extension name="LangSelInput">
    <condition field="destination_number" expression="^LangSelInput$">
      <action application="set" data="playback_delimiter=!"/>
      <action application="set" data="playback_terminators=#*0123456789"/>
      <!-- <action application="start_dtmf"/> -->
      <action inline="true" application="set" data="myLANG="""/>
      <action application="read" data="0 1
${WELCOME_PR}!${ERR_PR}!${LANG_PROMPT_STRING} myLANG ${LANG_TIMEOUT} "/>
      <action inline="true" application="set"
data="LANG_RETRIES=${expr(${LANG_RETRIES}+1)}"/>
<!--      <action application="stop_dtmf"/> -->
      <action application="execute_extension" data="LangSel XML NXIVR"/>
    </condition>
  </extension>


   <extension name="LangSel">
      <condition field="destination_number" expression="^LangSel$"/>
      <condition field="${myLANG}" expression="^1$" break="on-true">
         <action application="log" data="INFO ################# HR
################\n"/>
         <action application="set"
data="sound_prefix=$${sounds_dir}/hr/HR/teta1"/>
         <action application="set" data="language=hr"/>
      </condition>

      <condition field="destination_number" expression="^LangSel$"/>
      <condition field="${myLANG}" expression="^2$" break="on-true">
         <action application="log" data="INFO ################# EN
################\n"/>
         <action application="set"
data="sound_prefix=$${sounds_dir}/en/us/callie"/>
         <action application="set" data="language=en"/>
      </condition>


      <condition field="destination_number" expression="^LangSel$"/>
      <condition field="${myLANG}" expression="^[06789]$" break="on-true">
         <action application="log" data="INFO ################# WRONG LANG
SEL ################\n"/>
         <action application="set" data="language=hr"/>
         <action application="set" data="ERR_PR=${WRONG_LANG_PROMPT}"/>
         <action application="execute_extension" data="LangRetries XML
NXIVR"/>
      </condition>

      <condition field="destination_number" expression="^LangSel$"/>
      <condition field="${myLANG}" expression="^$" break="on-true">
         <action application="log" data="INFO ################# NO LANG SEL
################\n"/>
         <action application="set" data="language=hr"/>
         <action application="set" data="ERR_PR=${NO_LANG_PROMPT}"/>
         <action application="execute_extension" data="LangRetries XML
NXIVR"/>
      </condition>

      <condition field="destination_number" expression="^LangSel$"/>
      <condition field="${myLANG}" expression="^.*$" break="on-true">
         <action application="log" data="INFO ################# WRONG LANG
SEL ################\n"/>
         <action application="set" data="language=hr"/>
         <action application="set" data="ERR_PR=${WRONG_LANG_PROMPT}"/>
         <action application="execute_extension" data="LangRetries XML
NXIVR"/>
      </condition>
   </extension>




when this part of dialplan executes and i enter the DTMF digit immediately
on 1st letter, the collected DTMF digits are not consistent... as there is a
memory overwrite somewhere ....




2010-08-10 15:27:22.056491 [INFO] mod_dptools.c:946 #################
LangSel ################\n
2010-08-10 15:27:22.056491 [NOTICE] switch_core_session.c:1949 Execute
set(WELCOME_PR=${DEFAULT_LANG_PATH}ivr/welcome.wav)
EXECUTE sofia/external/38516659280 at 195.88.212.41set(WELCOME_PR=/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/welcome.wav)
2010-08-10 15:27:22.056491 [DEBUG] mod_dptools.c:816 sofia/external/
38516659280 at 195.88.212.41 SET
[WELCOME_PR]=[/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/welcome.wav]
2010-08-10 15:27:22.056491 [NOTICE] switch_core_session.c:1949 Execute
execute_extension(LangSelInput XML NXIVR)
EXECUTE sofia/external/38516659280 at 195.88.212.41execute_extension(LangSelInput
XML NXIVR)
2010-08-10 15:27:22.056491 [INFO] mod_dialplan_xml.c:418 Processing
38516659280->LangSelInput in context NXIVR
Dialplan: sofia/external/38516659280 at 195.88.212.41 parsing
[NXIVR->LangSelInput] continue=false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS)
[LangSelInput] destination_number(LangSelInput) =~ /^LangSelInput$/
break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
set(playback_delimiter=!)
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
set(playback_terminators=#*0123456789)
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action set(myLANG=)
INLINE
EXECUTE sofia/external/38516659280 at 195.88.212.41 set(myLANG=)
2010-08-10 15:27:22.058522 [DEBUG] mod_dptools.c:816 sofia/external/
38516659280 at 195.88.212.41 SET [myLANG]=[UNDEF]
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action read(0 1
${WELCOME_PR}!${ERR_PR}!${LANG_PROMPT_STRING} myLANG ${LANG_TIMEOUT} )
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
set(LANG_RETRIES=${expr(${LANG_RETRIES}+1)}) INLINE
EXECUTE sofia/external/38516659280 at 195.88.212.41 set(LANG_RETRIES=1)
2010-08-10 15:27:22.058522 [DEBUG] mod_dptools.c:816 sofia/external/
38516659280 at 195.88.212.41 SET [LANG_RETRIES]=[1]
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
execute_extension(LangSel XML NXIVR)
2010-08-10 15:27:22.058522 [NOTICE] switch_core_session.c:1949 Execute
set(playback_delimiter=!)
EXECUTE sofia/external/38516659280 at 195.88.212.41 set(playback_delimiter=!)
2010-08-10 15:27:22.058522 [DEBUG] mod_dptools.c:816 sofia/external/
38516659280 at 195.88.212.41 SET [playback_delimiter]=[!]
2010-08-10 15:27:22.058522 [NOTICE] switch_core_session.c:1949 Execute
set(playback_terminators=#*0123456789)
EXECUTE sofia/external/38516659280 at 195.88.212.41set(playback_terminators=#*0123456789)
2010-08-10 15:27:22.058522 [DEBUG] mod_dptools.c:816 sofia/external/
38516659280 at 195.88.212.41 SET [playback_terminators]=[#*0123456789]
2010-08-10 15:27:22.058522 [NOTICE] switch_core_session.c:1949 Execute
read(0 1 ${WELCOME_PR}!${ERR_PR}!${LANG_PROMPT_STRING} myLANG
${LANG_TIMEOUT} )
EXECUTE sofia/external/38516659280 at 195.88.212.41 read(0 1
/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/welcome.wav!!/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/for_croatian.wav!/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/press.wav!/usr/local/freeswitch/sounds/hr/HR/teta1/ivr/one.wav!/usr/local/freeswitch/sounds/en/us/callie/ivr/for_en_press2.wav!/usr/local/freeswitch/sounds/de/de/helge/ivr/for_german_press3.wav!/usr/local/freeswitch/sounds/it/it/ambra/ivr/for_italian_press4.wav!/usr/local/freeswitch/sounds/fr/fr/celine/ivr/for_french_press5.wav
myLANG 10000 )
2010-08-10 15:27:22.059474 [DEBUG] switch_ivr_play_say.c:1152 Codec
Activated L16 at 8000hz 1 channels 20ms
2010-08-10 15:27:22.872525 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:22.934526 [DEBUG] switch_rtp.c:2428 RTP RECV DTMF 1:752
2010-08-10 15:27:22.934526 [ERR] mod_native_file.c:74 Error opening
/usr/local/freeswitch/sounds/en/us/callie/.PCMA
2010-08-10 15:27:23.892521 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:25.012528 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:25.832521 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:29.792528 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:31.872524 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:34.492524 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:37.152526 [DEBUG] switch_ivr_play_say.c:1444 done playing
file
2010-08-10 15:27:37.152526 [NOTICE] switch_core_session.c:1949 Execute
execute_extension(LangSel XML NXIVR)
EXECUTE sofia/external/38516659280 at 195.88.212.41 execute_extension(LangSel
XML NXIVR)
2010-08-10 15:27:37.152526 [INFO] mod_dialplan_xml.c:418 Processing
38516659280->LangSel in context NXIVR
Dialplan: sofia/external/38516659280 at 195.88.212.41 parsing [NXIVR->LangSel]
continue=false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^1$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^2$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^3$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^4$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^5$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^[06789]$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (FAIL) [LangSel]
${myLANG}(1^»@đ) =~ /^$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
destination_number(LangSel) =~ /^LangSel$/ break=on-false
Dialplan: sofia/external/38516659280 at 195.88.212.41 Regex (PASS) [LangSel]
${myLANG}(1^»@đ) =~ /^.*$/ break=on-true
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action log(INFO
################# WRONG LANG SEL ################\n)
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action set(language=hr)
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
set(ERR_PR=${WRONG_LANG_PROMPT})
Dialplan: sofia/external/38516659280 at 195.88.212.41 Action
execute_extension(LangRetries XML NXIVR)
2010-08-10 15:27:37.154487 [NOTICE] switch_core_session.c:1949 Execute
log(INFO ################# WRONG LANG SEL ################\n)
EXECUTE sofia/external/38516659280 at 195.88.212.41 log(INFO #################
WRONG LANG SEL ################\n)
2010-08-10 15:27:37.154487 [INFO] mod_dptools.c:946 ################# WRONG
LANG SEL ################\n
2010-08-10 15:27:37.154487 [NOTICE] switch_core_session.c:1949 Execute
set(language=hr)
EXECUTE sofia/external/38516659280 at 195.88.212.41 set(language=hr)


you can see myLANG variable holds "1^»@đ" ... of course i dialed 1 as seen
in the log (switch_rtp.c:2428 RTP RECV DTMF 1:752).


now, i did some extra testing and found that it happens only when i use a
playback_separator to append multiple files to be played....

i checked  switch_ivr_read and switch_ivr_collect_digits_count functions but
everything seems to be ok there...



can anyone help locating the problem ?




Ps: im running


freeswitch at cxss01> version

FreeSWITCH Version 1.0.6 (svn-exported)

tried with Revision: 17032 before this one but seems to be the same....



[tculjaga at cxss01 src]$ cat /etc/issue
CentOS release 5.4 (Final)
Kernel \r on an \m

[tculjaga at cxss01 src]$



[tculjaga at cxss01 src]$ uname -a
Linux cxss01 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30 EDT 2009 x86_64 x86_64
x86_64 GNU/Linux
[tculjaga at cxss01 src]$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100810/764c0f92/attachment-0001.html 


More information about the FreeSWITCH-users mailing list