Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Escape variable content when used as a field in a condition


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
david.villasmil.work a...
Guest





PostPosted: Tue Sep 14, 2021 2:49 pm    Post subject: [Freeswitch-users] Escape variable content when used as a fi Reply with quote

Hello all,

I'm trying to compare 2 variables in a condition, something like


<condition field="${sip_from_user}" expression="^${some_other_phone_number}$" inline="true">


But it looks like FS expands the variable, and does the comparison. The problem with this is, those 2 phone numbers are in e.164, i.e.:


sip_from_user = +18885551212
some_other_phone_number = +18005551212



and so the condition ends up being:


<condition field="+18885551212" expression="^+18005551212$" inline="true">


which of course won't work....


Is there any way of escaping the variables automatically when comparing?
I haven't found a way.


Thanks!


David Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337
Back to top
krice at freeswitch.org
Guest





PostPosted: Tue Sep 14, 2021 8:07 pm    Post subject: [Freeswitch-users] Escape variable content when used as a fi Reply with quote

put a slash right after the ^ In the expression or you have to feed it a proper regex in that chanvar.



Sent from my iPhone

Quote:
On Sep 14, 2021, at 14:33, David Villasmil <david.villasmil.work@gmail.com> wrote:

Hello all,

I'm trying to compare 2 variables in a condition, something like


<condition field="${sip_from_user}" expression="^${some_other_phone_number}$" inline="true">


But it looks like FS expands the variable, and does the comparison. The problem with this is, those 2 phone numbers are in e.164, i.e.:


sip_from_user = +18885551212
some_other_phone_number = +18005551212



and so the condition ends up being:


<condition field="+18885551212" expression="^+18005551212$" inline="true">


which of course won't work....


Is there any way of escaping the variables automatically when comparing?
I haven't found a way.


Thanks!


David Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337





_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com
Back to top
david.villasmil.work a...
Guest





PostPosted: Wed Sep 15, 2021 7:23 am    Post subject: [Freeswitch-users] Escape variable content when used as a fi Reply with quote

Thanks Ken, I tried that but it was just escaping the $ from ${variable}


I ended up using a cond function.


Thanks again


David


On Wed, 15 Sep 2021 at 02:08, Ken Rice <krice@freeswitch.org (krice@freeswitch.org)> wrote:

Quote:
put a slash right after the ^ In the expression or you have to feed it a proper regex in that chanvar.



Sent from my iPhone

Quote:
On Sep 14, 2021, at 14:33, David Villasmil <david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)> wrote:





Quote:
Hello all,

I'm trying to compare 2 variables in a condition, something like


<condition field="${sip_from_user}" expression="^${some_other_phone_number}$" inline="true">


But it looks like FS expands the variable, and does the comparison. The problem with this is, those 2 phone numbers are in e.164, i.e.:


sip_from_user = +18885551212
some_other_phone_number = +18005551212



and so the condition ends up being:


<condition field="+18885551212" expression="^+18005551212$" inline="true">


which of course won't work....


Is there any way of escaping the variables automatically when comparing?
I haven't found a way.


Thanks!


David Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337









Quote:
_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com



_________________________________________________________________________

The FreeSWITCH project is sponsored by SignalWire https://signalwire.com
Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services.
Build your next product on our scalable cloud platform.

Join our online community to chat in real time https://signalwire.community

Professional FreeSWITCH Services
sales@freeswitch.com (sales@freeswitch.com)
https://freeswitch.com

Official FreeSWITCH Sites
https://freeswitch.com/oss
https://freeswitch.org/confluence
https://cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
https://freeswitch.com


--
Regards,


David Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services