<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<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;">
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.<br>
<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 13:54<br>
<b>Para:</b> Users@lists.opensips.org<br>
<b>Assunto:</b> [OpenSIPS-Users] Questions in opensips</font>
<div>&nbsp;</div>
</div>
<div>
<div style="">
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Hello everyone, </p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
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.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Here&#8217;s what I&#8217;m trying to accomplish.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Thought process</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Sip packet comes into proxy</p>
<p style="text-indent: -0.25in; margin: 0in 0in 8pt 0.5in; line-height: 106%; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<span style="">-<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span>Proxy parses sip message, and checks from_uri (for example {exten}{CustomerConetxt}@proxyIPaddr)</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
-&nbsp; once the proxy parses the data, we query a database.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
- based on the value of {exten} &amp; {CustomerContext}, the query returns a value&nbsp;&nbsp; of which PBX this {exten}&amp;{CustomerContext} belongs to.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
- once this info has been returned to the proxy it then manipulates the dest_uri to something like {exten}&amp;{CustomerContext}@PBX DNS</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
At this point the sip message is forwarded onto the appropriate PBX, and we simply Record_Route for future communications.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
I know I can hard code the PBX&#8217;s value in the sip server of the UAC, and just have the proxy do what it does.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
But what I&#8217;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</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
With that being said:</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
How would I do this?</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
I had looked at sipmsgops and some of its functions however I can&#8217;t seem to find one that will enable me to pull just the dest uri, &amp; extract info from it</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Is there also a function in sipmsgops for manipulating the dest_uri? </p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Any input is greatly appreciated! </p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
Thank you for your time,</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<b><span style="font-size:10.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy">Travis Manson-Drake</span></b></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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:12.0pt; font-family:&quot;Arial&quot;,sans-serif; color:navy"></span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<b><i><span style="font-size:8.0pt; font-family:&quot;Arial&quot;,sans-serif; color:#FFC000">Now You&#8217;re Thinkin&#8217; Smart!</span></i></b><span style="font-family:&quot;Arial&quot;,sans-serif; color:navy"></span></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy"></span></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<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:8.0pt; line-height:115%; font-family:&quot;Arial&quot;,sans-serif; color:navy"></span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
<span style="font-family:&quot;Arial&quot;,sans-serif; color:#1F497D"><a id="LPlnk267778" style="color: rgb(5, 99, 193); text-decoration: underline;" href="http://www.simplybits.com/" title="http://www.simplybits.com/"><span style="font-size:8.0pt; font-family:&quot;Times New Roman&quot;,serif; color:#0563C1">www.simplybits.com</span></a></span></p>
<div style="margin-top: 20px; margin-bottom: 20px; overflow: auto; width: 100%;" id="LPBorder_GT_14435463875780.5056159045648994">
<table style="border-top: 1px solid rgb(204, 204, 204); border-bottom: 1px solid rgb(204, 204, 204); width: 80%; background-color: rgb(255, 255, 255); position: relative; overflow: auto;" id="LPContainer_14435463875760.37314830932578746">
<tbody>
<tr valign="top">
<td>
<div style="top: 0px; margin-top: 8px; font-size: 21px; font-family: &quot;wf_segoe-ui_semilight&quot;,&quot;Segoe UI Semilight&quot;,&quot;Segoe WP Semilight&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; color: rgb(51, 51, 51); margin-left: 14px; margin-right: 14px;" id="LPTitle_14435463875770.15876367962107085">
Internet - Phone - Business Technology Solutions | Simply Bits</div>
<div style="margin-top: 8px; font-size: 13px; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; color: rgb(102, 102, 102); margin-left: 14px; margin-right: 14px;" id="LPDescription_14435463875770.5587309017927775">
Providing buisnesses with qualtiy solutions for Internet Service, VoIP Phone Service, Fax to email, Website Design, Internet Marketing and much more.</div>
<div style="margin: 8px 14px 10px; height: 18px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" id="LPUrlContainer_14435463875770.039874300339964086">
<a target="_blank" href="http://www.simplybits.com/" style="font-size: 11px; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; text-decoration: none;" id="LPUrlAnchor_14435463875770.10753627546729905">Leia mais...</a></div>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: &quot;Calibri&quot;,sans-serif;">
&nbsp;</p>
</div>
</div>
</div>
</div>
</body>
</html>