<HTML>
<HEAD>
<TITLE>Re: [Freeswitch-users] Script para chequear un numero de destino</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hey Mesquita!<BR>
<BR>
I was just speaking with Fernando on IRC... I suggested he look at <a href="http://wiki.freeswitch.org/wiki/Mod_odbc_query">http://wiki.freeswitch.org/wiki/Mod_odbc_query</a>. This mixed with a little dialplan might be just what he needs. Appears he might be trying to only pass calls to say wireless destinations. &#8216;Mi espa&ntilde;ol es no bueno&#8217; tho so any help on the language barrier could prove useful for him.<BR>
<BR>
Thanks!<BR>
<BR>
<BR>
On 4/27/11 9:36 PM, &quot;Jo&atilde;o Mesquita&quot; &lt;<a href="jmesquita@freeswitch.org">jmesquita@freeswitch.org</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hola Fernando,<BR>
<BR>
Yo mas o menos hablo espa&ntilde;ol as&iacute; que trato de darte una mano. Ten&eacute;s muchas opciones. mod_easyroute como lo menciona Ken es una, ESL (event_socket) es otra, xml_curl es otra y uno de los &quot;bindings&quot; como lua, python, perl, etc... es otra.<BR>
<BR>
Lo que tenemos que encontrar es lo que a vos te es mas comodo. Program&aacute;s? En que lenguaje? Si no program&aacute;s, mod_easyroute seguramente ser&aacute; lo mejor. ESL es lo m&aacute;s complicadito de todos ya que el dialplan entero lo tenes que programar desde tu socket y tirar los comandos hacia freeswitch en un orden especifico. XML_CURL es muy facil si sabes desarrollar en web.<BR>
<BR>
Enfim, espero noticias tuyas para que te pueda ayudar con un determinado camino.<BR>
<BR>
Saludos,<BR>
<BR>
Jo&atilde;o Mesquita<BR>
<BR>
<BR>
<BR>
2011/4/27 Ken Rice &lt;<a href="krice@freeswitch.org">krice@freeswitch.org</a>&gt;<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Routing a call if a number exists in a database...  Hmmm sounds suspiciously a lot like mod_easyroute<BR>
<FONT COLOR="#888888"><BR>
k<BR>
</FONT><BR>
<BR>
<BR>
On 4/27/11 8:24 PM, &quot;Roger Castaldo&quot; &lt;<a href="roger.castaldo@gmail.com">roger.castaldo@gmail.com</a> &lt;<a href="http://roger.castaldo@gmail.com">http://roger.castaldo@gmail.com</a>&gt; &gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I ran your email through google translate and from what I can tell you want freeswitch to route a call if the number exists in database X.  That being said, the event socket is not the way to go, look at doing it via a lua script call from the dial plan, then you can have the lua query the database, if it exists, use the api to route the call, or set a flag for the dial plan, otherwise it can hang up, or play a message and hang up which ends the call and stops processing in your dial plan.<BR>
<BR>
2011/4/27 FERNANDO VILLARROEL &lt;<a href="fvillarroel@yahoo.com">fvillarroel@yahoo.com</a> &lt;<a href="http://fvillarroel@yahoo.com">http://fvillarroel@yahoo.com</a>&gt; &gt;<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hola a todos.<BR>
<BR>
Voy a recibir trafico desde un Gateway A que mi FS enrutar&aacute; hacia un Gateway B.<BR>
<BR>
Hasta ahy todo bien, el asunto es que antes de enrutar la llamada hacia el gateway B de alguna manera debo consultar el numero de destino en una base de datos si es as&iacute; entonces se enruta la llamada en caso contrario la llamda la debo declinar de mi lado para que el Gateway A pueda enrutar esa llamada por otro proveedor distinto de mi.<BR>
<BR>
Entonces lo que pienso hacer es un Script usando event_socket para que haga la consulta en la base de datos, entonces si el numero de destino esta la base de datos se enruta la llamada en caso contrario la declino para que la llamada continue por otro proveedor.<BR>
<BR>
Mi tema es que no se me ocurre como hacer esto, imagino que  en el dialplan para que dependiendo de la existencia del numero de destino en la base de datos haga una llamada o en caso contrario haga otra cosa.<BR>
<BR>
Agredecere aguna idea o sugerencia sobre como resolver este problema.<BR>
<BR>
Con Asterisk usaria DeadAgi para pasarle el control a un script que consulte con la base de datos y me retorne true si puedo llamar o false en caso contario. Y digo DeadAgi ya que el control lo toma el script, ya que si usara Agi el control sigue en Asterisk independiente de lo que este haciendo el Script.<BR>
<BR>
Aprovecho entonces de consultar con event_socket el control pasa al script o el dialplan continua ejecutandose.<BR>
<BR>
Agradecere cualquier idea o sugerencia.<BR>
<BR>
Saludos<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
_______________________________________________<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a> &lt;<a href="http://FreeSWITCH-users@lists.freeswitch.org">http://FreeSWITCH-users@lists.freeswitch.org</a>&gt; <BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_______________________________________________<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a> &lt;<a href="http://FreeSWITCH-users@lists.freeswitch.org">http://FreeSWITCH-users@lists.freeswitch.org</a>&gt; <BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
_______________________________________________<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
<HR ALIGN=CENTER SIZE="3" WIDTH="95%"></SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'>_______________________________________________<BR>
FreeSWITCH-users mailing list<BR>
<a href="FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><BR>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><BR>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><BR>
<a href="http://www.freeswitch.org">http://www.freeswitch.org</a><BR>
</SPAN></FONT></FONT></BLOCKQUOTE>
</BODY>
</HTML>