I guess regex on the result of sofia_gateway_data and then testing the result is not empty would do it.
http://wiki.freeswitch.org/wiki/Mod_commands#regex
-Steve
Thanks Steven, that's actually a different approach, and quite straight-forward. I will use that.I was actually not aware I could include API commands in ${}.Nevertheless, so I can update the wiki, anyone knows how to use sofia_gateway_data ?David Ponzone Direction Techniqueemail: david.ponzone@ipeva.frtel: 01 74 03 18 97gsm: 06 66 98 76 34Service Client IPevatel: 0811 46 26 26Ce 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 04/02/2011 à 09:45, Steven Ayre a écrit :API commands:
sofia profile <name> gwlist up
sofia profile <name> gwlist down
List the up/down gateways (names separated by space). You can do a regex on that result from dialplan. For example this will only execute if the gateway is up:
<extension>
<condition field="${sofia profile gwlist up}" expression="\bgw001\b">
<action application="bridge" data="sofia/gateway/gw001/${destination_number}"/>
<condition>
<extension>
\b matches word boundary, so will match both the start of word (both at start of string and after space) and the end of the word (at the end of a string or before a space).
-SteveOn 4 February 2011 08:05, David Ponzone <david.ponzone@ipeva.fr> wrote:All,I am still trying to reroute a call in case a gateway is down, but I decided to do that another way.I'd like to detect my gateway is down, and I was trying to use sofia_gateway_data function for that purpose.But I can't figure out the expected args.I try:sofia_gateway_data <gatewayname> var Statusor ivar/ovar instead of varI tried with both a gateway I register to, and an IP-auth-based gateway I ping regularly.So I am stuck now, and I can't find any info anywhere on how to detect a gateway is flagged as DOWN.TIADavid Ponzone Direction Techniqueemail: david.ponzone@ipeva.frtel: 01 74 03 18 97gsm: 06 66 98 76 34Service Client IPevatel: 0811 46 26 26Ce 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.
_______________________________________________
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
_______________________________________________
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
_______________________________________________
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