[AsteriskBrasil] Consulta com expressões regulares

Nicolas Tanski nicolas.tanski em gmail.com
Sábado Dezembro 3 13:49:07 BRST 2016


Guilherme,

veja se alguma dessas regras funcionam para o que você precisa.

exten => s,n,Gotoif($["${CONSULTA2}" = "null"]?nsip:ysip)

exten => s,n,Gotoif($["${ISNULL(${CONSULTA2})}"]?nsip:ysip)

exten => s,n,Gotoif($["${LEN(${CONSULTA2})}" > 0]?ysip:nsip)



*Null Strings*
Testing to see if a string is null can be done in one of three different
ways:

exten => _XX.,1,GotoIf($["${calledid}" != ""]?3)

exten => _XX.,1,GotoIf($[foo${calledid} != foo]?3)

exten => _XX.,1,GotoIf($[${LEN(${calledid})} > 0]?3)

The second example above is the way suggested by the WIKI. It will work as
long as there are no spaces in the evaluated value.

The first way should work in all cases, and indeed, might now be the safest
way to handle this situation.

The third way seems the most logical. Anyone care to comment. Besides the
LEN() function, there is now also ISNULL. Keep in mind such function calls
need to kept inside ${...}.

Fonte: http://www.voip-info.org/wiki/view/Asterisk+Expressions


_____________________

Att,


*Nicolas*

Em 3 de dezembro de 2016 10:08, Guilherme Alano <guilhermealano em hotmail.com>
escreveu:

> Bom dia pessoal, preciso de uma ajuda ou dica.
>
>
> Tenho uma URA onde faço consulta em um BD, porém para campos nulos não
> estou conseguindo considerar ou criticar.
>
>
> Estou usando a seguinte exten.
>
>
> exten => s,n,Gotoif($["${CONSULTA2}" != '']?ysip:nsip)
>
>
> Quando faço a consulta direto pela CLI e o campo seja NULL, ODBC READ ...
> me retorna assim:
>
>
> spbx*CLI> odbc read ODBC_FUNCIONARIO 08989898989001 exec
> NomeFuncionario       (nil)
>
>
> E com isso na exten ele considera como verdadeiro o resultado.
>
>
> Obrigado,
>
> Guilherme Alano
>
>
>
>
> _______________________________________________
> KHOMP: completa linha de placas externas FXO, FXS, GSM e E1
> Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7
> Intercomunicador e acesso remoto via rede IP e telefones IP
> Conheça todo o portfólio em www.Khomp.com
> _______________________________________________
> Para remover seu email desta lista, basta enviar um email em branco para
> asteriskbrasil-unsubscribe em listas.asteriskbrasil.org
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://asteriskbrasil.org/pipermail/asteriskbrasil/attachments/20161203/50b989dd/attachment.html>


Mais detalhes sobre a lista de discussão AsteriskBrasil