Hi Travis: Maybe you should take a look to drouting module http://www.opensips.org/html/docs/modules/2.1.x/drouting.html
It makes what you want and much more, it automatically disables a PBX if is down, cache the results, do automatic failover,.... Remember that make a query directly in your code can be a slow process. If you do it take in consideration using async operations. This is a great improvement in 2.x branch Regards, Carlos Oliva * _________________________________________________ Carlos OlivaDepartamento de Sistemas C/ Pujades, 77-79, 8a Planta 9B | 08005 Barcelona www.numintec.com <http://www.numintec.com/> | [email protected] <[email protected]> | T: 902 02 02 97 _________________________________________________ Talking Numintec: Dialogando con empresarios de éxito <http://www.youtube.com/user/numintec> <http://www.youtube.com/user/numintec> Las soluciones en la nube de Numintec - Casos de éxito <http://www.numintec.com/category/caso-de-exito/> <http://www.numintec.com/category/caso-de-exito/> Solicita una demo <http://www.numintec.com/demo/> _________________________________________________ Medio Ambiente: Antes de imprimir este mensaje, asegúrese de que es necesario. Nota Legal: La información contenida en la presente transmisión es confidencial y su uso únicamente está permitido a su(s) destinatario(s). Le informamos que los datos personales que facilite/ha facilitado pasarán/han pasado a formar parte de un fichero responsabilidad de NUMINTEC COMUNICACIONES S.L.. y que tiene por finalidad gestionar las relaciones. Tiene la posibilidad de ejercitar los derechos de acceso, rectificación, cancelación y oposición respecto a sus datos ante la empresa, en el e-mail [email protected] <[email protected]> o bien en el domicilio sito en C/ Pujades, 77-79 8ª Planta 9-B 08005 de Barcelona.* 2015-09-29 20:53 GMT+02:00 Rodrigo Pimenta Carvalho <[email protected]>: > I think so. > Good lucky. > > > > RODRIGO PIMENTA CARVALHO > Inatel Competence Center > Software > Ph: +55 35 3471 9200 RAMAL 979 > > > ------------------------------ > *De:* [email protected] <[email protected]> > em nome de Travis Manson-Drake <[email protected]> > *Enviado:* terça-feira, 29 de setembro de 2015 14:42 > *Para:* OpenSIPS users mailling list > *Assunto:* Re: [OpenSIPS-Users] Questions in opensips > > > Rodrigo, > > > > Thank you for this! This helps out a lot in relation to pulling the info > from a database. > > > > I think I may be able to do something with variable $fu > > > > Select PBX > > From table > > Where CustomerContext like ‘%$fu%’ > > > > That way If I have multiple customercontext it can dynamically select the > correct PBX > > > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Rodrigo Pimenta Carvalho > *Sent:* Tuesday, September 29, 2015 10:17 AM > *To:* OpenSIPS users mailling list <[email protected]> > *Subject:* Re: [OpenSIPS-Users] Questions in opensips > > > > Hi. > I'm new to OpenSIPS too and I have received good help from experts that > access this forum. > But, one point that you have to do is access a database to get the > information about the PBX, haven't you? For this, you can use the module > AVPOP: > > modparam("avpops","db_url","sqlite:///usr/local/opensips_proxy/sqlite") # > CUSTOMIZE ME > > That is, you can use a module that allows you to access the database. In > this example, I use SQLite. > > Are you familiar with the database handling actions via such module? > > To get data from database, you can do something like this: > > avp_db_query(put sql query here, "$avp(myAvp)"); # the avp will contain > the query result. > > About the others details, like forwarding calls, someone expert might > reply to you. > > You SQL will be similar to: select PBX from table where Exten = > 'extension' and CustomerContext = 'the customer context'; > > {exten} & {CustomerContext}, the query returns a value of which PBX > > Tell me if this information is useful for you, please. > > Regards. > > > > > > RODRIGO PIMENTA CARVALHO > Inatel Competence Center > Software > Ph: +55 35 3471 9200 RAMAL 979 > > > ------------------------------ > > *De:* [email protected] <[email protected]> > em nome de Travis Manson-Drake <[email protected]> > *Enviado:* terça-feira, 29 de setembro de 2015 13:54 > *Para:* [email protected] > *Assunto:* [OpenSIPS-Users] Questions in opensips > > > > Hello everyone, > > > > I wanted to pick your brains and see if any of you have done something > like this before, or might eb able to send me in the right direction. > > > > Here’s what I’m trying to accomplish. > > > > Thought process > > > > Sip packet comes into proxy > > - Proxy parses sip message, and checks from_uri (for example > {exten}{CustomerConetxt}@proxyIPaddr) > > - once the proxy parses the data, we query a database. > > - based on the value of {exten} & {CustomerContext}, the query returns a > value of which PBX this {exten}&{CustomerContext} belongs to. > > - once this info has been returned to the proxy it then manipulates the > dest_uri to something like {exten}&{CustomerContext}@PBX DNS > > > > At this point the sip message is forwarded onto the appropriate PBX, and > we simply Record_Route for future communications. > > > > I know I can hard code the PBX’s value in the sip server of the UAC, and > just have the proxy do what it does. > > But what I’m really trying to go for is to simply hardcode the info for a > sip proxy, have the UAC send its request to it, then it forwards on traffic > to the appropriate PBX based upon the value of the from_uri > > > > With that being said: > > > > How would I do this? > > > > I had looked at sipmsgops and some of its functions however I can’t seem > to find one that will enable me to pull just the dest uri, & extract info > from it > > > > Is there also a function in sipmsgops for manipulating the dest_uri? > > > > Any input is greatly appreciated! > > > > Thank you for your time, > > > > > > *Travis Manson-Drake* > > *Voice Systems Analyst L1* > > *Simply Bits, LLC* > > *Now You’re Thinkin’ Smart!* > > 5225 N. Sabino Canyon Road > Tucson, AZ 85750 > > *Phone:* 520-545-0311 > > *Fax:* 520-545-7252 > > *Support Hotline*: 5205450333 > > www.simplybits.com > > Internet - Phone - Business Technology Solutions | Simply Bits > > Providing buisnesses with qualtiy solutions for Internet Service, VoIP > Phone Service, Fax to email, Website Design, Internet Marketing and much > more. > > Leia mais... <http://www.simplybits.com/> > > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > >
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
