<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
I think so.<br>
Good lucky.<br>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>De:</b> users-bounces@lists.opensips.org &lt;users-bounces@lists.opensips.org&gt; em nome de Travis Manson-Drake &lt;travism@simplybits.com&gt;<br>
<b>Enviado:</b> terça-feira, 29 de setembro de 2015 14:42<br>
<b>Para:</b> OpenSIPS users mailling list<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] Questions in opensips</font>
<div>&nbsp;</div>
</div>
<div>
<div style="">
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">Rodrigo,</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">Thank you for this! This helps out a lot in relation to pulling the info from a database.</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">I think I may be able to do something with variable $fu</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">Select PBX</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">From table</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">Where CustomerContext like ‘%$fu%’</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">That way If I have multiple customercontext it can dynamically select the correct PBX</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:#1F497D">&nbsp;</span></p>
<div>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0in 0in 0in">
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif"> users-bounces@lists.opensips.org [mailto:users-bounces@lists.opensips.org]
<b>On Behalf Of </b>Rodrigo Pimenta Carvalho<br>
<b>Sent:</b> Tuesday, September 29, 2015 10:17 AM<br>
<b>To:</b> OpenSIPS users mailling list &lt;Users@lists.opensips.org&gt;<br>
<b>Subject:</b> Re: [OpenSIPS-Users] Questions in opensips</span></p>
</div>
</div>
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
&nbsp;</p>
<div id="divtagdefaultwrapper">
<p style="background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">Hi.<br>
I'm new to OpenSIPS too and I have received good help from experts that access this forum.<br>
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:<br>
<br>
modparam(&quot;avpops&quot;,&quot;db_url&quot;,&quot;sqlite:///usr/local/opensips_proxy/sqlite&quot;) # CUSTOMIZE ME<br>
<br>
That is, you can use a module that allows you to access the database. In this example, I use SQLite.<br>
<br>
Are you familiar with the database handling actions via such module?<br>
<br>
To get data from database, you can do something like this:<br>
<br>
avp_db_query(put sql query here, &quot;$avp(myAvp)&quot;);&nbsp; # the avp will contain the query result.<br>
<br>
About the others details, like forwarding calls, someone expert might reply to you.<br>
<br>
You SQL will be similar to: select PBX from table where Exten = 'extension' and CustomerContext = 'the customer context';<br>
<br>
{exten} &amp; {CustomerContext}, the query returns a value&nbsp;&nbsp; of which PBX&nbsp; <br>
<br>
Tell me if this information is useful for you, please.<br>
<br>
Regards.</span></p>
<p style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<div id="Signature">
<div name="divtagdefaultwrapper">
<div>
<div>
<p style="background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:10.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979</span></p>
</div>
</div>
</div>
</div>
<p style="background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<div>
<div style="text-align: center; background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;" align="center">
<span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">
<hr align="center" size="2" width="98%">
</span></div>
<div id="divRplyFwdMsg">
<p style="background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">De:</span></b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">
</span><a style="color: blue; text-decoration: underline;" href="mailto:users-bounces@lists.opensips.org"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">users-bounces@lists.opensips.org</span></a><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">
 &lt;</span><a style="color: blue; text-decoration: underline;" href="mailto:users-bounces@lists.opensips.org"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">users-bounces@lists.opensips.org</span></a><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&gt;
 em nome de Travis Manson-Drake &lt;</span><a style="color: blue; text-decoration: underline;" href="mailto:travism@simplybits.com"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">travism@simplybits.com</span></a><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&gt;<br>
<b>Enviado:</b> terça-feira, 29 de setembro de 2015 13:54<br>
<b>Para:</b> </span><a style="color: blue; text-decoration: underline;" href="mailto:Users@lists.opensips.org"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif">Users@lists.opensips.org</span></a><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black"><br>
<b>Assunto:</b> [OpenSIPS-Users] Questions in opensips</span><span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">
</span></p>
<div>
<p style="background: white none repeat scroll 0% 0%; margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
</div>
</div>
<div>
<div>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Hello everyone,
</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">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.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Here’s what I’m trying to accomplish.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Thought process</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Sip packet comes into proxy</span></p>
<p style="margin-right:0in; margin-bottom:8.0pt; margin-left:.5in; text-indent:-.25in; line-height:105%; background:white">
<span style="font-size:11.0pt; line-height:105%; font-family:&quot;Calibri&quot;,sans-serif; color:black">-</span><span style="font-size:7.0pt; line-height:105%; color:black">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style="font-size:11.0pt; line-height:105%; font-family:&quot;Calibri&quot;,sans-serif; color:black">Proxy parses sip message, and checks from_uri (for example {exten}{CustomerConetxt}@proxyIPaddr)</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">-&nbsp; once the proxy parses the data, we query a database.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">- based on the value of {exten} &amp; {CustomerContext}, the query returns a value&nbsp;&nbsp; of which PBX this {exten}&amp;{CustomerContext} belongs to.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">- once this info has been returned to the proxy it then manipulates the dest_uri to something like {exten}&amp;{CustomerContext}@PBX DNS</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">At this point the sip message is forwarded onto the appropriate PBX, and we simply Record_Route for future communications.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">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.</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">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</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">With that being said:</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">How would I do this?</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">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, &amp; extract info from
 it</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Is there also a function in sipmsgops for manipulating the dest_uri?
</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Any input is greatly appreciated!
</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">Thank you for your time,</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
<p style="line-height:115%; background:white"><b><span style="font-size:10.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Travis Manson-Drake</span></b><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="line-height:115%; background:white"><b><span style="font-size:10.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Voice Systems Analyst L1</span></b><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="background:white"><b><span style="font-size:10.0pt; font-family:&quot;Arial&quot;,sans-serif; color:navy">Simply Bits, LLC</span></b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="background:white"><b><i><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,sans-serif; color:#FFC000">Now You’re Thinkin’ Smart!</span></i></b><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="line-height:115%; background:white"><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">5225 N. Sabino Canyon Road
<br>
Tucson, AZ 85750</span><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="line-height:115%; background:white"><b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Phone:</span></b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">
</span><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:#002060">520-545-0311</span><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="line-height:115%; background:white"><b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Fax:</span></b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">
</span><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:#002060">520-545-7252</span><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="line-height:115%; background:white"><b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Support Hotline</span></b><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">:
</span><span style="font-size:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:#002060">5205450333</span><span style="font-size:11.0pt; line-height:115%; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<p style="background:white"><a style="color: blue; text-decoration: underline;" href="http://www.simplybits.com/" title="http://www.simplybits.com/" id="LPlnk267778"><span style="font-size:8.0pt; color:#0563C1">www.simplybits.com</span></a><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black"></span></p>
<div id="LPBorder_GT_14435463875780.5056159045648994" style="margin-top:15.0pt; margin-bottom:15.0pt; overflow:auto">
<table class="MsoNormalTable" style="width:80.0%; background:white; border-top:solid #CCCCCC 1.0pt; border-left:none; border-bottom:solid #CCCCCC 1.0pt; border-right:none" cellpadding="0" border="1" width="80%">
<tbody>
<tr>
<td style="border:none; padding:.75pt .75pt .75pt .75pt" valign="top">
<div id="LPTitle_14435463875770.15876367962107085" style="margin-left:10.5pt; margin-top:6.0pt; margin-right:10.5pt">
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:16.0pt; font-family:&quot;Segoe UI Semilight&quot;,sans-serif; color:#333333">Internet - Phone - Business Technology Solutions | Simply Bits</span></p>
</div>
<div id="LPDescription_14435463875770.5587309017927775" style="margin-left:10.5pt; margin-top:6.0pt; margin-right:10.5pt">
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<span style="font-size:10.0pt; font-family:&quot;Segoe UI&quot;,sans-serif; color:#666666">Providing buisnesses with qualtiy solutions for Internet Service, VoIP Phone Service, Fax to email, Website Design, Internet Marketing and much more.</span></p>
</div>
<div id="LPUrlContainer_14435463875770.039874300339964086" style="margin-left:10.5pt; margin-top:6.0pt; margin-right:10.5pt; margin-bottom:7.5pt; text-overflow:ellipsis; overflow:hidden">
<p style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: &quot;Times New Roman&quot;,serif;">
<a style="color: blue; text-decoration: underline;" href="http://www.simplybits.com/" target="_blank"><span style="font-size:8.5pt; font-family:&quot;Segoe UI&quot;,sans-serif; text-decoration:none">Leia mais...</span></a></p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<p style="background:white"><span style="font-size:11.0pt; font-family:&quot;Calibri&quot;,sans-serif; color:black">&nbsp;</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>