[Freeswitch-users] Problem with XML preprocessor variable

Vladimir Klejch klejch+freeswitch at netbox.cz
Tue May 19 07:12:00 PDT 2009


Hi

I think i found a bug on XML preprocessor in way of working with 
preprocessor varibles.

I have problem with concatenation of preprocessor variables in XML config.

Preprocessor is incorectly concatenatin two preprocessor variables, and 
building wrong config xml.

Best to explain on example:

in vars.xml:


     <X-PRE-PROCESS cmd="set" data="bug_test_1=xpreprocessbug1" />
     <X-PRE-PROCESS cmd="set" data="bug_test_2=xpreprocessbug2" />
     <X-PRE-PROCESS cmd="set" data="bug_test_3=xpreprocessbug3" />
     <X-PRE-PROCESS cmd="set" data="bug_test_4=xpreprocessbug4" />


     <X-PRE-PROCESS cmd="set" data="bug_test_sum1=$${bug_test_1}$${bug_test_2}$${bug_test_3}$${bug_test_4}" />
     <X-PRE-PROCESS cmd="set" data="bug_test_sum2=$${bug_test_1}^$${bug_test_2}^$${bug_test_3}^$${bug_test_4}" />


then in dialplan:


         <extension name="x_preprocess_bug1" continue="false" >
                 <condition field="destination_number" expression="$${bug_test_sum1}" >
                     <action application="info" />
                 </condition>
         </extension>

         <extension name="x_preprocess_bug2" continue="false" >
                 <condition field="destination_number" expression="$${bug_test_sum2}" >
                     <action application="info" />
                 </condition>
         </extension>




but in freeswitch.xml.fsxml:

         <extension name="x_preprocess_bug1" continue="false" >
                 <condition field="destination_number" expression="xpreprocessbug1$%{bug_test_2}xpreprocessbug3$%{bug_test_4}" >
                     <action application="info" />
                 </condition>
         </extension>

         <extension name="x_preprocess_bug2" continue="false" >
                 <condition field="destination_number" expression="xpreprocessbug1^xpreprocessbug2^xpreprocessbug3^xpreprocessbug4" >
                     <action application="info" />
                 </condition>
         </extension>



The odd variables are wrong translated by preprocessor . The odd variable 
used as $${var} is translated corect to his content, but the even variable 
used as $${var} is mangled and in freeswitch.xml.fsxml is to seen %${var} 
form of prefious $${var}. This problem only ocur, if tvo variables are 
direcly concatenated w/o any char between them.

config :

<X-PRE-PROCESS cmd="set" data="bug_test_sum1=$${bug_test_1}$${bug_test_2}$${bug_test_3}$${bug_test_4}" />

is translated to string:

"xpreprocessbug1$%{bug_test_2}xpreprocessbug3$%{bug_test_4}" , to see in 
extension name="x_preprocess_bug1".

If there is a char between concatenated variables (in my test a ^ char), 
everything is OK, to see in extension name="x_preprocess_bug2".



It's  this known problem or I'm wrong understanding preprocessor usage ??




 	Thanks
 			Kleo

-- 
 	kleo+freeswitch at netbox.cz





More information about the FreeSWITCH-users mailing list