dialplan - expression matching and variable - 2nd try
Hi all, sorry for the first message, I hit the wrong keys an Outlook sent the message...once again: why is the following not working: <condition field="destination_number" expression="^(500)$|^(600)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty when using the above expression, $1 is empty. If I do it like this <condition field="destination_number" expression="^(5\d\d)$|^(6\d\d)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty It's working. I don't understand why. Thanks in advance and best regards, Stefan
Stefan, I am not sure to understand the difference between your 2 trials. In both cases, you say $1 is empty, so I am not sure what is working in test 2. Also, you should tell us what number you call to test (500 or 600). Finally, if you right a regexp, every () group you define will be used to populate $1, $2, etc... So in: ^(500)$|^(600)$ $1 will contain 500 if you call 500 and then $2 will be empty $1 will be empty and $2 will contain 600 if it matches You should write: ^(500|600)$ David Ponzone Direction Technique email: david.ponzone@ipeva.fr tel: 01 74 03 18 97 gsm: 06 66 98 76 34 Service Client IPeva tel: 0811 46 26 26 www.ipeva.fr - www.ipeva-studio.com Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur. Le 21/01/2011 à 11:13, Weigel, Stefan a écrit :
Hi all,
sorry for the first message, I hit the wrong keys an Outlook sent the message…once again:
why is the following not working:
<condition field="destination_number" expression="^(500)$|^(600)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty
when using the above expression, $1 is empty.
If I do it like this
<condition field="destination_number" expression="^(5\d\d)$|^(6\d\d)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty
It’s working. I don’t understand why.
Thanks in advance and best regards,
Stefan _______________________________________________ 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 http://www.freeswitch.org
Hi David, got it! I forgot about the multiple ‘()’ leading to $1, $2 .. $n. I was always using $1, so in some cases it was empty. Dooh.. Thanks! Best regards Stefan Stefan Weigel Advanced IT-Professional Tel.: +49 89 2000 48 975 Fax: +49 89 2000 48 566 eMail: Stefan.Weigel@allianz-warranty.com<mailto:Stefan.Weigel@allianz-warranty.com> Allianz Automotive Services GmbH Einsteinring 28 85609 Aschheim Germany http://www.allianz-warranty.com Geschäftsführung: Andreas Rösing, Horst Ziegler Amtsgericht München, HRB 175682 Für Umsatzsteuerzwecke: Ust-ID-Nr.: DE 262 617 720 Von: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] Im Auftrag von David Ponzone Gesendet: Freitag, 21. Januar 2011 11:57 An: FreeSWITCH Users Help Betreff: Re: [Freeswitch-users] dialplan - expression matching and variable - 2nd try Stefan, I am not sure to understand the difference between your 2 trials. In both cases, you say $1 is empty, so I am not sure what is working in test 2. Also, you should tell us what number you call to test (500 or 600). Finally, if you right a regexp, every () group you define will be used to populate $1, $2, etc... So in: ^(500)$|^(600)$ $1 will contain 500 if you call 500 and then $2 will be empty $1 will be empty and $2 will contain 600 if it matches You should write: ^(500|600)$ David Ponzone Direction Technique email: david.ponzone@ipeva.fr<mailto:david.ponzone@ipeva.fr> tel: 01 74 03 18 97 gsm: 06 66 98 76 34 Service Client IPeva tel: 0811 46 26 26 www.ipeva.fr<BLOCKED::http://www.ipeva.fr/> - www.ipeva-studio.com<BLOCKED::http://www.ipeva-studio.com/> Ce message et toutes les pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisée est interdite. Tout message électronique est susceptible d'altération. IPeva décline toute responsabilité au titre de ce message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas destinataire de ce message, merci de le détruire immédiatement et d'avertir l'expéditeur. Le 21/01/2011 à 11:13, Weigel, Stefan a écrit : Hi all, sorry for the first message, I hit the wrong keys an Outlook sent the message…once again: why is the following not working: <condition field="destination_number" expression="^(500)$|^(600)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty when using the above expression, $1 is empty. If I do it like this <condition field="destination_number" expression="^(5\d\d)$|^(6\d\d)$"> <action application="set" data="dialed_number=$1"/> <-- $1 is empty It’s working. I don’t understand why. Thanks in advance and best regards, Stefan _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org<mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
$1 is the first brackets $2 is the second brackets If you dial 5xx I would expect $1 to be 5xx and $2 empty If you dial 6xx I would expect $1 empty and $2 to be 6xx Try: <condition field="destination_number" expression="^(500|600)$"> -Steve On 21 January 2011 10:13, Weigel, Stefan <Stefan.Weigel@allianz-warranty.com
wrote:
Hi all,
sorry for the first message, I hit the wrong keys an Outlook sent the message…once again:
why is the following not working:
<condition field="destination_number" expression="^(500)$|^(600)$">
<action application="set" data="dialed_number=$1"/> <-- $1 is empty
when using the above expression, $1 is empty.
If I do it like this
<condition field="destination_number" expression="^(5\d\d)$|^(6\d\d)$">
<action application="set" data="dialed_number=$1"/> <-- $1 is empty
It’s working. I don’t understand why.
Thanks in advance and best regards,
Stefan
_______________________________________________ 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 http://www.freeswitch.org
participants (3)
-
David Ponzone
-
Steven Ayre
-
Weigel, Stefan