<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("avpops","db_url","sqlite:///usr/local/opensips_proxy/sqlite") # 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, "$avp(myAvp)"); # 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} & {CustomerContext}, the query returns a value of which PBX <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: +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 <users-bounces@lists.opensips.org> em nome de Travis Manson-Drake <travism@simplybits.com><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> </div>
</div>
<div>
<div style="">
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
Hello everyone, </p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",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: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
Here’s what I’m trying to accomplish.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
Thought process</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",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: "Calibri",sans-serif;">
<span style="">-<span style="font:7.0pt "Times New Roman""> </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: "Calibri",sans-serif;">
- once the proxy parses the data, we query a database.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
- based on the value of {exten} & {CustomerContext}, the query returns a value of which PBX this {exten}&{CustomerContext} belongs to.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
- once this info has been returned to the proxy it then manipulates the dest_uri to something like {exten}&{CustomerContext}@PBX DNS</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",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: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
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.</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
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</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
With that being said:</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
How would I do this?</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
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</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",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: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
Any input is greatly appreciated! </p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
Thank you for your time,</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
</p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<b><span style="font-size:10.0pt; line-height:115%; font-family:"Arial",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: "Calibri",sans-serif;">
<b><span style="font-size:10.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">Voice Systems Analyst L1</span></b></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<b><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:navy">Simply Bits, LLC</span></b><span style="font-size:12.0pt; font-family:"Arial",sans-serif; color:navy"></span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<b><i><span style="font-size:8.0pt; font-family:"Arial",sans-serif; color:#FFC000">Now You’re Thinkin’ Smart!</span></i></b><span style="font-family:"Arial",sans-serif; color:navy"></span></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<span style="font-size:8.0pt; line-height:115%; font-family:"Arial",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: "Calibri",sans-serif;">
<b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">Phone:</span></b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">
</span><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:#002060">520-545-0311</span><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy"></span></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">Fax:</span></b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">
</span><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:#002060">520-545-7252</span></p>
<p style="line-height: 115%; margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">Support Hotline</span></b><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy">:
</span><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:#002060">5205450333</span><span style="font-size:8.0pt; line-height:115%; font-family:"Arial",sans-serif; color:navy"></span></p>
<p style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: "Calibri",sans-serif;">
<span style="font-family:"Arial",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:"Times New Roman",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: "wf_segoe-ui_semilight","Segoe UI Semilight","Segoe WP Semilight","Segoe UI","Segoe WP",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: "wf_segoe-ui_normal","Segoe UI","Segoe WP",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: "wf_segoe-ui_normal","Segoe UI","Segoe WP",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: "Calibri",sans-serif;">
</p>
</div>
</div>
</div>
</div>
</body>
</html>