tag:blogger.com,1999:blog-79793782598210204252024-03-15T18:10:24.401-07:00SaevolGoJust some VoIP Stuff I Learn from internet and return the knowledge back to the internet.Unknownnoreply@blogger.comBlogger51125tag:blogger.com,1999:blog-7979378259821020425.post-3431166878235528802018-01-18T21:48:00.002-08:002018-01-19T10:27:20.393-08:00OpenSIPS Geo-Distributed Clustering & Data-Exchange<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<h2>
<span style="font-size: x-large;">OpenSIPS Clusterer Module</span></h2>
</div>
<div style="text-align: left;">
<br />
<h3 style="text-align: left;">
<span style="font-size: large;">Summary:</span></h3>
OpenSIPS 2.4 now allows users to exchange user data between clustered proxy nodes via proto_bin module. As a result the receiving Proxy can perform an action. <br />
<br />
In this blog post I'll try to show how we can exchange that data from the opensips script.<br />
<br />
<h4 style="text-align: left;">
<b>USE CASE:</b> Multi-Proxy cluster sharing User Locations and Querying Cluster to Find Users.</h4>
<br />
<iframe height="225px" src="https://docs.google.com/viewer?srcid=1ozX13S-cRaZpCvOxcorNhcotEvQlqeJb&pid=explorer&efh=false&a=v&chrome=false&embedded=true" width="580px"></iframe><br />
<br />
The Slideshow above shows a simple setup where multiple proxies can "Talk" to each other without using any other application as the communication platform. <br />
<br />
Previously we could share data as a one-way pipe to SQL, or NoSQL applications. By one-way pipe I mean that OpenSIPS server can deposit data but won't do anything as a recipient. since there is no way to tell each opensips box that <i>you are</i> the recipient and need to do something.<br />
<br />
OpenSIPS introduced the Event_route and EBR (Event Based Routing) some time ago but the custom events can not trigger on their own w/o developing some MI script. Obviously, the concept of adding more scripts and tools to make a fully functional distributed OpenSIPS environment is complicated to develop and maintain.<br />
<br />
Clusterer module in older versions of OpenSIPS (pre-devel/2.4) was only capable to exchange data from certain module internally i.e dialog, usrloc - user has no control over what data to be sent and how to perform an action when such a data is received.<br />
<h3 style="text-align: left;">
<br />
<div style="text-align: center;">
<b>WHATS NEW</b></div>
</h3>
<div style="text-align: left;">
1 - OpenSIPS cluster can broadcast script based Queries and wait for replies, perform action based on reply!</div>
<div style="text-align: left;">
</div>
<ul>
<li>Cluster can detect and share IP of a hacker with other nodes to perform some action</li>
<li>Update cluster about Location of a user, inquire about location of a user and send call to relevant proxy</li>
<li>Cluster can update about an ongoing conference call, other boxes can route calls to the hosting proxy</li>
<li>A Central OpenSIPS talking to Database on behalf of rest of the OpenSIPS cluster. SQL statements only reside there rest of the cluster only sends small text to expect a small reply. Useful incase of depositing CDRs.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://2.bp.blogspot.com/-zRI7Qo6QA2U/WmI4Hbkqk2I/AAAAAAAADjs/qjYOsim3k-oG2tpzM61JL4M2iSAzoLV9wCLcBGAs/s1600/OpenSIPS_Cluster_hl.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="771" data-original-width="1204" height="204" src="https://2.bp.blogspot.com/-zRI7Qo6QA2U/WmI4Hbkqk2I/AAAAAAAADjs/qjYOsim3k-oG2tpzM61JL4M2iSAzoLV9wCLcBGAs/s320/OpenSIPS_Cluster_hl.jpg" width="320" /></a></div>
<br />
<div style="text-align: left;">
2 - <a href="https://blog.opensips.org/2018/01/17/how-to-script-advanced-freeswitch-integrations-with-opensips-2-4/" target="_blank">FreeSWITCH advance scripting:</a></div>
If you've multiple FreeSWITCH boxes behind an OpenSIPS and multiple such deployments needing integration then this is going to be perfect to collect an ESL event and Broadcast it from local OpenSIPS to rest of the regions. This could be a game changer for multi-region deployments.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-8yAJyo_IKiw/WmI3xwVvlnI/AAAAAAAADjo/xpoQJfpHKE4XG-H9mkFm_qlMJHHftE4GACLcBGAs/s1600/OpenSIPS_Cluster_FS_ESL.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="799" data-original-width="1449" height="176" src="https://3.bp.blogspot.com/-8yAJyo_IKiw/WmI3xwVvlnI/AAAAAAAADjo/xpoQJfpHKE4XG-H9mkFm_qlMJHHftE4GACLcBGAs/s320/OpenSIPS_Cluster_FS_ESL.jpg" width="320" /></a></div>
<h3 style="text-align: left;">
<b><br />
</b></h3>
<h3 style="text-align: center;">
<b>TIME FOR ACTION</b></h3>
<div style="text-align: left;">
Lets see how this all can be done from inside the opensips.cfg</div>
A complete sample config file is available here:<br />
<a href="https://github.com/goharahmed/opensips-clusterer">https://github.com/goharahmed/opensips-clusterer</a><br />
<br />
<h4 style="text-align: center;">
<u>Loading Modules</u></h4>
<br />
<script src="https://gist.github.com/goharahmed/267bf03907a5b86af1186229afd73406.js"></script><br />
<br />
The "db_mode" param is set to 0 so we don't depend on DB to find other Cluster nodes, its my personal preference you can load all cluster nodes from MySQL DB and run mi-fifo command to reload the new node data. <br />
What I've done is added two core nodes in the config so any new node just needs to point to any one of the core servers and everyone will be aware of the whole cluster topology.<br />
<br />
Event_routing module are critical for this to work, they invoke config file script when a certain event is triggered.<br />
<h4 style="text-align: left;">
<br />
</h4>
<h4 style="text-align: center;">
<u>Sharing Data</u></h4>
First we need to identify what data needs to be shared across the cluster. In the code snippet below I figure I need to tell other boxes if some hacker is trying to make Bruteforce Registration to users which are not defined in my DB. Also, I share the successfully registered user info.<br />
<br />
<script src="https://gist.github.com/goharahmed/ffb38700c209d6e43435c15205e9c52a.js"></script><br />
<br />
<br />
Here are the exact routes responsible for Broadcasting the message string to the cluster.<br />
<br />
<script src="https://gist.github.com/goharahmed/9bca5a6e40ef61bb2e23f26b5f0e8d3b.js"></script><br />
<br />
Infact these Lines are the real deal here:<br />
<br />
<span style="color: white; font-family: "courier new" , "courier" , monospace;"><b> $var(cl_id) = 1;</b></span><br />
<span style="color: white; font-family: "courier new" , "courier" , monospace;"><b> $var(msg_str) = "I_LOVE_OPENSIPS";</b></span><br />
<span style="color: white; font-family: "courier new" , "courier" , monospace;"><b> cluster_broadcast_req("$var(cl_id)", "$var(msg_str)", "$avp(tag)");</b></span><br />
<br />
Since we are sharing Data so we need to carefully fill the details as to which cluster this info needs to be routed to and what message to be delivered. The Tag is filled in automatically and is very important for retrieval of any replies.<br />
<br />
<h4 style="text-align: center;">
<u>Remote Proxy Data Retrieval</u></h4>
Once this is executed all Online nodes of the cluster will receive this message in an Event Route "E_CLUSTERER_REQ_RECEIVED"<br />
<br />
<script src="https://gist.github.com/goharahmed/02884e95175aa1d52940300ec790c221.js"></script><br />
<br />
<h4 style="text-align: center;">
<u>Remote Proxy Replying Back</u></h4>
The AVP $avp(rcv_msg) will contain the sent string and we can script what to do further with that. Similarly the $avp(source_id) variable will contain the NodeID of the sender proxy so if we need to reply back we can send a reply using the same TAG. <span style="white-space: pre-wrap;">It is NOT mandatory for the cluster nodes to reply to each and every broadcasted message btw. They can remain silent if there is nothing to be replied with.</span><br />
<br />
<script src="https://gist.github.com/goharahmed/27426fb17f023e60074b705c79ecf49a.js"></script><br />
<br />
<h4 style="text-align: center;">
<u>Receiving Reply</u></h4>
<div>
Once remote proxy replies with the same tag (<i>OpenSIPS internaly differentiates between a Request and a Reply</i>) an event is raised "<span style="white-space: pre-wrap;">E_CLUSTERER_RPL_RECEIVED" - </span></div>
<div>
<br /></div>
<div>
In this Event Route we don't need to do much, this is just collection of replied data. The real work is done elsewhere.</div>
<div>
<br /></div>
<script src="https://gist.github.com/goharahmed/409f7cec32810ff42207922f84286af2.js"></script><br />
<div>
<br /></div>
<div>
<h4 style="text-align: center;">
<u> Finding Location of a User in Cluster</u></h4>
</div>
<div>
This is approximately how the code will look like for a call where user was not found registered and query was dispatched to whole cluster. The Querying OpenSIPS waits for an event to occur in async mode (wait w/o blocking resources for as long as needed)</div>
<div>
<br /></div>
<script src="https://gist.github.com/goharahmed/5ea399750b30f2457f01daac6c877e82.js"></script><br />
<div>
That is pretty much all that is required to create a Talking-Cluster of OpenSIPS servers. <br />
<br />
<b>WARNING</b>: This is a work in progress from OpenSIPS developers and should be tested heavily before deploying in production. Version 2.4 is expected to be released as stable production release by May-2018 or around. </div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-89936611585893946632016-06-25T13:10:00.002-07:002016-06-25T13:11:55.473-07:00OpenSIPS mi_xmlrpc_ng Interfacing<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
<span style="color: white;">
OpenSIPS 2.2: Creating WebAPI </span></h2>
<div>
OpenSIPS has multiple modules to interact with it in realtime. Sometimes we need to pull information out of the proxy and sometimes we need to insert, or check status of other modules. </div>
<div>
<br />
Here is a list of module which can be used to achieve the objective:<br />
<br />
<table border="0" style="background-color: white; color: #666666; font-family: "Trebuchet MS", sans-serif, Verdana, Arial; font-size: 13.008px; line-height: 21.5933px;"><tbody>
<tr><td align="left"><a class="urllink" href="http://www.opensips.org/html/docs/modules/2.2.x/mi_datagram.html" rel="nofollow" style="color: #185662; font-weight: bold; text-decoration: none; width: 100px;"><strong>MI_DATAGRAM</strong></a></td><td align="left">DATAGRAM (unix and network) support for Management Interface</td><td align="center"><span style="color: green;">stable</span></td></tr>
<tr><td align="left"><a class="urllink" href="http://www.opensips.org/html/docs/modules/2.2.x/mi_fifo.html" rel="nofollow" style="color: #185662; font-weight: bold; text-decoration: none; width: 100px;"><strong>MI_FIFO</strong></a></td><td align="left">FIFO support for Management Interface</td><td align="center"><span style="color: green;">stable</span></td></tr>
<tr><td align="left"><a class="urllink" href="http://www.opensips.org/html/docs/modules/2.2.x/mi_http.html" rel="nofollow" style="color: #185662; font-weight: bold; text-decoration: none; width: 100px;"><strong>MI_HTTP</strong></a></td><td align="left">HTTP support for Management Interface</td><td align="center"><span style="color: green;">stable</span></td></tr>
<tr><td align="left"><a class="urllink" href="http://www.opensips.org/html/docs/modules/2.2.x/mi_json.html" rel="nofollow" style="color: #185662; font-weight: bold; text-decoration: none; width: 100px;"><strong>MI_JSON</strong></a></td><td align="left">JSON support via HTTP GET for Management Interface</td><td align="center"><span style="color: #80ff00;">beta</span></td></tr>
<tr><td align="left"><a class="urllink" href="http://www.opensips.org/html/docs/modules/2.2.x/mi_xmlrpc_ng.html" rel="nofollow" style="color: #185662; font-weight: bold; text-decoration: none; width: 100px;"><strong>MI_XMLRPC_NG</strong></a></td><td align="left">XMLRPC support for Management Interface</td><td align="center"><span style="color: #80ff00;">beta</span></td></tr>
</tbody></table>
<br /></div>
<div>
In my last blog on this topic I showed how to use module MI_XMLRPC to monitor the status of OpenSIPS: <a href="http://saevolgo.blogspot.ca/2012/09/opensips-monitoring-using-mixmlrpc-part.html" target="_blank">Read it here</a>. That mi_xmlrpc module is now obsolete and a newer module <a href="http://www.opensips.org/html/docs/modules/2.2.x/mi_xmlrpc_ng.html" target="_blank">mi_xmlrpc_ng</a> has taken its place. </div>
<div>
<br /></div>
<div>
Today we will use the new module with OpenSIPS and see how we can query our server from the internet to do something. </div>
<div>
<br /></div>
<div>
First we need to know what we require to get started.</div>
<div>
<br /></div>
<div>
1 - HTTPD module, and MI_XMLRPC_NG module installed with OpenSIPS 2.2</div>
<div>
2 - Apache2/ httpd running on the Server.</div>
<div>
<br /></div>
<div>
OpenSIPS' HTTPD module is a requirement since this module provides the web related backend to its other modules.</div>
<div>
<br /></div>
<div>
Lets load up this module into our <span style="font-family: "courier new" , "courier" , monospace;">opensips.cfg</span></div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">loadmodule</span> <span style="color: #0086d2;">"httpd.so"</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"httpd"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"ip"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"127.0.0.1"</span><span style="color: white;">)</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"httpd"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"port"</span><span style="color: white;">,</span> <span style="color: #0086f7; font-weight: bold;">8887</span><span style="color: white;">)</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"httpd"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"buf_size"</span><span style="color: white;">,</span> <span style="color: #0086f7; font-weight: bold;">524288</span><span style="color: white;">)</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"httpd"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"post_buf_size"</span><span style="color: white;">,</span> <span style="color: #0086f7; font-weight: bold;">4096</span><span style="color: white;">)</span></pre>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">
</span></pre>
Next we need to load mi_xmlrpc_ng module.</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">loadmodule</span> <span style="color: #0086d2;">"mi_xmlrpc_ng.so"</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"mi_xmlrpc_ng"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"http_root"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"mybox"</span><span style="color: white;">)</span></pre>
<br />
<br />
The root directory 'mybox' can be anything and it does not represent any folder in the operating system. That infact tells us that when we start up our OpenSIPS the port for http will be 8887, and the web root directory allocated for mi_xmlrpc_ng module would be 'mybox' .</div>
<div>
<h3 style="text-align: center;">
<span style="color: white;">Web API script</span></h3>
</div>
<div>
<div style="text-align: center;">
Next we need to create the script that will be responsible to collect Requests from internet and then pass them to OpenSIPS, return data if any. </div>
</div>
<div>
<br /></div>
<div>
This script can be written in any language, Pythin, PHP, Perl, GoLang, Ruby, whatever your language of choice for creating a web-api is use is. I'd kept it simple and use PHP.</div>
<div>
<br /></div>
<div>
<u><b>Complete script link:</b></u> <a href="https://github.com/goharahmed/scripts/blob/master/webapi.php">https://github.com/goharahmed/scripts/blob/master/webapi.php</a><br />
<br />
Copy the script into your Apache2 webroot directory , say file 'webapi.php'</div>
<div>
<br />
<pre style="color: #333333; line-height: 16.25px;"><span style="background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;"><?php</span>
<span style="color: #fb660a;">$opensip_ip</span> <span style="color: white;">=</span> <span style="color: #0086d2;">'127.0.0.1'</span><span style="color: white;">;</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">//Should use the same HTTPD PORT as declared in opensips.cfg</span>
<span style="color: #fb660a;">$opensip_xmlrpc_port</span> <span style="color: white;">=</span> <span style="color: #0086d2;">'8887'</span><span style="color: white;">;</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">//Should use the same webroot as declared in mi_xmlrpc_ng module parameters</span>
<span style="color: #fb660a;">$xmlrpc_root</span> <span style="color: white;">=</span> <span style="color: #0086d2;">'mybox'</span><span style="color: white;">;</span>
<span style="color: #fb660a;">$count</span> <span style="color: white;">=</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">;</span>
<span style="color: #fb660a;">$method</span><span style="color: white;">;</span>
<span style="color: #fb660a;">$param</span><span style="color: white;">;</span>
<span style="color: #fb660a;">$web_req</span> <span style="color: white;">=</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">;</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(isset(</span><span style="color: #fb660a;">$_GET</span><span style="color: white;">)</span> <span style="color: white;">&&</span> <span style="color: white;">isset(</span><span style="color: #fb660a;">$_GET</span><span style="color: white;">[</span><span style="color: #0086d2;">'method'</span><span style="color: white;">])){</span>
<span style="color: #fb660a; font-weight: bold;">foreach</span><span style="color: white;">(</span><span style="color: #fb660a;">$_GET</span> <span style="color: #fb660a; font-weight: bold;">as</span> <span style="color: #fb660a;">$key</span> <span style="color: white;">=></span> <span style="color: #fb660a;">$value</span><span style="color: white;">)</span>
<span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(</span><span style="color: #fb660a;">$key</span> <span style="color: white;">==</span> <span style="color: #0086d2;">'method'</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a;">$method</span> <span style="color: white;">=</span> <span style="color: #fb660a;">$value</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(preg_match(</span><span style="color: #0086d2;">"/^param\d$/"</span><span style="color: white;">,</span><span style="color: #fb660a;">$key</span><span style="color: white;">))</span> <span style="color: white;">{</span>
<span style="color: #fb660a;">$param</span><span style="color: white;">[]</span> <span style="color: white;">=</span> <span style="color: #fb660a;">$value</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="color: #fb660a;">$web_req</span> <span style="color: white;">=</span> <span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">;</span>
<span style="color: white;">}</span> <span style="color: #fb660a; font-weight: bold;">else</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">foreach</span> <span style="color: white;">(</span><span style="color: #fb660a;">$argv</span> <span style="color: #fb660a; font-weight: bold;">as</span> <span style="color: #fb660a;">$arg</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(</span><span style="color: #fb660a;">$count</span><span style="color: white;">==</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">)</span>
<span style="color: #fb660a;">$method</span> <span style="color: white;">=</span> <span style="color: #fb660a;">$arg</span><span style="color: white;">;</span>
<span style="color: #fb660a; font-weight: bold;">else</span> <span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(</span><span style="color: #fb660a;">$count</span><span style="color: white;">></span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a;">$param</span><span style="color: white;">[]</span> <span style="color: white;">=</span> <span style="color: #fb660a;">$arg</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: #fb660a;">$count</span><span style="color: white;">++;</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="color: #fb660a;">$request</span> <span style="color: white;">=</span> <span style="color: white;">xmlrpc_encode_request(</span><span style="color: #fb660a;">$method</span><span style="color: white;">,</span><span style="color: #fb660a;">$param</span><span style="color: white;">);</span>
<span style="color: #fb660a;">$context</span> <span style="color: white;">=</span> <span style="color: white;">stream_context_create(</span><span style="color: #fb660a; font-weight: bold;">array</span><span style="color: white;">(</span><span style="color: #0086d2;">'http'</span> <span style="color: white;">=></span> <span style="color: #fb660a; font-weight: bold;">array</span><span style="color: white;">(</span>
<span style="color: #0086d2;">'method'</span> <span style="color: white;">=></span> <span style="color: #0086d2;">"POST"</span><span style="color: white;">,</span>
<span style="color: #0086d2;">'header'</span> <span style="color: white;">=></span> <span style="color: #0086d2;">"Content-Type: text/xml"</span><span style="color: white;">,</span>
<span style="color: #0086d2;">'content'</span> <span style="color: white;">=></span> <span style="color: #fb660a;">$request</span>
<span style="color: white;">)));</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">// Dispatchs Request to Local OpenSIPS instance</span>
<span style="color: #fb660a;">$server</span> <span style="color: white;">=</span> <span style="color: #0086d2;">'http://'</span><span style="color: white;">.</span><span style="color: #fb660a;">$opensip_ip</span><span style="color: white;">.</span><span style="color: #0086d2;">':'</span><span style="color: white;">.</span><span style="color: #fb660a;">$opensip_xmlrpc_port</span><span style="color: white;">.</span><span style="color: #0086d2;">'/'</span><span style="color: white;">.</span><span style="color: #fb660a;">$xmlrpc_root</span><span style="color: white;">;</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">//Collect Result from opensips module</span>
<span style="color: #fb660a;">$file</span> <span style="color: white;">=</span> <span style="color: white;">file_get_contents(</span><span style="color: #fb660a;">$server</span><span style="color: white;">,</span> <span style="color: #fb660a; font-weight: bold;">false</span><span style="color: white;">,</span> <span style="color: #fb660a;">$context</span><span style="color: white;">);</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">//Decode the XML into Array</span>
<span style="color: #fb660a;">$response</span> <span style="color: white;">=</span> <span style="color: white;">xmlrpc_decode(</span><span style="color: #fb660a;">$file</span><span style="color: white;">);</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(is_array(</span><span style="color: #fb660a;">$response</span><span style="color: white;">))</span> <span style="color: white;">{</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">/* We can filter and sort Output here to do whatever you want to do */</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;">/* if($method == 'ul_show_contact') {</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"> Then filter only the required fields to be sent back</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"> } else if ($method == 'ds_list') {</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"> Then filter the output to show only the active servers</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"> }</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"> */</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(</span><span style="color: #fb660a;">$web_req</span> <span style="color: white;">==</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: white;">RecursiveWrite(</span><span style="color: #fb660a;">$response</span><span style="color: white;">);</span>
<span style="color: white;">}</span><span style="color: #fb660a; font-weight: bold;">else</span> <span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(</span><span style="color: #fb660a;">$web_req</span> <span style="color: white;">==</span> <span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: white;">print_r(json_encode(</span><span style="color: #fb660a;">$response</span><span style="color: white;">));</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">function</span> <span style="color: #ff0086; font-weight: bold;">RecursiveWrite</span><span style="color: white;">(</span><span style="color: #fb660a;">$array</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">foreach</span> <span style="color: white;">(</span><span style="color: #fb660a;">$array</span> <span style="color: #fb660a; font-weight: bold;">as</span> <span style="color: #fb660a;">$key</span> <span style="color: white;">=></span> <span style="color: #fb660a;">$vals</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(is_array(</span><span style="color: #fb660a;">$vals</span><span style="color: white;">)){</span>
<span style="color: white;">RecursiveWrite(</span><span style="color: #fb660a;">$vals</span><span style="color: white;">);</span>
<span style="color: white;">}</span> <span style="color: #fb660a; font-weight: bold;">else</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">print</span> <span style="color: #0086d2;">"$key $vals\n"</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;">?></span></pre>
</div>
<div>
</div>
<div>
Now, make sure your opensips is restarted to include the new module, make sure your server is able to listen to the web requests. Time to send requests to our OpenSIPS.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Open your browser and paste the following URL to find if a particular suer is Online or Not.<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br />http://<span style="background-color: #ffe599; color: black;">YourServerIPHere</span>/webapi.php?method=ul_show_contact&param1=location&param2=gohar@saevolgo.ca</span><br />
<br />
<h4 style="text-align: center;">
<span style="color: white;">
Little Explanation:</span></h4>
<span style="font-family: "courier new" , "courier" , monospace;">method</span> = MI command to query the user location status<br />
<span style="font-family: "courier new" , "courier" , monospace;">param1</span> = The database table where the User Registrations are stored.<br />
<span style="font-family: "courier new" , "courier" , monospace;">param2</span> = The AoR to find if Online<br />
<br />
You can add as many param as you want , param3, param4...paramN depending if the MI command needs or not.<br />
<br />
If a command requires no parameter then don't add any for example:<br />
<span style="font-family: "courier new" , "courier" , monospace;">http://<span style="background-color: #ffe599; color: black;">YourServerIPHere</span>/webapi.php?method=lb_list</span></div>
<div>
<br /></div>
<div>
To get Statistics:</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">http://<span style="background-color: #ffe599; color: black;">YourServerIPHere</span>/webapi.php?method=get_statistics&param1=tm:</span></div>
<h4 style="text-align: left;">
</h4>
<h3 style="text-align: left;">
<span style="color: white;">OpenSIPS Modules: How to read what command has how many parameters ?</span></h3>
<div>
Take example of <a href="http://www.opensips.org/html/docs/modules/2.2.x/load_balancer.html" target="_blank">Load-Balancer module:</a></div>
<div>
The function lb_relaod has no parameters:</div>
<div>
<pre class="programlisting" style="background-color: #fefeee; border: 1px solid rgb(153 , 204 , 204); color: black; padding-left: 15pt;"> :lb_reload:_reply_fifo_file_
_empty_line_</pre>
</div>
<div>
So my URL would be:</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">http://</span><span style="background-color: #ffe599; color: black; font-family: "courier new" , "courier" , monospace;">YourServerIPHere</span><span style="font-family: "courier new" , "courier" , monospace;">/webapi.php?method=lb_reload</span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
But the function <a href="http://www.opensips.org/html/docs/modules/2.2.x/load_balancer.html#id294138" target="_blank">lb_resize</a> takes 3 parameteres:</div>
<div>
<pre class="programlisting" style="background-color: #fefeee; border: 1px solid rgb(153 , 204 , 204); color: black; padding-left: 15pt;">:lb_resize:_reply_fifo_file_
11 /*dstination id*/
voicemail /*resource name*/
56 /* new resource capacity*/
_empty_line_</pre>
</div>
<div>
For above the URL would be:</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">http://</span><span style="background-color: #ffe599; color: black; font-family: "courier new" , "courier" , monospace;">YourServerIPHere</span><span style="font-family: "courier new" , "courier" , monospace;">/webapi.php?method=lb_resize&param1=11&param2=voicemail&param3=56</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
Thats pretty much all, thanks for reading. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-54546926969930144462016-03-28T15:51:00.000-07:002016-03-28T15:52:27.326-07:00FreeSWITCH mod_xml_curl With mod_callcenter<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
FreeSWITCH Loading Queues from Database</h2>
<div>
This has been a long due post waiting in my drafts for above two years now. This was done right after when I finished loading SIP users from Database in this <a href="http://saevolgo.blogspot.ca/2012/07/freeswitch-with-sip-users-in-mysql-mod.html" target="_blank">blog post</a>.</div>
<div>
<br /></div>
<div>
I always found myself at trouble when FreeSWITCH's <a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_curl" target="_blank">MOD_XML_CURL</a> was named together with loading configurations but as soon as I gave it a shot it became very easy and interesting. </div>
<div>
<br /></div>
<div>
Here is how to get started with loading queue from Database in just few minutes. </div>
<div>
<br /></div>
<div>
Here is what we need to get started:</div>
<div>
<br /></div>
<div>
1 - Database table containing Queue's parameters.</div>
<div>
2 - A WebServer containing our DB-to-XML converter code</div>
<div>
3 - FreeSWITCH with mod_xml_curl installed and configured.</div>
<div>
<h3 style="text-align: left;">
<br /><span style="color: #ffe599;">Creating Table for Queue Parameters </span></h3>
So, first things first lets create a simple Database table:</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">root@DBSERVER:</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># su - postgres</span>
<span style="color: white;">postgres@DBSERVER:~$</span> <span style="color: white;">psql</span>
<span style="color: white;">psql</span> <span style="color: white;">(9.4.6)</span>
<span style="color: white;">Type</span> <span style="color: white;">"help"</span> <span style="color: white;">for</span> <span style="color: white;">help.</span>
<span style="color: white;">postgres=</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># \c freeswitch_configs</span>
<span style="color: white;">You</span> <span style="color: white;">are</span> <span style="color: white;">now</span> <span style="color: white;">connected</span> <span style="color: white;">to</span> <span style="color: white;">database</span> <span style="color: white;">"freeswitch_configs"</span> <span style="color: white;">as</span> <span style="color: white;">user</span> <span style="color: white;">"postgres".</span>
<span style="color: white;">freeswitch_configs=</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;">#</span></pre>
</div>
<div>
<br /></div>
<div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><pre><span style="color: #007700;">CREATE</span> <span style="color: #007700;">TABLE</span> <span style="color: #007700;">queues</span> (
<span style="color: #007700;">queue_id</span> <span style="color: #007700;">serial</span> <span style="color: #007700;">primary</span> <span style="color: #007700;">key</span>,
<span style="color: #007700;">name</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">not</span> <span style="color: #007700;">null</span>,
<span style="color: #007700;">strategy</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">100</span>) <span style="color: #007700;">default</span> <span style="background-color: #fff0f0;">'longest-idle-agent'</span>,
<span style="color: #007700;">moh_sound</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">default</span> <span style="background-color: #fff0f0;">'local_stream://moh'</span>,
<span style="color: #007700;">announce_sound</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">default</span> <span style="color: #007700;">NULL</span>,
<span style="color: #007700;">announce_frequency</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">5</span>) <span style="color: #007700;">default</span> <span style="color: #007700;">NULL</span>,
<span style="color: #007700;">time_base_score</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'queue'</span> ,
<span style="color: #007700;">tier_rules_apply</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">25</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'false'</span>,
<span style="color: #007700;">tier_rule_wait_second</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">4</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'300'</span>,
<span style="color: #007700;">tier_rule_wait_multiply_level</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">5</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'true'</span>,
<span style="color: #007700;">tier_rule_no_agent_no_wait</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'false'</span>,
<span style="color: #007700;">discard_abandoned_after</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">5</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'60'</span>,
<span style="color: #007700;">abandoned_resume_allowed</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">5</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'false'</span>,
<span style="color: #007700;">max_wait_time</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">25</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'0'</span>,
<span style="color: #007700;">max_wait_time_with_no_agent</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">10</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'0'</span>,
<span style="color: #007700;">max_wait_time_with_no_agent_time_reached</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">10</span>) <span style="color: #007700;">DEFAULT</span> <span style="background-color: #fff0f0;">'0'</span>,
<span style="color: #007700;">record_template</span> <span style="color: #007700;">VARCHAR</span>(<span style="color: #007700;">255</span>) <span style="color: #007700;">DEFAULT</span> <span style="color: #007700;">NULL</span>
);</pre>
</pre>
<br />
<br />
Once Table is created you can go ahead and create some queues in it via INSERT statements.</div>
<div>
<h3 style="text-align: left;">
<br /><span style="color: #ffe599;">Setting up WebServer</span></h3>
<br />
Alright, we've some queues defined into our database table. Now, is the time to create a web service which will query the Database and pull required configurations. Once configurations are found for a queue we will put them nicely into the required XML format and reply back.</div>
</div>
<div>
<br /></div>
<div>
Take the PHP sample code from my github repo:</div>
<div>
<a href="https://github.com/goharahmed/saevolgo/blob/master/getconfig.php">https://github.com/goharahmed/saevolgo/blob/master/getconfig.php</a><br />
<br />
Configure the Database IP, Port, User, and Password as required and make sure there is no error in it.</div>
<div>
Once this is ready and running we can query to this web service and see that it returns an Error XML if no queue name is passed to it.</div>
<div>
<br /></div>
<div>
<b><u><span style="color: #ffe599;">Test it:</span></u></b><br />
http://ip.of.webserver:port/freeswitch/getconfig.php?CC-Queue=MyQueueName<br />
<br />
If everything is configured properly and Queue: <i>MyQueueName </i>exists then it should print a fine XML - if that doesn't happen then check your PHP code, PHP PDO extension for PGSQL and verify that port is accessible and webserver is running. </div>
<div>
<h3 style="text-align: left;">
<br /><span style="color: #ffe599;">Configuring MOD_XML_CURL</span></h3>
<br />
Assuming mod_xml_curl is installed on your FreeSwitch server now its time to configure its module xml_curl to pull configurations from webserver instead of local file.</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">root@FREESWITCH1:</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># cd /usr/local/freeswitch/conf</span>
<span style="color: white;">root@FREESWITCH1:conf</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># cd autoload_configs/</span>
<span style="color: white;">root@FREESWITCH1:autoload_configs</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># vim xml_curl.conf.xml
</span></pre>
</div>
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #fb660a; font-weight: bold;"><configuration</span> <span style="color: #ff0086; font-weight: bold;">name=</span><span style="color: #0086d2;">"xml_curl.conf"</span> <span style="color: #ff0086; font-weight: bold;">description=</span><span style="color: #0086d2;">"cURL XML Gateway"</span><span style="color: #fb660a; font-weight: bold;">></span>
<span style="color: #fb660a; font-weight: bold;"><bindings></span>
<span style="color: #fb660a; font-weight: bold;"><binding</span> <span style="color: #ff0086; font-weight: bold;">name=</span><span style="color: #0086d2;">"configuration"</span><span style="color: #fb660a; font-weight: bold;">></span>
<span style="color: #fb660a; font-weight: bold;"><param</span> <span style="color: #ff0086; font-weight: bold;">name=</span><span style="color: #0086d2;">"gateway-url"</span> <span style="color: #ff0086; font-weight: bold;">value=</span><span style="color: #0086d2;">"http://WEBSERVER/freeswitch/getconfig.php"</span> <span style="color: #ff0086; font-weight: bold;">bindings=</span><span style="color: #0086d2;">"configuration"</span><span style="color: #fb660a; font-weight: bold;">/></span>
<span style="color: #fb660a; font-weight: bold;"></binding></span>
<span style="color: #fb660a; font-weight: bold;"></bindings></span>
<span style="color: #fb660a; font-weight: bold;"></configuration></span></pre>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: #fb660a; font-weight: bold;">
</span></pre>
Ensure that there are no other configuration binding to conflict here.<br />
<br />
Save and exit. Go inside freeswitch console and reload mod_xml_curl<br />
<br />
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">root@FREESWITCH1:</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># fs_cli</span>
<span style="color: white;">fs_cli>reload</span> <span style="color: white;">mod_xml_curl</span>
<span style="color: white;">+OK</span> <span style="color: white;">Reloading</span> <span style="color: white;">XML</span>
<span style="color: white;">+OK</span> <span style="color: white;">module</span> <span style="color: white;">unloaded</span>
<span style="color: white;">+OK</span> <span style="color: white;">module</span> <span style="color: white;">loaded</span></pre>
</div>
<div>
<br />
All set, now we are ready to load Queues from Database directly. To test things out issue this command<br />
<br />
<div>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">freeswitch@internal></span> <span style="color: white;">callcenter_config</span> <span style="color: white;">queue</span> <span style="color: white;">load</span> <span style="color: white;">MynewQueue</span>
<span style="color: white;">+OK</span>
<span style="color: white;">freeswitch@internal></span> <span style="color: white;">callcenter_config</span> <span style="color: white;">queue</span> <span style="color: white;">list</span>
<span style="color: white;">name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template</span>
<span style="color: white;">support@default|longest-idle-agent|local_stream://moh|system|false|</span><span style="color: #0086f7; font-weight: bold;">300</span><span style="color: white;">|true|false|</span><span style="color: #0086f7; font-weight: bold;">60</span><span style="color: white;">|false|</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">|</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">|</span><span style="color: #0086f7; font-weight: bold;">5</span><span style="color: white;">|</span>
<span style="color: white;">MynewQueue|longest-idle-agent||queue|false|</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">|false|true|</span><span style="color: #0086f7; font-weight: bold;">60</span><span style="color: white;">|false|</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">|</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">|</span><span style="color: #0086f7; font-weight: bold;">5</span><span style="color: white;">|</span>
<span style="color: white;">+OK</span></pre>
</div>
</div>
<div>
<br /></div>
<div>
<span style="color: #ffe599;"><b><u>To debug XML Curl </u></b></span><br />
<br />
<pre><span style="color: white; line-height: 16.25px;">freeswitch@internal></span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">xml_curl</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">debug_on</span><span style="color: #333333;"><span style="line-height: 16.25px;">
</span></span><span style="color: white; line-height: 16.25px;">OK</span><span style="color: #333333;"><span style="line-height: 16.25px;">
</span></span><span style="color: white; line-height: 16.25px;">freeswitch@internal></span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">callcenter_config</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">queue</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">load</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">NOTMYQUEUE</span><span style="color: #333333;"><span style="line-height: 16.25px;">
</span></span><span style="color: white; line-height: 16.25px;">-ERR</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">Invalid</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">Queue</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">not</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">found!</span><span style="color: #333333;"><span style="line-height: 16.25px;">
</span></span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">2016</span><span style="color: white; line-height: 16.25px;">-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">03</span><span style="color: white; line-height: 16.25px;">-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">28</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">19</span><span style="color: white; line-height: 16.25px;">:</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">32</span><span style="color: white; line-height: 16.25px;">:</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">21.128783</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">[CONSOLE]</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">mod_xml_curl.c:</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">323</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">XML</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">response</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">is</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">in</span><span style="color: #333333;"><span style="line-height: 16.25px;"> </span></span><span style="color: white; line-height: 16.25px;">/tmp/</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">3337</span><span style="color: white; line-height: 16.25px;">e053-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">077</span><span style="color: white; line-height: 16.25px;">c-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">4</span><span style="color: white; line-height: 16.25px;">f39-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">9</span><span style="color: white; line-height: 16.25px;">c3f-</span><span style="color: #0086f7; font-weight: bold; line-height: 16.25px;">0805</span><span style="color: white; line-height: 16.25px;">c4896851.tmp.xml</span><span style="color: #333333;"><span style="line-height: 16.25px;">
</span></span><span style="color: white; line-height: 16.25px;">freeswitch@internal
</span></pre>
<pre style="color: #333333; line-height: 16.25px;"><span style="color: white;">root@FREESWITCH1:</span><span style="background-color: #0f140f; color: #00e600; font-style: italic;"># cat /tmp/3337e053-077c-4f39-9c3f-0805c4896851.tmp.xml</span></pre>
<pre style="color: #333333; line-height: 16.25px;"><span style="background-color: #0f140f; color: #ff0007; font-style: italic; font-weight: bold;"><?xml version="1.0" encoding="UTF-8" standalone="no"?></span>
<span style="color: #fb660a; font-weight: bold;"><document</span> <span style="color: #ff0086; font-weight: bold;">type=</span><span style="color: #0086d2;">"freeswitch/xml"</span><span style="color: #fb660a; font-weight: bold;">></span>
<span style="color: #fb660a; font-weight: bold;"><section</span> <span style="color: #ff0086; font-weight: bold;">name=</span><span style="color: #0086d2;">"result"</span><span style="color: #fb660a; font-weight: bold;">><result</span> <span style="color: #ff0086; font-weight: bold;">status=</span><span style="color: #0086d2;">"not found"</span> <span style="color: #fb660a; font-weight: bold;">/>
</document></span></pre>
</div>
<div>
<h3 style="text-align: left;">
<br /><span style="color: #ffe599;">Conclusion</span></h3>
<br />
So, now we see how simple it is to pull configurations from Database - for a practice try this all with Conferences </div>
</div>
Unknownnoreply@blogger.com2Pakistan30.375321 69.34511599999996216.4423115 48.690818999999962 44.3083305 89.999412999999961tag:blogger.com,1999:blog-7979378259821020425.post-60029146029356502242013-08-21T05:22:00.001-07:002013-08-22T03:51:53.017-07:00RTPproxy Revisited [Kamailio 4.0]<div dir="ltr" style="text-align: left;" trbidi="on">
Time and again I see people getting stuck on RTPproxy integration with Kamailio. I recently got another opportunity to put RTPproxy in between the User Phones and Kamailio setup as depicted in the following diagram.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-D4g4NUMWm8U/UhSlR2Wo_QI/AAAAAAAABu4/VzogEWrQi_s/s1600/RTPproxy-Bridging2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="163" src="http://3.bp.blogspot.com/-D4g4NUMWm8U/UhSlR2Wo_QI/AAAAAAAABu4/VzogEWrQi_s/s320/RTPproxy-Bridging2.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
That is similar to what I've posted earlier on this topic. In this post I will try be more verbose and write each and every step I did to have RTPs flowing.<br />
<br />
I assume you've a Kamailio installed and working and configurations file from <a href="http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb">Asipto Knowledge Base</a> by Daniel and that there are TWO NICs configured with Public IP and Private IP as shown in the diagram above.<br />
<br />
The important thing which I'm looking for from the configuration is the WITH_NAT tag. follow the code and see how the NAT is handled. route[NATMANAGE] is called at almost all important routes.<br />
<br />
The overall idea is;<br />
<br />
1- Install RTPproxy<br />
2- Start RTPproxy in Bridged mode<br />
3- Make Kamailio aware of multiple NICs<br />
4- Add Private IP asterisks in dispatcher<br />
5- Create a new route RTPPROXY to engage RTP-proxy whenever needed<br />
6- Call in the RTPPROXY route in the NATMANAGE route.<br />
7- Important Things to take care of.<br />
<br />
So lets start following the steps.<br />
<br />
<h3 style="text-align: left;">
1- Installing RTPproxy</h3>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd /usr/src/</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># wget http://b2bua.org/chrome/site/rtpproxy-1.2.1.tar.gz</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># tar zxvf rtpproxy-1.2.1.tar.gz</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd rtpproxy-1.2.1/</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./configure</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make install</span></pre>
<pre style="color: #333333; line-height: 16px;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
Setup LSB script for RTP-proxy<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cp debian/rtpproxy-default.ex /etc/default/rtpproxy</span></pre>
edit the default file and put in the parameters.<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/default/rtpproxy</span></pre>
<br />
<h3 style="text-align: left;">
2- Start RTPproxy in Bridged mode</h3>
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">DAEMON_OPTS=</span><span style="color: #0086d2;">"-F -s udp:127.0.0.1:7722 -l 77.66.55.44/192.168.1.244 -d DBUG:LOG_LOCAL0 -u root"</span></pre>
<br />
Save and Exit<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cp debian/rtpproxy.init /etc/init.d/rtpproxy</span>
<span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># chmod a+x /etc/init.d/rtpproxy</span></pre>
<pre style="color: #333333; line-height: 16px;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
Open up the file<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/init.d/rtpproxy</span></pre>
<br />
see that the DAEMON field points to the file in /usr/bin/rtpproxy<br />
<br />
DAEMON=/usr/bin/rtpproxy<br />
<br />
Lets copy the RTPproxy binary to that location.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cp rtpproxy /usr/bin/rtpproxy</span></pre>
<br />
Start up RTPproxy<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/rtpproxy start</span></pre>
<div>
<br /></div>
<div>
verify that rtpproxy is running and listening on the specified 7722 </div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># netstat -pln | grep rtpp</span>
<span style="color: white;">udp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">127.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.1</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">7722</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: #0086f7; font-weight: bold;">6554</span><span style="color: white;">/rtpproxy</span></pre>
</div>
Thats all.<br />
<br />
<h3 style="text-align: left;">
3- Making Kamailio aware of multiple NICs</h3>
<br />
Lets move on to step 3 involving Kamailio configurations.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /usr/local/etc/kamailio/kamailio.cfg</span></pre>
<div>
<br /></div>
<div>
Insert the following line in global parameters section, just under where we define "listen=" or "port=" </div>
<div>
<br /></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">mhomed=1</span></div>
<div>
<br /></div>
<div>
That will ensure that Kamailio uses its Private IP to communicate with Asterisks on Private subnet. Don't forget this.</div>
<div>
<br />
We also need to put this line on the top definitions of kamailio.cfg file so kamailio use the NAT functions.<br />
<br />
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">#!define WITH_NAT</span><br />
<h3 style="text-align: left;">
4- Adding Asterisks to dispatcher</h3>
<br /></div>
<div>
Now Add Private IP asterisks in dispatcher: Follow my post on adding dispatcher to the plain configurations from here: <a href="http://saevolgo.blogspot.com/2011/11/how-to-increasing-voip-services.html">http://saevolgo.blogspot.com/2011/11/how-to-increasing-voip-services.html</a></div>
<div>
<br />
<h3>
5- Writing some Kamailio routing logic for RTPPROXY</h3>
</div>
<div>
That was easy, now the real thing the addition of RTPPROXY route which I modified a little bit from the last link mentioned.</div>
<div>
<br /></div>
<div>
To have the code working I have used the <a href="http://www.kamailio.org/docs/modules/4.0.x/modules/sqlops.html">SQLOPS</a> module configured to query kamailio.dispatcher table as the AVPOPS module was already busy.<br />
<br />
<b>NOTE:</b> Using the DB query is a costly operation BUT it allows me to detect if Kamailio is sending call to Dispatcher listed IPs or not. I have a mix of Asterisks on Private Subnet and on Public Subnet and if the Asterisk dispatcher has chosen or the call is coming from is a Private IP then engage RTPproxy. This detection is handled by <a href="http://www.kamailio.org/docs/modules/4.0.x/modules/ipops.html">IPOPS </a>module and its function<a href="http://www.kamailio.org/docs/modules/4.0.x/modules/ipops.html#idp38472"> <b>is_ip_rfc1918()</b></a><br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">loadmodule</span> <span style="color: #0086d2;">"ipops.so"</span></pre>
</div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">loadmodule</span> <span style="color: #0086d2;">"sqlops.so"</span>
<span style="color: white;">modparam(</span><span style="color: #0086d2;">"sqlops"</span><span style="color: white;">,</span><span style="color: #0086d2;">"sqlcon"</span><span style="color: white;">,</span><span style="color: #0086d2;">"ca=>mysql://openser:openserrw@localhost/kamailio"</span><span style="color: white;">)</span></pre>
</div>
<div>
<br />
Then declare the route:</div>
<div>
<br /></div>
<div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="background-color: #0f140f; color: lime; font-style: italic;"># RTPProxy control</span>
<span style="color: white;">route[RTPPROXY]</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(is_method(</span><span style="color: #0086d2;">"INVITE"</span><span style="color: white;">)){</span>
<span style="color: white;">sql_query(</span><span style="color: #0086d2;">"ca"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"select destination from dispatcher where destination like '%$dd%'"</span><span style="color: white;">,</span><span style="color: #0086d2;">"ra"</span><span style="color: white;">);</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($dbr(ra=>rows)></span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">){</span>
<span style="color: white;">$avp(duip)=$(du{s.select,-</span><span style="color: #0086f7; font-weight: bold;">2</span><span style="color: white;">,:});</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(is_ip_rfc1918(</span><span style="color: #0086d2;">"$avp(duip)"</span><span style="color: white;">))</span> <span style="color: white;">{</span>
<span style="color: white;">xlog(</span><span style="color: #0086d2;">"L_INFO"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"Call is going to private IPv4 Media Server Engage RTPProxy Now\n"</span><span style="color: white;">);</span>
<span style="background-color: #0f140f; color: lime; font-style: italic;">#rtpproxy_manage("crwie","192.168.1.244");</span>
<span style="color: white;">rtpproxy_manage(</span><span style="color: #0086d2;">"rwie"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span>
<span style="color: white;">else</span> <span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(ds_is_from_list()){</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(is_ip_rfc1918(</span><span style="color: #0086d2;">"$si"</span><span style="color: white;">))</span> <span style="color: white;">{</span>
<span style="color: white;">xlog(</span><span style="color: #0086d2;">"L_INFO"</span><span style="color: white;">,</span> <span style="color: #0086d2;">" Call is coming from a private IPv4 Media Server Engage RTPProxy Now\n"</span><span style="color: white;">);</span>
<span style="background-color: #0f140f; color: lime; font-style: italic;">#rtpproxy_manage("crwei","77.66.55.44");</span>
<span style="color: white;">rtpproxy_manage(</span><span style="color: #0086d2;">"rwei"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span><span style="color: white;">else</span> <span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">(!ds_is_from_list()){</span><pre> <span style="color: white;">rtpproxy_manage(</span><span style="color: #0086d2;">"rwie"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: white;">}</span></pre>
<span style="color: white;">}</span></pre>
<pre style="color: #333333; line-height: 16px;"></pre>
</div>
</div>
<div>
<h3 style="text-align: left;">
6- Using RTPPROXY route</h3>
Add the RTPPROXY route just where the FLT_NATS and FLB_NATB flags are tested.<br />
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"> <span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(!(isflagset(</span><span style="color: #0086d2;">FLT_NATS</span><span style="color: white;">)</span> <span style="color: white;">||</span> <span style="color: white;">isbflagset(</span><span style="color: #0086d2;">FLB_NATB</span><span style="color: white;">))){</span>
<span style="color: #fb660a; font-weight: bold;">return</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
</pre>
<span style="color: #333333; line-height: 16px;"></span><span style="color: #333333; line-height: 16px;"></span><span style="color: white; line-height: 16px;"> route(</span><span style="color: #0086d2; line-height: 16px;">RTPPROXY</span><span style="color: white; line-height: 16px;">);</span><br />
<span style="color: white; line-height: 16px;"><br /></span></div>
<div>
<pre style="color: #333333; line-height: 16px;"></pre>
</div>
<div>
Now Save and Exit the kamailio.cfg file.<br />
<br /></div>
<div>
Restart Kamailio.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/kamailio stop</span></pre>
<div style="-webkit-text-stroke-width: 0px; color: black; font-family: 'Times New Roman'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px;">
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/kamailio start</span></pre>
</div>
</div>
<div>
<h3 style="text-align: left;">
7- Helpful Things to know</h3>
</div>
<div>
Asterisk needs to have the peer declared for kamailio using its Private IP.</div>
<div>
<br /></div>
<div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">[Kamailio]</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">type=friend</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">host=192.168.1.244</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">port=5060</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">disallow=all</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">allow=gsm</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">allow=g729</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">allow=alaw</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">allow=ulaw</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">context=SBC-Incoming</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">canreinvite=no</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">insecure=port,invite</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">nat=force_rport,comedia</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">qualify=yes</span></div>
<div>
<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">directrtpsetup=no</span></div>
</div>
<div>
<br /></div>
<div>
See that I've used "<span style="color: #ffd966; font-family: Courier New, Courier, monospace;">directrtpsetup=no</span>" so that Asterisk don't decide to go direct with the End caller.</div>
<div>
<br /></div>
<div>
Use xlog lines in kamailio.cfg file to follow the call.</div>
<div>
<br /></div>
<div>
The way I always setup my whole environment is that Kamailio handles the REGISTRATIONs and only INVITES are load-balanced to Asterisks or FreeSWITCHes where they receive the call from Kamailio peer and execute dialplan applications and IF call needs to dial out they dial the destination back to kamailio.</div>
<div>
Kamailio needs to detect the call coming FROM the Media-Servers (<a href="http://www.kamailio.org/docs/modules/4.0.x/modules/dispatcher.html#idp16966864">ds_is_from_list()</a> function)</div>
<div>
<br /></div>
<div>
So I know when a user calls in and when the call comes in from the media-servers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-U7jSXWD0Wf4/UhSlT16bimI/AAAAAAAABvE/F6DhXjF6BBY/s1600/RTPproxy-Bridging.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="145" src="http://3.bp.blogspot.com/-U7jSXWD0Wf4/UhSlT16bimI/AAAAAAAABvE/F6DhXjF6BBY/s320/RTPproxy-Bridging.jpg" width="320" /></a></div>
Always try to first have an echo test working for calls. I use Asterisk application Echo() and when I dial in from user I get my own audio echoed back and I know that atleast my audio path is complete. This never tells you that your setup is 100% perfect but it is a good way to know if you're headed right direction.<br />
<br />
<br />
Wireshark is a great Friend. Use it to examine everything in depth. No matter what I do I always need Wireshark to visually see what is going on with the SIP packets, that gives me everything I need to know to make things right.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@Kamailio200:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># tcpdump -i any -s 0 -w rtp-calls.pcap -vvv</span>
<span style="color: white;">tcpdump:</span> <span style="color: white;">listening</span> <span style="color: white;">on</span> <span style="color: white;">any,</span> <span style="color: white;">link-type</span> <span style="color: white;">LINUX_SLL</span> <span style="color: white;">(Linux</span> <span style="color: white;">cooked),</span> <span style="color: white;">capture</span> <span style="color: white;">size</span> <span style="color: #0086f7; font-weight: bold;">65535</span> <span style="color: white;">bytes</span>
<span style="color: white;">1666</span> <span style="color: white;">packets</span> <span style="color: white;">captured</span></pre>
Download this "rtp-calls.pcap" file and open it up in Wireshark. Click "Telephon<u>y</u>" from the menu bar and select "<u>V</u>oIP Calls"</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-GXxe3430VdE/UhSr0fZnEnI/AAAAAAAABvQ/CmXiE6zpGd4/s1600/Wireshark-voip-calls.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="122" src="http://1.bp.blogspot.com/-GXxe3430VdE/UhSr0fZnEnI/AAAAAAAABvQ/CmXiE6zpGd4/s320/Wireshark-voip-calls.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
Hit the <b>Flow</b> button and you'll see beautiful arrows showing the direction of SIP and RTP packets.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-KTNEWLmlhE4/UhSsGR2CvCI/AAAAAAAABvY/zH26TuY324E/s1600/Wireshark-call-flow.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="170" src="http://3.bp.blogspot.com/-KTNEWLmlhE4/UhSsGR2CvCI/AAAAAAAABvY/zH26TuY324E/s320/Wireshark-call-flow.jpg" width="320" /></a></div>
<div>
<br /></div>
<div>
On the very Left Hand side is my Soft Phone's Public IP address, then 77.66.55.44 is kamailio's WAN side, and suddenly we see 192.168.1.244 which is Private IP of Kamailio communicating with an Asterisk on 192.168.1.36</div>
<div>
The Bold arrows labeled RTP are flowing in both direction means all Perfect.</div>
<div>
<br />
Thats all for one day. Hope to have some comments and questions on this soon.</div>
</div>
Unknownnoreply@blogger.com29tag:blogger.com,1999:blog-7979378259821020425.post-66081254471245548922013-07-28T02:34:00.001-07:002013-07-28T02:34:44.054-07:00Linux IPSec VPN-2: Amazon Cloud Sever & Linksys Router<div dir="ltr" style="text-align: left;" trbidi="on">
This is a post in response to a comment made earlier on my previous blog post on <a href="http://saevolgo.blogspot.com/2012/02/linux-ipsec-vpn-setup-centos-once-i-was.html">Linux IPSec Setup</a> asking for assistance. So here's what I could possibly do to help the needy.<br />
<br />
This is a setup which I assisted one of my friend in creating a VPN between a Static IP Linksys Router and an Amazon cloud based server. Since we all know that Amazon cloud servers don't actually have a static public IP assigned to them instead they've a One-to-One NAT mechanism at the best so this becomes a bit trickier for anyone new to the OpenSWAN or IPSec in Linuxes.<br />
<br />
Regardless of the Operating System the openswan package needs to be installed on the server properly. Please refer to other blogs or Google in order to install ipsec service. See this references in this <a href="http://saevolgo.blogspot.com/2012/02/linux-ipsec-vpn-setup-centos-once-i-was.html">link:</a><br />
<br />
The topology we'll be working on is defined in the diagram below.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-UfHEduT3j18/UfTkJV571BI/AAAAAAAABuI/46T3BmVhJ-Q/s1600/Ipsec-Amazon.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="http://1.bp.blogspot.com/-UfHEduT3j18/UfTkJV571BI/AAAAAAAABuI/46T3BmVhJ-Q/s320/Ipsec-Amazon.jpg" width="320" /></a></div>
<br />
Now get to the configurations.<br />
<br />
The <span style="color: #ffd966; font-family: Courier New, Courier, monospace;">ipsec.conf</span> file contains these:<br />
<br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">config setup</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> interfaces=%defaultroute</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> klipsdebug=all</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> plutodebug=all</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> protostack=netkey</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> nat_traversal=yes</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">conn Linksys</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> type=tunnel</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> left=10.2.147.164</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> leftnexthop=%defaultroute</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> leftsubnet=10.2.147.164/26</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> right=120.121.122.123</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> rightnexthop=%defaultroute</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> rightsubnet=192.168.4.0/24</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> auth=esp</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> keyexchange=ike</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> authby=secret</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> pfs=yes</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> auto=start</span><br />
<div>
<br /></div>
<div>
And <span style="color: #ffd966; font-family: Courier New, Courier, monospace;">ipsec.secrets</span> contains this:</div>
<div>
<br /></div>
<div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">10.2.147.164 120.121.122.123 : PSK "y0ur_S3cret_PSK_k3y"</span></div>
</div>
<div>
<br /></div>
<div>
Lets quickly get to the Linksys router and adjust the router according to the following settings.</div>
<div>
<br /></div>
<div>
Move to the VPN tab after logging in to the Linksys router.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-VxyjDWd1b0I/UfTjlZfF1PI/AAAAAAAABt0/lukEF1PhyFo/s1600/Linksys_VPN0.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="142" src="http://4.bp.blogspot.com/-VxyjDWd1b0I/UfTjlZfF1PI/AAAAAAAABt0/lukEF1PhyFo/s320/Linksys_VPN0.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-HRMBhRMKwRs/UfTjlI8SZKI/AAAAAAAABtw/VFC54_-4Slk/s1600/Linksys_VPN1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="134" src="http://3.bp.blogspot.com/-HRMBhRMKwRs/UfTjlI8SZKI/AAAAAAAABtw/VFC54_-4Slk/s320/Linksys_VPN1.jpg" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-OnIdFRpPw0k/UfTjl33DJPI/AAAAAAAABuA/UFCJzGdn7h8/s1600/Linksys_VPN2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="211" src="http://3.bp.blogspot.com/-OnIdFRpPw0k/UfTjl33DJPI/AAAAAAAABuA/UFCJzGdn7h8/s320/Linksys_VPN2.jpg" width="320" /></a></div>
<div>
<br /></div>
Save the settings and restart vpn on both ends. Your VPN should start rocking by now. Ping from the 192.168.4.0/24 LAN to the Amazon IPSec Server's Private IP and it should be replying.<br />
<br />
Please always read logs on both the router and the linux server very carefully and figure out what they are trying to communicate. Without any logs I probably would never had created this VPN.<br />
<br />
I hope it be of some help to someone. Have a great day.</div>
Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-7979378259821020425.post-56987891556853377162013-07-24T15:36:00.000-07:002013-07-25T10:27:40.309-07:00NIC Bonding in CentOS 6.4,Ubuntu 12.04, and Vyatta 6.6<div dir="ltr" style="text-align: left;" trbidi="on">
Its late night here and unexpectedly I'm high on motivation to do something except working hence just shifting my procrastination energy into writing this blog.<br />
<br />
I've previously blogged a post on setting up an Active/Passive HA setup for Linux servers, so this on is one step further into one server. By one step further into the server I mean to have some form of High Availability on Network Interfaces.<br />
<br />
Link Aggregation, NIC Bonding, NIC teaming, Interface Bonding are various names it is known as. Read some basics on it visit this wikipedia <a href="https://en.wikipedia.org/wiki/Link_aggregation">link</a>.<br />
<a href="http://4.bp.blogspot.com/-WFspVoz-pSg/UfBS3vEpdHI/AAAAAAAABtM/441st8yTdsg/s1600/Interface_bonding.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="212" src="http://4.bp.blogspot.com/-WFspVoz-pSg/UfBS3vEpdHI/AAAAAAAABtM/441st8yTdsg/s320/Interface_bonding.jpg" width="320" /></a><br />
My basic motivation for creating NIC Bonding on my servers was to create a self healing topology in which a single cable or interface failure do not impact any service at all. Since I've redundant powers, servers, switches, and routers setup from my very own hands so I know how this will add up in my setup. Removing one cable from the server keeps the server accessible and hence all services working perfectly fine.<br />
<br />
The additional benefit which I can benefit from NIC bonding is link "Aggregation". The two 1Gbps interface will and can combine to give me an aggregated speed of 2Gbps. That is something I still need to test and probably post my findings on its reality sometime by transferring huge chunks of data.<br />
<br />
<div>
<b><span style="color: red;">WARNING</span></b>: I had to reboot one of my server as I had an interface already configured so a service restart didn't work properly and the same IP remained configured on eth0 and bond0 and hence caused temporary access issue. Just to be sure have a KVM/ILOM remote access ready while doing this setup.</div>
<div>
<br /></div>
Lets move forward.<br />
<br />
<div style="text-align: center;">
<b><span style="font-size: large;">Creating NIC Bond interface on CentOS 6.4</span></b></div>
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">[root@ASTERISK-A</span> <span style="color: white;">~]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/sysconfig/network-scripts/ifcfg-bond0</span></pre>
<br />
and insert the following fairly simple to understand lines.<br />
<br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">DEVICE=bond0</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">IPADDR=192.168.15.10</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">NETMASK=255.255.255.0</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">GATEWAY=192.168.15.45</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">USERCTL=no</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">BOOTPROTO=none</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">ONBOOT=yes</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">DNS1=192.168.15.45</span><br />
<div>
<br /></div>
<div>
Now remember, we need to have atleast two NIC present on the server to be part of the bond. This could be three Gig Interfaces if you've them available in order to achieve a 3Gbps link.</div>
<div>
<br /></div>
<div>
Edit the Interfaces going to be part of this bond.</div>
<div>
<br /></div>
<div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">[root@ASTERISK-A</span> <span style="color: white;">~]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/sysconfig/network-scripts/ifcfg-eth0</span></pre>
</div>
<div>
<br /></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">DEVICE=eth0</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ffe599;">TYPE=Ethernet</span></span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">BOOTPROTO=none</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">ONBOOT=yes</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">MASTER=bond0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">SLAVE=yes</span></div>
</div>
<div>
<br /></div>
<div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">[root@ASTERISK-A</span> <span style="color: white;">~]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/sysconfig/network-scripts/ifcfg-eth1</span></pre>
</div>
<div>
<br /></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">DEVICE=eth1</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #ffe599;">TYPE=Ethernet</span></span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">BOOTPROTO=none</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">ONBOOT=yes</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">USERCTL=no</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">MASTER=bond0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">SLAVE=yes</span></div>
</div>
<div>
<br /></div>
<div>
Now its time to setup some parameters for the 007-Bond Interface.</div>
<div>
<br /></div>
<div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">[root@ASTERISK-A</span> <span style="color: white;">~]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/modprobe.d/bonding.conf</span></pre>
</div>
<div>
<br /></div>
Write the lines below in the file,save and exit.<br />
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">alias bond0 bonding</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">options bond0 mode=1 miimon=100 arp_interval=100 arp_ip_target=192.168.15.45,192.168.15.5,192.168.15.20</span></div>
<br />
<br />
The above configuration is used by the "bonding" Linux kernel module. The options are important here:</div>
<div>
<br />
<b>mode=1</b> : Set the bonding method to <b>Active backup</b>. </div>
<div>
<b>miimon=100 </b>: Set the MII link monitoring frequency to 100 milliseconds. This determines how often the link state of each slave is inspected for link failures.</div>
<div>
<b>arp_interval=100</b> : Set the ARP link monitoring frequency to 100 milliseconds (You can setup any keeping your network equipment in mind). This is important to be there.<br />
<b>arp_ip_target=192.168.15.45, 192.168.15.5</b> : Use the 192.168.15.5 (router ip) and 192.168.15.45 IP addresses to use as ARP monitoring peers when arp_interval is > 0. This is used determine the health of the link to the targets. Multiple IP addresses must be separated by a comma. At least one IP address must be given (usually I set it to router IP) for ARP monitoring to function. The maximum number of targets that can be specified is 16.</div>
<div>
<br /></div>
<div>
Thats all. Just restart the networking service and if you've any ethernet interface configured then you might need to shutdown that interface and start the network service again.</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">[root@ASTERISK-A</span> <span style="color: white;">~]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/network restart</span></pre>
</div>
<div>
<br /></div>
<div>
<div style="text-align: center;">
<b><span style="font-size: large;">Creating NIC Bond interface on Ubuntu </span></b><span style="text-align: left;"><span style="font-size: large;"><b>12.04</b></span></span></div>
<div style="text-align: center;">
<span style="text-align: left;"><span style="font-size: large;"><b><br /></b></span></span></div>
</div>
<div>
On Ubuntu Server the steps for configuring are 90% the same except that we need to install the package which gets the bonding kernel module.</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@OpenSIPS-A:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># apt-get install ifenslave</span></pre>
</div>
<div>
<br /></div>
<div>
We just need to edit one file here.</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@OpenSIPS-A:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/network/interfaces</span></pre>
</div>
<div>
<br /></div>
<div>
<div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">auto lo</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">iface lo inet loopback</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">auto eth0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">iface eth0 inet manual</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-master bond0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">auto eth1</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">iface eth1 inet manual</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-master bond0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">auto bond0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">iface bond0 inet static</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">mtu 9000</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> address 192.168.15.30</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> netmask 255.255.255.0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> network 192.168.15.0</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> broadcast 192.168.15.255</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> gateway 192.168.15.45</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> dns-nameservers 192.168.15.45</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-miimon 100</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-downdelay 200</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-updelay 200</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-mode active-backup</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;"> bond-slaves none</span></div>
<div>
<br /></div>
</div>
</div>
<div>
To make sure that the bonding kernel module is loaded on reboots edit the file <b>/etc/modules</b></div>
<div>
add the word "<b>bonding</b>" at the end save, and exit. To Load bonding module right away execute the following command:</div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@OpenSIPS-A:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># modprobe bonding</span></pre>
</div>
<div>
<br /></div>
<div>
Now restart the networking service and bond0 interface should be up and ready. </div>
<div>
<br /></div>
<div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@OpenSIPS-A:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/networking restart</span></pre>
</div>
<div>
<br /></div>
<div style="text-align: left;">
<b style="text-align: center;"><span style="font-size: large;"> Creating NIC Bond interface on </span></b><b style="font-size: x-large;">Vyatta 6.6</b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Vyatta is one of my favorite subject, huge thanks to Mr. Asim Ansari who introduced me to it back in 2010 and I've been using it and loving it ever since. There are other cool stuff Vyatta is doing for me which I'll cover later on. Lets see how to create a Bond Interface on Vyatta.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">vyatta@FW-A:~$</span> <span style="color: white;">configure</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces bonding bond0 address 192.168.15.45/24</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces bonding bond0 arp-monitor interval 100</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces bonding bond0 mode adaptive-load-balance</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces bonding bond0 mtu 9000</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces ethernet eth0 bond-group bond0</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces ethernet eth1 bond-group bond0</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># commit</span>
<span style="color: white;">vyatta@FW-A</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># save</span></pre>
</div>
<div style="text-align: left;">
<div>
<br /></div>
<div>
<b><span style="color: red;"><br /></span></b></div>
<div>
<b><span style="color: red;">WARNING</span>:</b> Once again ensure that the eth0 and eth1 are not assigned with IP address already, if so please delete them before assigning that ethX interface to bond-group. </div>
<div>
<br /></div>
</div>
<div>
Thats all for tonight, I'm sleepy now and should take rest while you guys enjoy having good time with your servers and setups.</div>
<div>
<br /></div>
<div>
<b><span style="font-size: large;">Recommended Articles:</span></b></div>
<div>
<a href="http://www.stgraber.org/2012/01/04/networking-in-ubuntu-12-04-lts/">http://www.stgraber.org/2012/01/04/networking-in-ubuntu-12-04-lts/</a></div>
<div>
<a href="http://www.cyberciti.biz/tips/debian-ubuntu-teaming-aggregating-multiple-network-connections.html">http://www.cyberciti.biz/tips/debian-ubuntu-teaming-aggregating-multiple-network-connections.html</a></div>
<div>
<a href="http://wiki.centos.org/TipsAndTricks/BondingInterfaces">http://wiki.centos.org/TipsAndTricks/BondingInterfaces</a></div>
<div>
<a href="http://unixfoo.blogspot.com.au/2008/02/network-bonding-part-ii-modes-of.html">http://unixfoo.blogspot.com.au/2008/02/network-bonding-part-ii-modes-of.html</a></div>
<div>
<a href="http://www.vyatta.com/downloads/documentation/VC6.5/Vyatta-LANInterfaces_6.5R1_v01.pdf">http://www.vyatta.com/downloads/documentation/VC6.5/Vyatta-LANInterfaces_6.5R1_v01.pdf</a></div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7979378259821020425.post-4841385475714154132013-06-23T03:06:00.000-07:002013-06-23T03:06:09.761-07:00My Book: Implementing Citrix XenServer Quickstarter<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="color: #ffd966; font-size: x-large;">Implementing Citrix XenServer Quickstarter</span></div>
Last week was a happy week for me since my book got published by Packt Publish, its really a big achievement for me to have a book published internationally on some technical topic. It feels awesome to be an author.<br />
<br />
It all started from my blog post on <a href="http://saevolgo.blogspot.in/2012/05/vyattaopensips-on-citrix-xen-server.html">Vyatta+OpenSIPS on Citrix XEN-Server</a> when it caught attention of an Author Relation Executive from <a href="http://www.packtpub.com/">Packt Publishing</a>, a well known publisher for technical books. I was contacted and was subsequently asked to write a 100 page book on the Citrix XenServer.<br />
<br />
<a href="https://www.packtpub.com/implementing-citrix-xenserver-quickstarter/book" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-NIp98u1hDO4/UcbCUjp3aeI/AAAAAAAABsc/pOehFJLh58g/s320/MYBOOK.jpg" width="258" /></a>So my work with this book started around Oct,2012 A lot of things changed around me while writing this book; I changed my job, got married, got busy in personal startup as a vendor of a star product for a big Telecom here. And meanwhile all these, this book got a little bit delayed. I personally thank Yogesh Dalvi the Editor, and Sneha Modi the Project Coordinator of this book who tolerated with me throughout this book happily.<br />
<br />
<b><span style="color: #ffd966;">Summary of the Book:</span></b><br />
As the title suggests this book is a Quick Starter guide for Citrix XenServer, anyone who knows about clouds and virtualization and wants to get involved with this wide spreading technologies should take this book as a beginner to interim level guide. <a href="http://www.citrix.com/">Citrix </a>is a giant leader in providing cloud based solutions, there are other great products as well see this <a href="http://www.citrix.com/products.html">link</a>.<br />
<br />
I've tried to keep things as simple as possible to understand and not use the really techy jargon. Like usual approach the starting chapters introduce the history of XenServer, and my personal introduction with virtualization. Since this is a quick starter book so the immediate goals are to setup a Citrix XenServer host and then find out what can be done to create virtual machines; where to place those virtual machines; storage concepts and their usage in our Virtual machines setup.<br />
Daily maintenance like, creating and deploying snapshots, templates and importing virtual machines are covered besides topic like cloning, network connectivity, and importance of XenServer tools.<br />
<br />
This book explains the management of a VM resources like CPU, Memory, storage. Specialized networking concepts are also explained like Network pools, VLANs, NIC Bonding, and introduction to Virtual Switches and Routers. Advanced topics related to Citrix XenServer such as High Availability, Role Based Admin Control, and conversion of Physical machine to Virtual machine are briefly introduced in the last chapter.<br />
<br />
<b><span style="color: #ffd966;">Acknowledgements:</span></b><br />
Besides being thankful to God, and my loving Parents, I'd like to say my heartiest thanks to my dear Wife who really helped me completing the last few lingering chapters, I love you my sweet Wife. Then I want to thank my colleagues and friends at Vopium who not only appreciated this book-writing but also helped me in multiple ways to dedicate my time on this book. I'm thankful to Mr. Husnain from HR team; Mr. Imran Iqbal Head of Operations who appreciated, allowed, and applauded this activity; Mr. Haroon Scrum Master who provisioned me with only enough projects to be able to give time to writing this; Mr. Shahzad Senior Manager VoIP team as being my Mentor; then Mr. Abdul Basit, my Manager VoIP who gave me permissions and assisted me in starting up with this book. My friend Salman, Faheem, Rizwan, and Qasim who made fun of me and made me feel 'encouraged' to continue writing(:P).<br />
<br />
Thank you all. I am really grateful and very much appreciate the help to avail this opportunity.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-80103761538371587012013-06-08T03:03:00.001-07:002013-06-08T03:15:56.164-07:00Book Review: FreeSWITCH 1.2<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="font-size: x-large;">FreeSWITCH 1.2</span><span style="font-size: large;"> </span><i>Second Edition</i></div>
<div style="text-align: left;">
<div style="text-align: center;">
<span style="font-size: large;">Build robust, high-performance telephony systems </span></div>
<div style="text-align: center;">
<span style="font-size: large;">using FreeSWITCH</span></div>
<br />
I raised my hand when the reviewers for the new FreeSWITCH book were wanted and hence this is my very first effort in writing a book review on FreeSWITCH which I really like and love to work with.<br />
<br />
<b><span style="color: #ffd966;">Anthony Minessale</span></b> The Father of FreeSWITCH , <b><span style="color: #ffd966;">Michael S Collins</span></b> from Barracuda Networks, <b><span style="color: #ffd966;">Darren Schreiber</span></b> CEO & Co-founder <a href="http://www.2600hz.com/">2600Hz</a>, and <b><span style="color: #ffd966;">Raymond Chandler</span></b> also from Barracuda Networks are the authors of this book.<br />
<br />
<b><span style="color: #ffd966;">What is FreeSWITCH:</span></b><br />
Quoting from the book,<br />
<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-zyaokm3oMCk/UbLzg0fIHaI/AAAAAAAABrc/8PHu0PTwy4M/s1600/FS-book-Cover.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="320" src="http://1.bp.blogspot.com/-zyaokm3oMCk/UbLzg0fIHaI/AAAAAAAABrc/8PHu0PTwy4M/s320/FS-book-Cover.jpg" width="248" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><a href="http://www.packtpub.com/freeswitch-1-2/book">FreeSWITCH 1.2</a></td></tr>
</tbody></table>
"<i>FreeSWITCH is a scalable softswitch. In practical terms, this means that it can do anything a traditional PBX can do and much more. It can (and does) act as the core switching software for commercial carriers. It can scale up to handle thousands of simultaneous calls. It can also scale down to act as a simple softphone for your laptop or personal computer. It can also work in a cluster of servers. FreeSWITCH is the telephony engine that powers the CudaTel Communication Server from Barracuda Networks. </i>"<br />
<br />
<b><span style="color: #ffd966;">What FreeSWITCH is NOT:</span></b><br />
Again quoting the authors here,<br />
"<i>FreeSWITCH is not a proxy server. If you need proxy server functionality, then consider OpenSIPS, Kamailio, Repro, or other similar software. FreeSWITCH is a back-to-back user agent or B2BUA. In this regard, it is similar to Asterisk and other IP PBX software.</i>"<br />
<br />
Compared to the previous book, FreeSWITCH 1.0.6, which was released three years ago, this one contains updates which happened all these years. FreeSWITCH is getting more feature rich, scalable, and reliable as the opensource community grows and hence this book is essentially an updated revision of the previous book. There are new chapters covering more details like <span style="color: #ffe599; font-family: Courier New, Courier, monospace;">mod_xml_curl</span> is now a separate chapter explaining its usage for creating dynamic configurations. Similarly the <span style="color: #ffe599; font-family: Courier New, Courier, monospace;">mod_httapi</span> is detailed in chapter 11 this module is developed last year.<br />
<br />
I really appreciate the addition of chapter 12,13 on Handling NAT and VoIP Security respectively. I believe these two chapters are more important for beginners on FreeSWITCH as they face NAT issues right when they start using FreeSWITCH, and once they do get through this stage the insecure nature of their deployment becomes their top most priority. A very good detailed explanation on how to secure the Server at Network layer, and Application layer with separate methods to secure the Signalling and Media.<br />
<br />
<a href="http://1.bp.blogspot.com/-VnN-1ieWhXw/UbH6TxxBwLI/AAAAAAAABrM/52D_3tSLrUM/s1600/FS-Archit.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="http://1.bp.blogspot.com/-VnN-1ieWhXw/UbH6TxxBwLI/AAAAAAAABrM/52D_3tSLrUM/s200/FS-Archit.jpg" width="195" /></a>As expected and naturally the first chapter deals with the introduction of the application's architecture and how different module types are connected to the central core and there are further loadable modules which enable their respective functionality into the system.<br />
The image on the right is self explanatory on how different modules are independent of each other and this modular approach enables FreeSWITCH to be a scalable system where the core handles the switching part only. In next chapter Installation, and starting up of FS is detailed on different operating systems including Windows.<br />
<br />
If you're a beginner and want to understand the working of FS then you need to attend to Chapter 3 very carefully. I personally refreshed some very basic but important concepts related to XML dialplan and use of channel variables from this chapter. This chapter teaches us exactly how to interact with FreeSWITCH using it Command Line Interface plus Sort of Hello-world configuration handling in the form of:<br />
• Configuring different phones to work with FreeSWITCH<br />
• Calling various default extensions in the system<br />
<br />
I really like the way the chapters are written progressing step by step, I enjoyed adding up a new SIP user in the User Directory. Defining user groups, routing to newly created dialplan in XML, testing the voicemail really made me smile. Looking at the gateway configurations, integrating my test FreeSWITCH with my CISCO gateway and making calls IN/OUT was fun. Chapter 4 was indeed addition to my knowledge and skills related to FS.<br />
<span style="font-size: large;">[</span>Tip: execute '<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">sofia profile external restart reloadxml</span>' to add the gateway.<span style="font-size: large;">]</span><br />
<br />
I was impressed to know that FreeSWITCH has more than 140 Dialplan applications. <br />
<br />
LUA is one of my favorite language and honestly I got introduced to LUA from FreeSWITCH. Since then I enjoy writing complex FreeSWITCH application using LUA. We do however need some XML in our deployments but most of the time I find myself working in LUA. I was happy to see full chapters on both LUA and XML advance concepts. Click on the book thumbnail to <a alt="FreeSWITCH 1.2 - Second Edition" href="http://my.safaribooksonline.com/9781782161004/ch07lvl1sec55_html?portal=my&uicode=&__hideTop=true&__readerfullscreen=1&__readerleftmenu=1&flashzoom=0&cid=shareWidgetUse" onclick="window.open('http://my.safaribooksonline.com/9781782161004/ch07lvl1sec55_html?portal=my&uicode=&__hideTop=true&__readerfullscreen=1&__readerleftmenu=1&flashzoom=0&cid=shareWidgetUse', 'StartViewer', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=600'); return false;" style="display: inline !important; height: 62px; text-align: center; width: 52px;" target="_blank" title="FreeSWITCH 1.2 - Second Edition">Preview</a> the chapter on Dialplan scripting with LUA.<br />
<a alt="FreeSWITCH 1.2 - Second Edition" href="http://my.safaribooksonline.com/9781782161004/ch07lvl1sec55_html?portal=my&uicode=&__hideTop=true&__readerfullscreen=1&__readerleftmenu=1&flashzoom=0&cid=shareWidgetUse" onclick="window.open('http://my.safaribooksonline.com/9781782161004/ch07lvl1sec55_html?portal=my&uicode=&__hideTop=true&__readerfullscreen=1&__readerleftmenu=1&flashzoom=0&cid=shareWidgetUse', 'StartViewer', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1000,height=600'); return false;" style="display: inline !important; height: 62px; text-align: center; width: 52px;" target="_blank" title="FreeSWITCH 1.2 - Second Edition"><img border="0" src="http://my.safaribooksonline.com/images/9781782161004/9781782161004_cs.jpg" /></a><br />
I really appreciate the effort put in by the authors and reviewers, a very big help for anyone who wish to get closer to the FreeSWITCH VoIP Servers. A very well written book focusing every step required to start using the FS without hurdles.<br />
<br />
Looking forward to read books like these from OpenSource VoIP community. I hope to implement the given examples myself in upcoming weekends and post my experiences.<br />
<br /></div>
</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-7979378259821020425.post-42406571452438018822013-06-06T11:51:00.000-07:002013-06-06T11:58:13.657-07:00Asterisk Dialplan and Redis Integration<div dir="ltr" style="text-align: left;" trbidi="on">
I came across this very strange task that I need to have the asterisk get/set data from Redis. My initial thought was this is easy, just going to plug in a perl AGI, use redis connector and everything will be super cool. BUT the condition was I've to stay within the extensions.conf. Yes, I did try convince everyone around but to no avail. NO AGIs, use anything else however I want.<br />
<br />
So what I did was create a small shell script which behaves as an API for Redis, and use the Asterisk System() application to GET/SET my desired memcached values.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@asterisk1:~</span><span style="background-color: #0f140f; color: #008800; font-style: italic;"># vim /etc/asterisk/redis.pl</span></pre>
<br />
Insert the following lines in there, add more commands to it see this link: <a href="http://search.cpan.org/dist/Redis/lib/Redis.pm">http://search.cpan.org/dist/Redis/lib/Redis.pm</a><br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="background-color: #0f140f; color: #008800; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: white;">my</span> <span style="color: white;">$redis_db</span> <span style="color: white;">=</span> <span style="color: white;">$ARGV[</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">];</span>
<span style="color: white;">my</span> <span style="color: white;">$command</span> <span style="color: white;">=</span> <span style="color: white;">$ARGV[</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">];</span>
<span style="color: white;">my</span> <span style="color: white;">$keyname</span> <span style="color: white;">=</span> <span style="color: white;">$ARGV[</span><span style="color: #0086f7; font-weight: bold;">2</span><span style="color: white;">];</span>
<span style="color: white;">my</span> <span style="color: white;">$value</span> <span style="color: white;">=</span> <span style="color: white;">$ARGV[</span><span style="color: #0086f7; font-weight: bold;">3</span><span style="color: white;">];</span>
<span style="background-color: #0f140f; color: #008800; font-style: italic;"># PERL MODULE</span>
<span style="color: white;">require</span> <span style="color: white;">Redis;</span>
<span style="color: white;">my</span> <span style="color: white;">$redis</span> <span style="color: white;">=</span> <span style="color: white;">Redis->new(server</span> <span style="color: white;">=></span> <span style="color: #0086d2;">'127.0.0.1:6379'</span><span style="color: white;">);</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($redis_db</span> <span style="color: white;">></span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: white;">&&</span> <span style="color: white;">$redis_db</span> <span style="color: white;"><</span> <span style="color: #0086f7; font-weight: bold;">16</span><span style="color: white;">){</span>
<span style="color: white;">$redis->select(</span><span style="color: #0086d2;">"$redis_db"</span><span style="color: white;">);</span>
<span style="color: white;">}</span> <span style="color: #fb660a; font-weight: bold;">else</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">print</span> <span style="color: #0086d2;">"using Default Redis DB\n"</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"GET"</span><span style="color: white;">){</span>
<span style="color: white;">$val=$redis->get(</span><span style="color: #0086d2;">"$keyname"</span><span style="color: white;">);</span>
<span style="color: #fb660a; font-weight: bold;">print</span> <span style="color: #0086d2;">"$val"</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"SET"</span> <span style="color: white;">&&</span> <span style="color: white;">$value</span> <span style="color: white;">!=</span> <span style="color: #0086d2;">""</span><span style="color: white;">){</span>
<span style="color: white;">$redis->set(</span><span style="color: #0086d2;">"$keyname"</span> <span style="color: white;">=></span> <span style="color: #0086d2;">"$value"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"INCR"</span><span style="color: white;">){</span>
<span style="color: white;">$redis->incr(</span><span style="color: #0086d2;">"$keyname"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"DECR"</span><span style="color: white;">){</span>
<span style="color: white;">$redis->decr(</span><span style="color: #0086d2;">"$keyname"</span><span style="color: white;">);</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"DECRBY"</span><span style="color: white;">){</span>
<span style="color: white;">$redis->decrby(</span><span style="color: #0086d2;">"$keyname"</span><span style="color: white;">,$value);</span>
<span style="color: white;">}</span>
<span style="color: #fb660a; font-weight: bold;">if</span><span style="color: white;">($command</span> <span style="color: white;">eq</span> <span style="color: #0086d2;">"DEL"</span><span style="color: white;">){</span>
<span style="color: white;">$redis-></span><span style="color: #fb660a; font-weight: bold;">del</span><span style="color: white;">(</span><span style="color: #0086d2;">"$keyname"</span> <span style="color: white;">)</span> <span style="color: white;">||</span> <span style="color: white;">warn</span> <span style="color: #0086d2;">"key doesn't exist"</span><span style="color: white;">;</span>
<span style="color: white;">}</span>
<span style="color: white;">$redis->quit;</span></pre>
<br />
Save and Exit;<br />
<br />
give permissions to this script.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">root@asterisk1:~</span><span style="background-color: #0f140f; color: #008800; font-style: italic;"># chmod 755 /etc/asterisk/redis.pl</span></pre>
<br />
Now in Dialplan I call <span style="font-family: Courier New, Courier, monospace;">System()</span> Application like this.<br />
<br />
<pre style="color: #333333; line-height: 16px;"><span style="color: #cccccc;">exten</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">_</span><span style="color: #00cdcd;">XXX</span><span style="color: #cccccc;">,</span><span style="color: #cd00cd;">1</span><span style="color: #cccccc;">,</span><span style="color: #00cdcd;">SET</span><span style="color: #cccccc;">(</span><span style="color: #00cdcd;">CALLS</span><span style="color: #3399cc;">=</span><span style="color: #cd0000;">${</span><span style="color: #00cdcd;">SHELL</span><span style="color: #cccccc;">(</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">etc</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">asterisk</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">redis.pl</span> <span style="color: #cd00cd;">1</span> <span style="color: #00cdcd;">GET</span> <span style="color: #cd0000;">${</span><span style="color: #00cdcd;">CALLERID</span><span style="color: #cccccc;">(num)})})</span>
<span style="color: #cccccc;">same</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">n,</span><span style="color: #00cdcd;">NOOP</span><span style="color: #cccccc;">(</span><span style="color: #00cdcd;">The</span> <span style="color: #00cdcd;">Caller</span><span style="color: #cccccc;">:</span><span style="color: #cd0000;">${</span><span style="color: #00cdcd;">CALLERID</span><span style="color: #cccccc;">(num)}</span> <span style="color: #cccccc;">has</span> <span style="color: #cd0000;">${</span><span style="color: #00cdcd;">CALLS</span><span style="color: #cccccc;">}</span> <span style="color: #cccccc;">calls</span> <span style="color: #cccccc;">in</span> <span style="color: #cccccc;">the</span> <span style="color: #cccccc;">system)</span>
<span style="color: #cccccc;">same</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">n,</span><span style="color: #00cdcd;">Answer</span><span style="color: #cccccc;">()</span>
<span style="color: #cccccc;">same</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">n,</span><span style="color: #00cdcd;">System</span><span style="color: #cccccc;">(</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">etc</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">asterisk</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">redis.pl</span> <span style="color: #cd00cd;">1</span> <span style="color: #00cdcd;">INCR</span> <span style="color: #cd0000;">${</span><span style="color: #00cdcd;">CALLERID</span><span style="color: #cccccc;">(num)})</span>
<span style="color: #cccccc;">same</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">n,</span><span style="color: #00cdcd;">NOOP</span><span style="color: #cccccc;">(</span><span style="color: #00cdcd;">Do</span> <span style="color: #cccccc;">some</span> <span style="color: #cccccc;">dialplan</span> <span style="color: #cccccc;">actions</span> <span style="color: #cccccc;">as</span> <span style="color: #cccccc;">you</span> <span style="color: #cccccc;">want)</span>
<span style="color: #cccccc;">...</span>
<span style="color: #cccccc;">...</span>
<span style="color: #cccccc;">exten</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">h,</span><span style="color: #cd00cd;">1</span><span style="color: #cccccc;">,</span><span style="color: #00cdcd;">System</span><span style="color: #cccccc;">(</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">etc</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">asterisk</span><span style="color: #3399cc;">/</span><span style="color: #cccccc;">redis.pl</span> <span style="color: #cd00cd;">1</span> <span style="color: #00cdcd;">DECR</span> <span style="color: #cd0000;">${</span><span style="color: #00cdcd;">CALLERID</span><span style="color: #cccccc;">(num)})</span>
<span style="color: #cccccc;">exten</span> <span style="color: #3399cc;">=></span> <span style="color: #cccccc;">h,n,</span><span style="color: #00cdcd;">Hangup</span><span style="color: #cccccc;">()</span></pre>
<br />
Thats all. Now I can keep realtime track of the active calls for any user/trunk/carrier etc etc from my dialplan. The real beauty of using this shared Redis Memcache store is that I've like 8 asterisk servers, all of them using the same Redis store and all of them are aware of the current number of calls from/to a particular user.<br />
<br />
I've also used it to share the Statuses of Queues and Conference rooms residing on special servers with normal IVR servers. Without using this shared store I can only think of using a Database used by all and I believe that doesn't perform well when multiple users are accessing and modifying the same field concurrently especially when the usage is heavy.<br />
<br /></div>
Unknownnoreply@blogger.com8tag:blogger.com,1999:blog-7979378259821020425.post-8109925733183515962013-05-14T02:34:00.001-07:002013-05-14T03:44:35.580-07:00OpenSIPS/Kamailio High Availability Clustering - 2<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="margin: 0cm 0cm 0.0001pt; text-align: center;">
<b><u><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 14pt;">High Availability Setup<o:p></o:p></span></u></b></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">This post was due for a very very long time since I posted about the general design of a HA-SIP-Proxy in one of my <a href="http://saevolgo.blogspot.com/2012/07/clustering-sip-proxy-opensipskamailio.html" target="_blank">old blogpost</a>.</span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">Now lets start working on this. Using
this setup we can cluster two or more machine by using one single Public IP on their
WAN interface one-at-a-time. To ensure service availability in case primary
(current master) server crashes the application heartbeat resource is configured to monitor the service's status every after 30 seconds. If the Service is found to be stopped it tries start it on the same server for couple of times and then migrate the group of services to the other node. </span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">This tutorial is equally good for OpenSIPS or Kamailio or any other services.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-OHD6lvsFJ5Y/UZIVdvvk6NI/AAAAAAAABq8/5J7pdMhk5mg/s1600/HA-SETUP.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="206" src="http://2.bp.blogspot.com/-OHD6lvsFJ5Y/UZIVdvvk6NI/AAAAAAAABq8/5J7pdMhk5mg/s320/HA-SETUP.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Active/Passive design diagram</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br />
<b><u>Pre-Requisites:</u></b><br />
<br />
- Atleast two servers with WAN interfaces empty but cable connected, such that
if Public IP is assigned it readily gets accessible from Internet.<br />
<br />
- LAN interfaces on both servers should be on the same subnet and should have
static Private IP configured.<br />
<br />
- The WAN and LAN interfaces on both servers should have similar names i,e
eth0=WAN, eth1=LAN<br />
<br />
- There should be NO default route inserted to these servers.<br />
<br />
<b><u>Installing Packages:<br />
</u></b><br />
- Insert a default g/w for LAN interface on both machines temporarily<br />
<br />
- Install OpenSIPS or Kamailio or any other tools as per requirement.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">-
Install heartbeat and sipsak <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span lang="EN-US" style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-ansi-language: EN-US; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">Linux-console:~</span><i><span lang="EN-US" style="background: #0F140F; color: lime; font-family: "Courier New"; font-size: 10.0pt; mso-ansi-language: EN-US; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#
apt-get install heartbeat sipsak</span></i><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">SIPSAK
can be used in the opensips LSB init.d script to send an SIP OPTIONS packet to
OpenSIPS port and on the server's reply it'll announce the service is running.
This is optional and I suggest users to try this on their own. I recommend looking into the sample asterisk lsb-script provided by heartbeat, there they use sipsak to monitor asterisk's sip port and decided if service is up or not.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<b><u><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 14.5pt;"><br /></span></u></b></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<b><u><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 14.5pt;">Configuring Files for Heartbeat</span></u></b></div>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-size: 13.5pt;">
<br />
</span><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">NOTE: All the files we are going to edit here should be
copied to the second server as well.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">1- Edit
the </span><span lang="EN-US" style="font-size: 9.5pt;"><span style="font-family: Courier New, Courier, monospace;"><b>/etc/hosts</b></span></span><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"> file to add hostname for the two servers<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">192</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">168</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">100</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">148</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">SIP-SERVER_HA1</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 6.0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">192</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">168</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">100</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">.</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">62</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">SIP-SERVER_HA2</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">2- Edit
the </span><span lang="EN-US" style="font-size: 9.5pt;"><span style="font-family: Courier New, Courier, monospace;">/etc/heartbeat/ha.cf</span></span><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"> file and insert the following.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">enable</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">pacemaker,</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">without</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">stonith</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">crm</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">yes</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">log</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">where</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">?</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">logfacility</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">
</span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">local0</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">warning</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">of</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">soon</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">be</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">dead</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">warntime</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">10</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">declare</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">a</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">host</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">(the</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">other</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">node)</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">dead</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">after:</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">deadtime</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">20</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">dead</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">time</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">on</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">boot</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">(could</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">take</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">some</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">time</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #fb660a; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">until</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">net</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">is</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">up)</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">initdead</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">120</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">time</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">between</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">heartbeats</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">keepalive</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">
</span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">2</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">the</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">nodes</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">node</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">SIP-SERVER_HA2</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">node</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">SIP-SERVER_HA1</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">heartbeats,</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">over</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">dedicated</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">replication</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">interface!</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ucast</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">eth1</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">192.168.100.148</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ignored</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">by</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">node1</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">(owner</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">of</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ip)</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ucast</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">eth1</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">192.168.100.62</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ignored</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">by</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">node2</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">(owner</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">of</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ip)</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">#</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ping</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">the</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">switch</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">to</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">assure</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">we</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">are</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">online</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .0001pt; margin-bottom: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: white; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">ping</span><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"> </span><b><span style="color: #0086f7; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;">192.168.100.100</span></b><span style="color: #333333; font-family: "Courier New"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-CA;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; mso-line-height-alt: 12.0pt; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">3- Edit the </span><span lang="EN-US" style="font-size: 9.5pt;"><span style="font-family: Courier New, Courier, monospace;">/etc/heartbeat/authkeys</span></span><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"> file and insert the following:<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 13.5pt;">auth 1<br />
1 sha1 S3cr3tP@ssw0rd</span><span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span color:black="" new="" roman="" serif="" style="font-family: "; font-size: 13.5pt;" times=""><br />
</span><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">- Assign permissions to the above
mentioned file:<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<br />
<div style="border-bottom: solid #AAAAAA 1.0pt; border: none; mso-border-bottom-alt: solid #AAAAAA .75pt; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># chmod 0600 /etc/heartbeat/authkeys</span></pre>
</div>
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">Files editing is done here. Copy the files to other server(s).</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">- Start the heartbeat service on both servers:</span></div>
<pre style="color: #333333; line-height: 16px;"><span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># /etc/init.d/heartbeat start</span></pre>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 12.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 4.8pt;">
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">-
Wait for at least 30 seconds and then check the status of the cluster by
issuing the following command on both servers.<o:p></o:p></span></div>
<u1:p></u1:p>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">At
the end there will be displayed the cluster online nodes.</span></div>
</div>
<div style="background: #111111;">
<pre style="line-height: 100%; margin: 0;"><span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm status</span>
<span style="color: white;">============</span>
<span style="color: white;">Last</span> <span style="color: white;">updated:</span> <span style="color: white;">Tue</span> <span style="color: white;">Jan</span> <span style="color: #0086f7; font-weight: bold;">22</span> <span style="color: #0086f7; font-weight: bold;">08</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">02</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">17</span> <span style="color: #0086f7; font-weight: bold;">2013</span>
<span style="color: white;">Stack:</span> <span style="color: white;">Heartbeat</span>
<span style="color: white;">Current</span> <span style="color: white;">DC:</span> <span style="color: white;">SIP-SERVER_ha2</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">8</span><span style="color: white;">b5cf63e-</span><span style="color: #0086f7; font-weight: bold;">4</span><span style="color: white;">f77-</span><span style="color: #0086f7; font-weight: bold;">448</span><span style="color: white;">c-</span><span style="color: #0086f7; font-weight: bold;">9</span><span style="color: white;">a75-</span><span style="color: #0086f7; font-weight: bold;">6</span><span style="color: white;">a91d4a00cb7)</span> <span style="color: white;">-</span> <span style="color: white;">partition</span> <span style="color: #fb660a; font-weight: bold;">with</span> <span style="color: white;">quorum</span>
<span style="color: white;">Version:</span> <span style="color: #0086f7; font-weight: bold;">1.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">9</span><span style="color: white;">-</span><span style="color: #0086f7; font-weight: bold;">74392</span><span style="color: white;">a28b7f31d7ddc86689598bd23114f58978b</span>
<span style="color: #0086f7; font-weight: bold;">2</span> <span style="color: white;">Nodes</span> <span style="color: white;">configured,</span> <span style="color: white;">unknown</span> <span style="color: white;">expected</span> <span style="color: white;">votes</span>
<span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: white;">Resources</span> <span style="color: white;">configured.</span>
<span style="color: white;">============</span>
<span style="color: white;">Node</span> <span style="color: white;">SIP-SERVER_ha1</span> <span style="color: white;">(fe3e635f-</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">d4e-</span><span style="color: #0086f7; font-weight: bold;">4</span><span style="color: white;">d8c-</span><span style="color: #0086f7; font-weight: bold;">99e1</span><span style="color: white;">-</span><span style="color: #0086f7; font-weight: bold;">195</span><span style="color: white;">d1952ac53):</span> <span style="color: white;">UNCLEAN</span> <span style="color: white;">(offline)</span>
<span style="color: white;">Online:</span> <span style="color: white;">[</span> <span style="color: white;">SIP-SERVER_ha2</span> <span style="color: white;">SIP-SERVER_ha1]</span>
</pre>
</div>
<div class="MsoNormal" style="background: transparent; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br />
</span> <br />
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">Note
that in the very last line above we've a list of nodes which have joined this
Heartbeat group.<o:p></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /><b style="font-family: 'Times New Roman'; font-size: medium;"><u><span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 14.5pt;">Configuring Heartbeat</span></u></b>
</span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span style="font-family: Arial, sans-serif; font-size: 9.5pt;">Goto one of the active nodes in the cluster and on that server’s console issue the following commands
sequentially. Once these commands are executed on one server they will be replicated to other serves in the cluster automatically so don't need to copy these commands to other servers.</span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 6.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 4.8pt;">
<br />
<div style="background: #111111;">
<pre style="line-height: 100%; margin: 0;"><span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure property stonith-enabled=false</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure primitive FAILOVER-IP ocf:heartbeat:IPaddr2 params ip="11.22.33.44" nic="eth0" cidr_netmask="255.255.255.240" op monitor interval="10s"</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure primitive OSIPS lsb:opensips op monitor interval="30s"</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure primitive SETRoute ocf:heartbeat:Route params destination="default" device="eth0" gateway="11.22.33.1" op monitor interval="10s"</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure group PIP-OSIP-ROUTE FAILOVER-IP SETRoute OSIPS</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure colocation OSIPS-WITH-PIP-ROUTE inf: FAILOVER-IP SETRoute OSIPS</span>
<span style="color: white;">Linux-console:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># crm configure order IP-ROUTE-OSIPS inf: FAILOVER-IP SETRoute OSIPS</span>
</pre>
</div>
<span style="font-family: 'Times New Roman', serif; font-size: 13.5pt;"><br />
</span> <br />
<div class="MsoNormal" style="background: #F9F9F9; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
</div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 6.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 4.8pt;">
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">The
very first line is important to disable the <span style="color: black; text-decoration: none; text-underline: none;"><a href="http://linux-ha.org/wiki/STONITH" target="_blank">Shoot The Other Nood In The
Head</a></span><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">In
second line we're configuring a resource for the Public IP that will be
assigned to the Interface eth1 and named it FAILOVER-IP.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">In
third line we configure the resource for OpenSIPS LSB (/etc/init.d/opensips
start/stop/status) script and named it OSIPS<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">In
fourth line we configured the resource for the Linux default route to access to
Internet and named it SETRoute.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">So
now in fifth line we created a group of these above mentioned resources.</span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">In
next line we bound them to move together whenever they're shifted from one
machine to another.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;">In
the very last line we arranged the services to be started in such an order that
FAILOVER-IP is assigned to Interface first, then the SETRoute resource is
executed to put in the default route to reach to Internet, and then OSIP
resource is called to start OpenSIPS.</span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><b><u>References and Useful Links:</u></b></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><b><u><br /></u></b></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><a href="http://zeldor.biz/2010/12/activepassive-cluster-with-pacemaker-corosync/">http://zeldor.biz/2010/12/activepassive-cluster-with-pacemaker-corosync/</a></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<a href="http://clusterlabs.org/wiki/Debian_Lenny_HowTo#Resource_operations">http://clusterlabs.org/wiki/Debian_Lenny_HowTo#Resource_operations</a></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<a href="http://foaa.de/old-blog/2010/10/intro-to-pacemaker-on-heartbeat/trackback/index.html">http://foaa.de/old-blog/2010/10/intro-to-pacemaker-on-heartbeat/trackback/index.html</a></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span lang="EN-US" style="font-family: Arial, sans-serif; font-size: 9.5pt;"><a href="http://blog.foaa.de/2010/10/intro-to-pacemaker-part-2-advanced-topics/#use-case-2-node-proftpd-cluster">http://blog.foaa.de/2010/10/intro-to-pacemaker-part-2-advanced-topics/#use-case-2-node-proftpd-cluster</a></span></div>
</div>
</div>
Unknownnoreply@blogger.com13tag:blogger.com,1999:blog-7979378259821020425.post-22213985487250274692013-01-20T06:51:00.000-08:002013-07-28T10:59:33.798-07:00OpenSIPS and Cassandra Integrated<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Finally back to the blog after a long busy schedule, well its still the same scheule but I've managed some time to take a look at setting up OpenSIPS with Cassandra as it's cache store. In one of my blog post I showed <a href="http://saevolgo.blogspot.com/2012/07/opensips-working-with-redis.html">how to setup opensips and redis</a> (which is also now updated for new Hiredis installation github path).<br />
<br />
The advanatges can be numerious while we are using Cassandra and Redis individually or together from one opensips which are outlined in a very <a href="http://www.opensips.org/Resources/DocsTutKvinterface">detailed article</a> by Vlad Paiu - One of the developers and contributors of OpenSIPS project.<br />
Possible use cases from the opensips documentation page are; Password caching for DB authentication<br />
or Simple but distributed billing. With recent new developments going on specially on cacheDB are its now possible to have a distirubuted OpenSIPS cluster with a shared CacheDB backbone and all iternal data is available across all the opensips node for example dialog profiles of callers, loadbalanced resources statuses.<br />
Over all these CacheDB modules enable multiple OpenSIPS instances to share internal data like number of calls, registration, call counters, billing data, IP balcklists etc. <a href="http://opensips.org/pub/events/2012-08-07_ClueCon_Chicago/BOGDAN_IANCU-OpenSIPS-Distributed_and_Clustering.pdf">Refer to this presentation at Cluecon-2012</a>.<br />
So lets get started to integrate OpenSIPS 1.8 with Cassandra. Installation process for OpenSIPS 1.8 has been changed a little bit. Install all the libraries and packages as mentioned in <a href="http://saevolgo.blogspot.com/2012/05/installing-opensips-on-ubuntu-server.html">this post</a>.<br />
<br />
<div style="text-align: center;">
<b>OPENSIPS 1.8 INSTALLATION</b></div>
<div style="text-align: center;">
<b><br /></b></div>
Once after the repositiores are installed we need to install thrift-0.6.1 which is the Cassandra's interfcing client used by OpenSIPS.<br />
<pre><span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># wget http://archive.apache.org/dist/thrift/0.6.1/thrift-0.6.1.tar.gz</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># tar zxvf thrift-0.6.1.tar.gz</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd thrift-0.6.1/</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./configure</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make install</span></pre>
<br />
<b><span style="color: #ffd966;">UPDATE[28-July-2013]:</span></b> As commented by a respected viewer; we need to install C++ boost libraries for OpenSIPS 1.9 on Debian 6. See comment by RQ in the comments section for further details.<br />
<br />
I tried installing the newest version of thrift but OpenSIPS won't compile and give errors. So next, download and extract the 1.8 version of OpenSIPS and execute the '<span style="font-family: Courier New, Courier, monospace;">make menuconfig</span>' command.<br />
<pre><span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#wget http://opensips.org/pub/opensips/1.8.2/src/opensips-1.8.2-svn9601_src.tar.gz</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#tar zxvf opensips-1.8.2-svn9601_src.tar.gz</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd opensips-1.8.2-tls/</span>
<span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#make menuconfig
</span></pre>
A menu will open up like this.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-xsEFPUhO_Ss/UPvtjGA-7XI/AAAAAAAACcw/sh4FGL8RxDI/s1600/osip-menu1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="197" src="http://3.bp.blogspot.com/-xsEFPUhO_Ss/UPvtjGA-7XI/AAAAAAAACcw/sh4FGL8RxDI/s320/osip-menu1.jpg" width="320" /></a></div>
<pre><span style="font-family: 'Times New Roman'; line-height: normal; white-space: normal;">Press Right arrow key on the first option and goto the following sub menu.</span></pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-AzCFsXNg0VQ/UPvt7h5Qp-I/AAAAAAAACc4/_s-KDSrxJHo/s1600/osip-menu2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="223" src="http://2.bp.blogspot.com/-AzCFsXNg0VQ/UPvt7h5Qp-I/AAAAAAAACc4/_s-KDSrxJHo/s320/osip-menu2.jpg" width="320" /></a></div>
<pre><span style="font-family: 'Times New Roman'; line-height: normal; white-space: normal;">Now pressing right arrow key will take us to the module selection menu where we have to select which modules we need to install. Make sure to select the Cassandra module.</span></pre>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-sGqaza2VXYk/UPvuaVVKcnI/AAAAAAAACdA/uNGXPheAwcM/s1600/osip-menu3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="162" src="http://1.bp.blogspot.com/-sGqaza2VXYk/UPvuaVVKcnI/AAAAAAAACdA/uNGXPheAwcM/s320/osip-menu3.jpg" width="320" /></a></div>
<pre><span style="font-family: 'Times New Roman'; line-height: normal; white-space: normal;">Once the modules' selection is made press left arrow key to go back to the figure 2. Select "Save Changes" and press enter. A list of suggested libraries and packages will show up at the bottom of the screen for help.</span></pre>
<pre><span style="font-family: Times New Roman;"><span style="white-space: normal;">Do change installation paths and other flags according to your requirements.</span></span></pre>
<pre><span style="font-family: 'Times New Roman'; white-space: normal;">Press left arrow key again to go back to main menu as in figure 1. Select "</span><span style="font-family: Times New Roman;"><span style="white-space: normal;">Compile And Install OpenSIPS" and press Enter. If everything goes well our opensips will be installed successfully. Follow the steps </span></span><span style="font-family: 'Times New Roman'; white-space: normal;">as mentioned in </span><a href="http://saevolgo.blogspot.com/2012/05/installing-opensips-on-ubuntu-server.html" style="font-family: 'Times New Roman'; white-space: normal;">this post</a> <span style="font-family: Times New Roman;"><span style="white-space: normal;">to setup the opensips LSB script (/etc/init.d/opensips); default opensips file; and creating the opensips DB. </span></span></pre>
<pre style="text-align: center;"><span style="font-family: Times New Roman;"><span style="white-space: normal;"><b>CASSANDRA INSTALLATION</b></span></span></pre>
The OpenSIPS installation process is complete till here, now take a look at the cassandra installation.<br />
<pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/apt/sources.list</span></pre>
Add the follwoing lines at the bottom of the apt/sources.list file.<br />
<pre><span style="font-family: 'Courier New', Courier, monospace; white-space: normal;">deb http://www.apache.org/dist/cassandra/debian 10x main
deb-src http://www.apache.org/dist/cassandra/debian 10x main</span></pre>
<pre><span style="font-family: Times New Roman;"><span style="white-space: normal;">Save and exit the file. and run apt-get update.</span></span></pre>
<pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># apt-get update</span></pre>
<pre><span style="font-family: Times New Roman;"><span style="white-space: normal;">If any keys error is encountered at the update then we need to add the keys using following command. (<i>Make sure to change the '4BD736A82B5C1B00</i></span></span><span style="font-family: 'Times New Roman'; white-space: normal;"><i>' string with the one you're seeing on your screen</i>)</span></pre>
<pre><pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#gpg --keyserver wwwkeys.pgp.net --recv-keys 4BD736A82B5C1B00</span>
<span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#gpg --export --armor 4BD736A82B5C1B00 | sudo apt-key add -</span></pre>
</pre>
Once the key is successfully added execute the apt-get update once again and after that install cassandra.
<br />
<pre style="line-height: normal;"><pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#apt-get install cassandra</span></pre>
</pre>
</div>
I highly recommend to go through the following links to get quick know how about cassandra working and its files.<br />
<pre><span style="font-family: Times New Roman;"><span style="white-space: normal;"><a href="http://www.datastax.com/docs/0.8/cluster_architecture/cluster_planning#node-init-config" target="_blank">Planning a Cassandra Cluster Deployment</a>
<a href="http://www.sinbadsoft.com/blog/cassandra-data-model-cheat-sheet/" style="font-family: 'Times New Roman'; white-space: normal;" target="_blank">Cassandra’s data model cheat sheet</a>
<a href="http://www.datastax.com/docs/0.8/configuration/node_configuration#init-properties" target="_blank">Node and Cluster Configuration (cassandra.yaml)</a>
<a href="http://www.datastax.com/docs/0.8/install/cluster_init" target="_blank">Configuring and Starting a Cassandra Cluster</a></span></span></pre>
<pre><span style="font-family: Times New Roman; white-space: normal;">Edit the </span><span style="font-family: Courier New, Courier, monospace; white-space: normal;">/etc/init.d/cassandra.yaml</span><span style="font-family: Times New Roman; white-space: normal;"> file and change the cluster name and any other property as needed. Start cassandra and verify that it is running in processes.
I edited the following:</span></pre>
<pre><span style="white-space: normal;"><span style="font-family: Courier New, Courier, monospace;">listen_address: 192.168.56.3
broadcast_address: 192.168.56.255
rpc_address: 0.0.0.0
rpc_port: 9160</span></span></pre>
<pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim /etc/cassandra/cassandra.yaml</span></pre>
<pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#/etc/init.d/cassandra start</span>
<span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#ps -ef | grep cass</span></pre>
<pre style="line-height: normal;"><span style="font-family: Times New Roman;"><span style="white-space: normal;">If cassandra has started successfully then connect to cassandra-cli and creake a keyspace for opensips to use.</span></span></pre>
<pre><pre><span style="color: white;">root@CAS-N1:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cassandra-cli --host 192.168.56.3 --port 9160</span></pre>
<pre><span style="background-color: #0f140f;"><span style="color: lime;"><i>Connected to: "Test Cluster" on 192.168.56.3/9160
Welcome to Cassandra CLI version 1.0.12
Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.
[default@unknown]</i></span></span><i><span style="color: magenta;">CREATE KEYSPACE opensips WITH placement_strategy = 'SimpleStrategy' AND strategy_options = {replication_factor:2}; </span></i></pre>
<pre><span style="color: magenta;"><i>a43901e0-6263-11e2-0000-af8ddedd2ed7
Waiting for schema agreement...
... schemas agree across the cluster</i></span></pre>
<pre><span style="background-color: #0f140f;"><span style="color: lime;"><i>[default@unknown]</i></span></span><i><span style="color: magenta;">quit;</span></i></pre>
<pre></pre>
<pre style="text-align: center;"><span style="font-family: Times New Roman;"><b>OPENSIPS CONFIGURATIONS FOR CASSANDRA</b></span></pre>
Now, everything is ready. Time to open up the opensips configurations file and load the module for cassandra.
<pre><pre><span style="color: white;">root@OpenSIPS-CAS:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># vim /etc/opensips/opensips.cfg</span></pre>
</pre>
<pre><span style="font-family: Courier New, Courier, monospace; font-size: x-small; white-space: normal;">loadmodule "cachedb_cassandra.so"
modparam("cachedb_cassandra", "cachedb_url","cassandra:group1://192.168.56.3:9160/opensips_cdrs")
modparam("cachedb_cassandra", "connection_timeout",1000)
modparam("cachedb_cassandra", "send_timeout",1000)
modparam("cachedb_cassandra", "receive_timeout",1000)
modparam("cachedb_cassandra", "wr_consistency_level",1)
modparam("cachedb_cassandra", "rd_consistency_level",1)</span></pre>
<pre><span style="white-space: normal;">Go throught the <a href="http://www.opensips.org/html/docs/modules/1.8.x/cachedb_cassandra.html" target="_blank">OpenSIPS Cassandra module documentation</a>; we can start using Cassandra as our KVP backend by using the following commands in our opensips.cfg main route;</span></pre>
<pre><span style="font-family: Courier New, Courier, monospace;">cache_store("cassandra:group1","key","$ru value")
cache_fetch("cassandra:cluster1","key",$avp(10))
cache_remove("cassandra:cluster1","key");
</span></pre>
</pre>
<pre><span style="white-space: normal;">That is all , now its upto users to take advantage from this according to their needs.
Thanks for reading.
</span></pre>
<pre><span style="white-space: normal;">
</span></pre>
<pre><b style="white-space: normal;"><u>Reference URLS:</u></b></pre>
<pre><span style="white-space: normal;"><pre><span style="white-space: normal;">http://wiki.apache.org/cassandra/GettingStarted</span></pre>
<pre><span style="white-space: normal;">http://www.opensips.org/html/docs/modules/1.8.x/cachedb_cassandra.html</span></pre>
<pre><span style="white-space: normal;">http://wiki.apache.org/cassandra/Operations</span></pre>
<pre><span style="white-space: normal;">http://www.sinbadsoft.com/blog/cassandra-data-model-cheat-sheet/</span></pre>
<pre><span style="white-space: normal;">http://news.ycombinator.com/item?id=1244914</span></pre>
<pre><span style="white-space: normal;">http://www.datastax.com/docs/0.8/configuration/node_configuration#init-properties</span></pre>
<pre><span style="white-space: normal;">http://www.datastax.com/docs/0.8/install/cluster_init</span></pre>
<pre><span style="white-space: normal;">http://www.datastax.com/docs/0.8/cluster_architecture/cluster_planning#node-init-config</span></pre>
<pre><span style="white-space: normal;">http://www.datastax.com/docs/1.0/ddl/keyspaces</span></pre>
<pre><span style="white-space: normal;">http://wiki.apache.org/cassandra/FAQ#clustername_mismatch</span></pre>
<pre><span style="white-space: normal;">http://lzyeval.blogspot.com/2012/02/install-cassandra-in-debian-ubuntu.html</span></pre>
</span></pre>
<pre></pre>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com6tag:blogger.com,1999:blog-7979378259821020425.post-22566912364605822262012-12-15T14:26:00.001-08:002012-12-15T14:26:36.913-08:00Call Center Solution : Techincal Review<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
Technical Review<br /><span style="font-size: x-large;">Hosted Call Center Solution</span><br /><span style="font-weight: normal;"><span style="font-size: x-small;">(by Tech Bridge Consultancy)</span></span></h2>
<div>
This is a technical review of a Hosted Call center solution which is an all in one stop for all the call center components required in any such setups. This is developed by my senior friends in my country and I think this product needs appreciation since this is one of a kind solution which is developed in my region for International users.</div>
<div>
<br /></div>
<div>
This hosted call center server is Linux based with Asterisk as its telephony back end and uses Microsoft Silverlight for its User Interfaces. </div>
<div>
<br /></div>
<div>
The most appealing features which I found are its sleek design and performance compared to other available products. It has a very rich feature set in both telephony as well as in CRM areas. </div>
<div>
<br /></div>
<div>
Focusing the VoIP component first, it has the ability to run multiple clients with multiple campaigns in parallel and each campaign can have as many agents and super agents as needed. The agents need not to be using SIP phones, the calls can be routed to agents using cellular or regular land lines via client specified gateway. </div>
<div>
<br /></div>
<div>
Another big feature is its Predictive Autodialer which calculates the campaign agents available and trigger outbound calls. We can set outbound Caller ID for campaigns too. What I liked most about it is the availability of designing a custom IVR tree such that as soon as any autodialed caller answers it can get landed on the IVR and then can proceed by going into any category i.e press 1 for maintenance, 2 for operations..etc. This can be pretty handy to sort down the responses and areas where most of the campaign callers went.</div>
<div>
<br /></div>
<div>
Other features include Voicemails and its beautiful interface to listen to the recorded messages, Live calls super agent panel, live call monitoring, and Real Time Call Data Records. </div>
<div>
<br /></div>
<div>
<div>
<br />
<div style="text-align: center;">
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="356" marginheight="0" marginwidth="0" mozallowfullscreen="mozallowfullscreen" scrolling="no" src="http://www.slideshare.net/slideshow/embed_code/15652859" style="border-width: 1px 1px 0; border: 1px solid #CCC; margin-bottom: 5px;" webkitallowfullscreen="webkitallowfullscreen" width="427"> </iframe> </div>
<div style="margin-bottom: 5px;">
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
</div>
The other major component which can not be ignored here is its GUI, where we can manage our everything, collect reports, schedule meetings, manage leads and so on.<br />
<div>
<br /></div>
<br />
<div style="text-align: left;">
From Call Center point of view we can have super agents/supervisors and regular call center agents. Agents can be assigned priority according to their skill. There is ofcourse an in build Softphone in the GUI and a notification pop ups for each incoming call. Yes, only privileged agents can make outbound calls and regular agents can only receive calls. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Agents can drag and drop schedule meetups for the mature leads. There is a very powerful utility available for managers to collect all campaigns statistics for analysis. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Like any other competing solution they've focused necessarily on reporting and a very strong reporting is made available for administrators and super agents. </div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-1ltA6pMuBrc/UMz2F0Gv1GI/AAAAAAAAAMY/HfcFTDs4_6I/s1600/TBC-HCCS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="238" src="http://2.bp.blogspot.com/-1ltA6pMuBrc/UMz2F0Gv1GI/AAAAAAAAAMY/HfcFTDs4_6I/s320/TBC-HCCS.png" width="320" /></a></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The above screenshot explains the reporting features. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
From my personal experience this application is quite wonderful and works perfectly for any required customer services solution. Inbuilt Predictive Dialer, custome IVR building, Agent management, Agent performance monitoring, campaign reporting is all that one can wish for in this category. More than anything with simple addition of powerful proxy like OpenSIPS or Kamailio it can be scaled horizontally and handle as many concurrent calls as needed.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
I wish my friend best of luck for this product and hope they keep up doing this good professional work in the world of VoIP.</div>
</div>
</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com4tag:blogger.com,1999:blog-7979378259821020425.post-73098984095312743432012-10-21T01:45:00.001-07:002012-10-21T01:45:29.875-07:00Linux Security - Am I Genius ?<div dir="ltr" style="text-align: left;" trbidi="on">
This is pretty basic stuff to start securing the Linux servers. The basic concept is to allow only the required ports and block everything else out.<br />
I recently started working on my new <a href="http://saevolgo.blogspot.com/2012/10/hosted-pbx-using-freeswitch.html">personal Hosted PBX project</a> and for that I got a new VPS. So the very first thing I wanted to do was secure my server from any hankers. My server has two interfaces. One interface assigned physically Public IP on it and other on LAN IP. The only access point inside my two/four server zone is this servers WAN interface (eth0)<br />
<br />
Without wasting more time on this, here are the lines which I executed.<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -m state --state ESTABLISHED -j ACCEPT</span></pre>
<br />
Allow anything that is in ESTABLISHED (already in progress) state.<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -p icmp --icmp-type echo-request -j DROP</span></pre>
Silently drop incoming ICMP ping requests.Don't let the Auto-scan-bots think that my IP is reachable.<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT</span></pre>
<br />
Allow SSH port into the system.<br />
<br />
NOTE: I highly recommend to change the default SSH port to something other than 22. This reduces the Brute force dictionary attacks by 90+% - As an examples I mostly use 3132 or 5152 or 7172 ports for SSH<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT</span></pre>
<br />
Allow any more ports if required - HTTP port 80 in my case.<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -p udp --dport 5060 -j ACCEPT</span></pre>
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -p udp --dport 10000:40000 -j ACCEPT</span></pre>
Since I need to work on SIP/5060 and RTP/10000:40000 so I also allowed the port(s)<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">[root@HBPBX</span> <span style="color: white;">scripts]</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># iptables -A INPUT -i eth0 -j REJECT</span></pre>
<div>
This is the Main line - Block everything else out.<br />
<br />
Security is a Huge HUGE domain in itself and by no means I've done any justice to that topic here. There are many things left out which needs attention before considering somewhat secure.<br />
<br />
<h3 style="text-align: center;">
<b>To Be or Not to be a "Genius"</b></h3>
<br />
Make Sure you don't fall into the "Genius" Category like the following.<br />
<br />
Not protecting the server at all. Top of the charts Genius.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-EqYC8pB5_yk/UIOz3cY2szI/AAAAAAAAAJw/ZUQdD3ycssE/s1600/GC9vRCTDc9g.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="260" src="http://2.bp.blogspot.com/-EqYC8pB5_yk/UIOz3cY2szI/AAAAAAAAAJw/ZUQdD3ycssE/s320/GC9vRCTDc9g.jpg" width="320" /></a></div>
<br />
Or someone like this: Totally blocking everything and hence losing all access.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-vSj2lY7NVeY/UIO0Cr2e3uI/AAAAAAAAAJ4/1HO21sOx6Pc/s1600/4543877_700b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://2.bp.blogspot.com/-vSj2lY7NVeY/UIO0Cr2e3uI/AAAAAAAAAJ4/1HO21sOx6Pc/s320/4543877_700b.jpg" width="212" /></a></div>
<br />
I'd rather be somewhat Genius and suggest something like this for myself :<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ODE86YmwO7k/UIO0UiV4q-I/AAAAAAAAAKA/Ye819m0v-Ww/s1600/fendce-genius.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-ODE86YmwO7k/UIO0UiV4q-I/AAAAAAAAAKA/Ye819m0v-Ww/s320/fendce-genius.jpeg" width="204" /></a></div>
<br />
Hope you guys enjoyed this quick blog.<br />
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-5382279019691910842012-10-20T04:31:00.000-07:002012-10-20T04:31:22.638-07:00Hosted PBX using FreeSWITCH<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="text-align: center;">
"Reinventing the Wheel" </h2>
<div style="text-align: center;">
Only according to my requirements</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Though I've made almost two Hosted PBXs and couple of projects with Hosted IVR but those were golden Asterisk times and I feel like I haven't done anything big yet. This time I am fully occupied in my official activities and yet to get the most out of me I'm starting to convert my Hosted PBX solution from Asterisk to FreeSWITCH. Not to mention that the Autodialer using FreeSWITCH I made recently was a big accomplishment and worked flawlessly which gave me motivation for this. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
That Autodialer consisted of FreeSWITCH, Lua, Perl, MySQL, and Redis. It inspired me to do more but I was somewhat less busy to think of something like this current Project.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Starting with a quick overview. The ideal Hosted PBX should have these characteristics from developers point of view:</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>1- Scaleable</b> [Extend, Expand, Integrate easily and quickly]</div>
<div style="text-align: left;">
The structure should be easy to expand as in hardware and extend as in software. Both ways should be easy to integrate with the ongoing structure. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<u>In HostedPBX Context:</u> I should be able to add as many clients and resellers as I want, add more servers and new nodes into the system and increase my capacity. Any client should be able to use system provided ITSPs or add their own ITSP for their usage. Personally I Like the idea of pooling the services so at any given time adding anything to the pools add overall to the infrastructure. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>2- Performance</b> [Effective code and virtually least possible bottlenecks]</div>
<div style="text-align: left;">
Use as simple and as intelligently-lazy code as possible, find quick and easy ways to make a module for a particular feature but at the same time keeping in mind that it doesn't closes its doors for extension or integration with other modules/layers.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<u>In HostedPBX Context:</u><i> </i>Call processing should be as speedy as possible, nothing should keep the caller waiting - Anything thats behaviour of application is excluded from this i.e Queues, Conferences, PDD from Carriers. But there should be <u>no</u> PDD coming from withing the PBX - example a curl function that dumps/retrieves values from web server blocking the call from proceeding further.</div>
<div style="text-align: left;">
<u><br /></u></div>
<div style="text-align: left;">
<b>3- Accessibility</b> [ Ease of use for everyone]</div>
<div style="text-align: left;">
Everyone means everyone connected to it which includes developers, administrators, resellers, clients.Any functions/APIs or GUIs should be as easy to work with as possible.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<u>In HostedPBX Context:</u> Mostly clients and their usability should be given priority( GUI ), That doesn't mean that anything else should be ignored totally or given less preference. Internal code and infrastructure should be as much easily accessible to authenticated and authorized Engineers and admins.</div>
<div style="text-align: left;">
<u><br /></u></div>
<div style="text-align: left;">
<b>4- Reliable and Secure</b> [Fail & Fool proof structure]</div>
<div style="text-align: left;">
Failure to any one or at max up to three nodes, services, providers, or links should not effect overall system. This reliability should be increased with introduction of more Hardware/Software code keeping point-1 and point-2 in mind. At any given time at any layer should be any single point of failure be it a DNS provider, power services provider, internet services provider, or any software application/tool.</div>
<div style="text-align: left;">
<u><br /></u></div>
<div style="text-align: left;">
<u>In HostedPBX Context:</u> Everything should've atleast one backup node, every layer should has its own security mechanism. An IVR with infinite input timeout is as dangerous to service as a less secure SIP extensions password. In any case its a loss to revenue for all the parties involved with the service. Failure to SIP Inbound SBC or REGISTRAR server should be invisible to users.</div>
<div style="text-align: left;">
<u><br /></u></div>
<div style="text-align: left;">
<b>5- Customizable</b> [Add/remove modules(features) with less pain]</div>
<div style="text-align: left;">
Keeping point-3 in mind the structure and the programming used should've always interaction points to be used by any other module in the structure. If Point-3 is not ignored then the customization will come easy as cake. Point-1 Provides basic rule of thumb to design the project as to facilitate the extension in code or feature set.</div>
<div style="text-align: left;">
<u><br /></u></div>
<div style="text-align: left;">
<u>In HostedPBX Context:</u> Adding new features or altering GUI menus must be able to fit easily into the structure. Collect values from anywhere from the system and use it accordingly.</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: center;">
<b><u>Expected Tools</u></b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Keeping my own expertise in mind, what I can tell at the moment which I can do on my own is use the following tools to design the PBX</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
1- OpenSIPS 1- Kamailio</div>
<div style="text-align: left;">
2- FreeRADIUS 3- FreeSWITCH + SEMS + SylkServer</div>
<div style="text-align: left;">
4- Languages: Perl, Lua, PHP 5- Redis or Cassandra</div>
<div style="text-align: left;">
6- MySQL 7- Vyatta</div>
<div style="text-align: left;">
8- DNS(BIND) Server 9- MediaProxy + RTPproxy</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Since I'm strictly not a Web devel so :( unfortunately can't tell how and when it can be developed. Since its a personal project so I dont know if this area will be constructed or not. Wish I'd done some web development courses while I was doing summer semesters in university :D</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: center;">
<b><u>Initially Expected Features</u></b></div>
<div style="text-align: center;">
<b><br /></b></div>
<div style="text-align: left;">
Most of these are almost the same features I've created before,so this time its just conversion from Asteriks code to FreeSWITCH code but obviously keeping in mind the new development style.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>Multi-Domain Clients provisioning DID provisioning</b></div>
<div style="text-align: left;">
<b>ACL Manager</b> <span style="font-size: x-small;">(for Any Secret IVR Menu/App) </span> <b>Click to Dial</b></div>
<div style="text-align: left;">
<b>Call Limits(Minutes/Concurrent Calls) AutoDialer</b></div>
<div style="text-align: left;">
<b>Billing for Outbound Calls CDRs</b></div>
<div style="text-align: left;">
<b>Multiple IVR creation Incoming Call Settings</b></div>
<div style="text-align: left;">
<b>Call Recordings DISA service</b></div>
<div style="text-align: left;">
<b>Custom SIP Trunk Features Permissions</b></div>
<div style="text-align: left;">
<b>IM/Chat and Presence</b></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<b>N x N level IVR tree creation [ Using combination of the following applications ]</b></div>
<div style="text-align: left;">
Time Conditions Announcements/Play Sounds</div>
<div style="text-align: left;">
Queues Follow Me / Call Forwarding</div>
<div style="text-align: left;">
Outbound Caller ID Set[Client's DID or Custom ] Voicemails</div>
<div style="text-align: left;">
ACL Conferences </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
</div>
<div style="text-align: center;">
<b><u>Ultimate Ideal to Follow</u></b></div>
<div style="text-align: center;">
<b><u><br /></u></b></div>
Though there are so many Hosted/Virtual PBX out on internet, but one of my ideal is one by <a href="http://www.2600hz.org/index.html">2600 Hz</a> - though too much to commit but the feature list should be some what a subset of this <a href="http://www.2600hz.com/features.html">feature list</a>. Also I think this new <a href="https://2600hz.atlassian.net/wiki/pages/viewpage.action?pageId=4194306">Kazoo</a> project by 2600 Hz is brilliant and amazing to learn from. <a href="http://www.onsip.com/features">On SIP</a> is another beautiful and inspiring source for me.<br />
<br />
I can't obviously compare individual myself to the experts and senior team behind the 2600 Hz project or On SIP but atleast I can follow how their wheel looks like and give mine a shape.<br />
<br />
<br />
Thats all I had in mind for my little home project. Hope to keep up my timelines and come up with something good.<br />
<div>
<br /></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<br />
<div style="text-align: left;">
<span style="font-size: x-small;"><b>Disclaimer:</b> The primary purpose of this post was to get ideas and suggestions as to what and how should the Hosted/Virtual PBX based on FreeSWITCH should look like. This is my personal attempt and so far no other developer or resource has been added to the pool yet ;)</span></div>
<div style="text-align: left;">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com3tag:blogger.com,1999:blog-7979378259821020425.post-78875956372006082182012-09-12T04:42:00.000-07:002012-09-14T22:54:35.808-07:00OpenSIPS Monitoring using SNMP [ Part-I ]<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<span style="font-size: x-large;">OpenSIPS Monitoring </span></div>
<div style="text-align: center;">
<span style="font-size: large;">using SNMP</span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
This is once again a little personal development project on creating a VoIP Monitoring server capable of displaying stats from all the VoIP tools we've ever deployed and used in our company. I want to make a monitoring server which will publish stats from OpenSIPS, Kamailio, FreeSwitch, and Asterisk servers all at one place. </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The very first thing one should focus on for any project like this should be the choice of monitoring tool, this is critical because it gets really hard at some later stage to switch to any other NMS. I had a good experience with Zabbix and knew the flexibility and options available in this tool so I used Zabbix.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In this post I'll just focus on collecting stats from the OpenSIPS server, rest of the applications are just the same steps.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Installation of zabbix can be another post and I don't really want to make this a huge blog post now.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
One should have atleast a running opensips server and a zabbix server running.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The first way of asking OpenSIPS to start publishing monitoring data is useing the <a href="http://www.opensips.org/html/docs/modules/1.7.x/snmpstats.html#id248304">SNMPSTATS </a> module.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In your opensips.cfg file add these lines in appropriate sections.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">loadmodule "snmpstats.so"</span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: left;">
</div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">modparam("snmpstats", "sipEntityType", "registrarServer")</span><br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">modparam("snmpstats", "snmpgetPath", "/usr/bin/")</span><br />
<div>
<br /></div>
<div>
Next define a RO community in the snmpd.conf file (again assuming the snmpd is installed already and have all the MIBs) </div>
<div>
<br /></div>
<div>
my snmpd.conf file has just these lines.</div>
<div>
<br /></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">rocommunity voip_monitoring</span></div>
<div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">syslocation "VM, Virtual DataCenter"</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">syscontact govoiper@gmail.com</span></div>
</div>
<div>
<br /></div>
<div>
Then in <span style="font-family: Courier New, Courier, monospace;"><b>/etc/snmp/snmp.conf</b></span> file I've these lines only</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">defVersion 2c</span></div>
<div>
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">defCommunity voip_monitoring</span></div>
</div>
<div>
<br /></div>
<br />
<div style="text-align: left;">
Following line needs to be in the <b><span style="font-family: Courier New, Courier, monospace;">/etc/snmp/snmpstats.conf</span></b> file</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">agentXSocket tcp:localhost:705</span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">Next we need to copy the OPENSER-MIB files from the source installation directory to the default directory where all MIBs are place already.</span></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: inherit;">My default directory for all MIBs is </span><b><span style="font-family: Courier New, Courier, monospace;">/var/lib/mibs/ietf/</span></b></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: left;">
<br />
<div id="preview" style="background-color: transparent; color: #333333; font-family: Verdana, Helvetica, Arial, sans-serif; margin: auto 1em; padding-bottom: 3em;">
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; color: black; overflow: auto; width: auto;">
<pre style="line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cp /usr/src/opensips-1.7.2-tls/modules/snmpstats/mibs/* /var/lib/mibs/ietf/</span></pre>
</div>
</div>
</div>
<div style="text-align: left;">
The file <b><span style="font-family: Courier New, Courier, monospace;">/etc/default/snmpd</span></b> has following line edited as follows.<br />
<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">SNMPDOPTS=</span><span style="color: #0086d2;">'-x tcp:localhost:705 -Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'</span></pre>
<br />
<br /></div>
<div style="text-align: left;">
Restart opensips and snmpd services , if everything is started successfully verify that we can fetch SNMP values from the OpenSIPS.</div>
<div style="text-align: left;">
<br /></div>
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># snmpbulkwalk -v2c -Os -c voip_monitoring localhost OPENSER-REG-MIB::openser</span></pre>
<br />
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Showed a huge list of data: (<i>See end of page</i>)<br />
<br /></div>
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># snmpbulkwalk -O s -v 2c -c voip_monitoring localhost OPENSER-SIP-COMMON-MIB::openserSIPCommonObjects</span></pre>
<br />
<div>
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPProtocolVersion.0 = STRING: SIP/2.0</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPServiceStartTime.0 = Timeticks: (1308884) 3:38:08.84</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPEntityType.0 = BITS: 08 registrarServer(4)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPTransportRcv.ipv4."192.168.56.3".5060 = BITS: 40 udp(1)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.1 = STRING: METHOD_INVITE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.2 = STRING: METHOD_CANCEL</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.3 = STRING: METHOD_ACK</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.4 = STRING: METHOD_BYE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.5 = STRING: METHOD_INFO</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.7 = STRING: METHOD_UPDATE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.8 = STRING: METHOD_REGISTER</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.9 = STRING: METHOD_MESSAGE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.10 = STRING: METHOD_SUBSCRIBE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.11 = STRING: METHOD_NOTIFY</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.12 = STRING: METHOD_PRACK</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.13 = STRING: METHOD_REFER</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPMethodName.14 = STRING: METHOD_PUBLISH</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPSummaryInRequests.0 = Counter32: 496</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPSummaryOutRequests.0 = Counter32: 0</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPSummaryInResponses.0 = Counter32: 0</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPSummaryOutResponses.0 = Counter32: 26862</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPSummaryTotalTransactions.0 = Counter32: 26376</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPCurrentTransactions.0 = Gauge32: 8</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPNumUnsupportedUris.0 = Counter32: 0</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPNumUnsupportedMethods.0 = Counter32: 3</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">openserSIPOtherwiseDiscardedMsgs.0 = Counter32: 4</span><br />
<br />
<br />
<div>
Next Step is to collect the Full number OID of each interesting OID from above by using this command</div>
<div>
<br /></div>
<div>
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># snmptranslate -On OPENSER-SIP-COMMON-MIB::openserSIPNumUnsupportedMethods.0</span></pre>
</div>
<div>
<br /></div>
<div>
This resulted in a number like this:</div>
<div>
<br />
<b><span style="font-family: Courier New, Courier, monospace;">.1.3.6.1.4.1.27483.3.1.1.1.8.2.0</span></b></div>
<div>
<br /></div>
<div>
We will use the above number and its Key in Zabbix for plotting this Data later on.</div>
<div>
My output for SNMPD process listening on interfaces:<br />
<br />
<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># netstat -pln | grep snmp</span>
<span style="color: white;">tcp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">127.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.1</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">705</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: white;">LISTEN</span> <span style="color: #0086f7; font-weight: bold;">31456</span><span style="color: white;">/snmpd</span>
<span style="color: white;">udp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">161</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: #0086f7; font-weight: bold;">31456</span><span style="color: white;">/snmpd</span>
<span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span></pre>
<br />
<br />
<h4 style="text-align: left;">
Adding Host in Zabbix</h4>
Open the Zabbix web interface:<br />
<br />
Goto Configuration -> Hosts -> Create Host (Button on top right side)<br />
Add a SNMP interface, fill in the details accordingly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-YBSMm8INDdw/UE8AHz2u9GI/AAAAAAAAAIg/_Fozf9Zz8o4/s1600/Zabbix_add_Host.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="172" src="http://2.bp.blogspot.com/-YBSMm8INDdw/UE8AHz2u9GI/AAAAAAAAAIg/_Fozf9Zz8o4/s320/Zabbix_add_Host.jpg" width="320" /></a></div>
<br />
<br />
Once Host is created add a new monitoring "item" in that Host.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ZqFGzZNW8hU/UE8Hin_jhII/AAAAAAAAAIw/9z4Tlp-9DGs/s1600/Zabbix+Server++Configuration+of+items-143848.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/-ZqFGzZNW8hU/UE8Hin_jhII/AAAAAAAAAIw/9z4Tlp-9DGs/s320/Zabbix+Server++Configuration+of+items-143848.jpg" width="228" /></a></div>
<br />
SNMP module gives some very useful info but I wanted to find out if there is any other way to look more into the OpenSIPS.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-Ls4z0GpmyC4/UE83WFuYD6I/AAAAAAAAAJA/Q_G0iQVG6H8/s1600/Zabbix+Server++Custom+graphs+%5Brefreshed+every+30+sec+-180346.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="140" src="http://4.bp.blogspot.com/-Ls4z0GpmyC4/UE83WFuYD6I/AAAAAAAAAJA/Q_G0iQVG6H8/s320/Zabbix+Server++Custom+graphs+%5Brefreshed+every+30+sec+-180346.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SNMP Data Example Graph - SIP Request/Responses In/Out</td></tr>
</tbody></table>
<br />
See<a href="http://saevolgo.blogspot.com/2012/09/opensips-monitoring-using-mixmlrpc-part.html"> Next Part of this Post</a> using the MI_XMLRPC Module to collect more stats.<br />
<br />
Links Consulted:<br />
<br />
<a href="http://www.opensips.org/html/docs/modules/1.5.x/mi_xmlrpc.html#id228103">http://www.opensips.org/html/docs/modules/1.5.x/mi_xmlrpc.html#id228103</a>
<br />
<a href="http://www.opensips.org/html/docs/modules/1.7.x/snmpstats.html">http://www.opensips.org/html/docs/modules/1.7.x/snmpstats.html</a>
<br />
<a href="http://kamailio.org/docs/modules/1.3.x/snmpstats.html#AEN46">http://kamailio.org/docs/modules/1.3.x/snmpstats.html#AEN46</a>
<br />
<a href="http://www.opensips.org/Resources/DocsTipsFaqs#toc3">http://www.opensips.org/Resources/DocsTipsFaqs#toc3</a>
<br />
<a href="http://remarks.peurat.net/integrating-opensips-and-cacti-using-xmlrpc/">http://remarks.peurat.net/integrating-opensips-and-cacti-using-xmlrpc/</a><br />
<a href="http://www.personal.psu.edu/sus21/blogs/sven/2009/10/configuring-snmpstats-for-kamailio-openser.html">http://www.personal.psu.edu/sus21/blogs/sven/2009/10/configuring-snmpstats-for-kamailio-openser.html</a>
<br />
<a href="http://sysadvent.blogspot.com/2008/12/day-4-extending-net-snmps-snmpd.html">http://sysadvent.blogspot.com/2008/12/day-4-extending-net-snmps-snmpd.html</a>
<br />
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<a name='more'></a><div>
------------------------------------------------------------------------------------------------------------</div>
<div>
<br />
root@opensips-1:~#snmpbulkwalk -v 2c -c public localhost OPENSER-MIB::openserDialog<br />
<br />
<br />
OPENSER-MIB::openserCurNumDialogs.0 = Gauge32: 0<br />
OPENSER-MIB::openserCurNumDialogsInProgress.0 = Gauge32: 0<br />
OPENSER-MIB::openserCurNumDialogsInSetup.0 = Gauge32: 0<br />
OPENSER-MIB::openserTotalNumFailedDialogSetups.0 = Counter32: 0<br />
OPENSER-MIB::openserDialogLimitMinorThreshold.0 = INTEGER: -1<br />
OPENSER-MIB::openserDialogLimitMajorThreshold.0 = INTEGER: -1<br />
OPENSER-MIB::openserDialogUsageState.0 = INTEGER: idle(0)<br />
OPENSER-MIB::openserDialogLimitAlarmStatus.0 = BITS: 00<br />
OPENSER-MIB::openserDialogLimitMinorAlarm.0 = INTEGER: clear(0)<br />
OPENSER-MIB::openserDialogLimitMajorAlarm.0 = INTEGER: clear(0)</div>
<div>
<br /></div>
<div>
root@opensips-1:/var/lib/mibs/ietf# snmpbulkwalk -v2c -Os -c public localhost OPENSER-REG-MIB::openser</div>
<div>
openserSIPCommonMIB.1.1.1.0 = STRING: "SIP/2.0"</div>
<div>
openserSIPCommonMIB.1.1.2.0 = Timeticks: (1308884) 3:38:08.84</div>
<div>
openserSIPCommonMIB.1.1.4.0 = Hex-STRING: 08</div>
<div>
openserSIPCommonMIB.1.1.5.1.4.1.4.192.168.56.3.5060 = STRING: "@"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.1 = STRING: "METHOD_INVITE"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.2 = STRING: "METHOD_CANCEL"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.3 = STRING: "METHOD_ACK"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.4 = STRING: "METHOD_BYE"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.5 = STRING: "METHOD_INFO"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.7 = STRING: "METHOD_UPDATE"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.8 = STRING: "METHOD_REGISTER"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.9 = STRING: "METHOD_MESSAGE"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.10 = STRING: "METHOD_SUBSCRIBE"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.11 = STRING: "METHOD_NOTIFY"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.12 = STRING: "METHOD_PRACK"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.13 = STRING: "METHOD_REFER"</div>
<div>
openserSIPCommonMIB.1.1.7.1.2.14 = STRING: "METHOD_PUBLISH"</div>
<div>
openserSIPCommonMIB.1.3.1.0 = Counter32: 500</div>
<div>
openserSIPCommonMIB.1.3.2.0 = Counter32: 0</div>
<div>
openserSIPCommonMIB.1.3.3.0 = Counter32: 0</div>
<div>
openserSIPCommonMIB.1.3.4.0 = Counter32: 27438</div>
<div>
openserSIPCommonMIB.1.3.5.0 = Counter32: 26948</div>
<div>
openserSIPCommonMIB.1.6.1.0 = Gauge32: 6</div>
<div>
openserSIPCommonMIB.1.8.1.0 = Counter32: 0</div>
<div>
openserSIPCommonMIB.1.8.2.0 = Counter32: 3</div>
<div>
openserSIPCommonMIB.1.8.3.0 = Counter32: 4</div>
<div>
openserSIPServerMIB.1.3.1.0 = INTEGER: 3</div>
<div>
openserSIPServerMIB.1.3.3.0 = INTEGER: 1</div>
<div>
openserSIPServerMIB.1.3.4.0 = STRING: " "</div>
<div>
openserSIPServerMIB.1.4.1.0 = Counter32: 0</div>
<div>
openserSIPServerMIB.1.5.2.0 = Gauge32: 0</div>
<div>
openserSIPServerMIB.1.5.3.0 = Gauge32: 4294967295</div>
<div>
openserSIPServerMIB.1.5.4.0 = Gauge32: 1</div>
<div>
openserSIPServerMIB.1.5.5.0 = Gauge32: 3600</div>
<div>
openserSIPServerMIB.1.5.6.1.2.1 = STRING: "DefaultUser"</div>
<div>
openserSIPServerMIB.1.5.6.1.2.16 = STRING: "40277@192.168.56.3"</div>
<div>
openserSIPServerMIB.1.5.6.1.3.1 = Counter32: 0</div>
<div>
openserSIPServerMIB.1.5.6.1.3.16 = Counter32: 0</div>
<div>
openserSIPServerMIB.1.5.7.1.2.1.1 = STRING: "DefaultUser"</div>
<div>
openserSIPServerMIB.1.5.7.1.2.16.1 = STRING: "sip:40277@192.168.82.5:6074"</div>
<div>
openserSIPServerMIB.1.5.7.1.2.16.3 = STRING: "sip:40277@192.168.56.1:65118;rinstance=840080c63710e46b"</div>
<div>
openserSIPServerMIB.1.5.7.1.3.1.1 = STRING: "DefaultUser"</div>
<div>
openserSIPServerMIB.1.5.7.1.3.16.1 = STRING: "sip:40277@192.168.82.5:6074"</div>
<div>
openserSIPServerMIB.1.5.7.1.3.16.3 = STRING: "sip:40277@192.168.56.1:65118;rinstance=840080c63710e46b"</div>
<div>
openserSIPServerMIB.1.5.7.1.4.1.1 = Hex-STRING: 00 00 00 00 00 00 00 00</div>
<div>
openserSIPServerMIB.1.5.7.1.4.16.1 = Hex-STRING: 07 DC 09 07 0F 12 0F 00</div>
<div>
openserSIPServerMIB.1.5.7.1.4.16.3 = Hex-STRING: 07 DC 09 07 0F 10 3B 00</div>
<div>
openserSIPServerMIB.1.5.7.1.5.1.1 = Hex-STRING: 00 00 00 00 00 00 00 00</div>
<div>
openserSIPServerMIB.1.5.7.1.5.16.1 = Hex-STRING: 07 DC 09 07 10 12 0F 00</div>
<div>
openserSIPServerMIB.1.5.7.1.5.16.3 = Hex-STRING: 07 DC 09 07 10 10 3B 00</div>
<div>
openserSIPServerMIB.1.5.7.1.6.1.1 = STRING: "-0.01"</div>
<div>
openserSIPServerMIB.1.5.7.1.6.16.1 = STRING: "-0.01"</div>
<div>
openserSIPServerMIB.1.5.7.1.6.16.3 = STRING: "-0.01"</div>
<div>
openserSIPServerMIB.1.5.8.0 = Counter32: 68</div>
<div>
openserSIPServerMIB.1.6.1.0 = Counter32: 240</div>
<div>
openserSIPServerMIB.1.6.2.0 = Counter32: 0</div>
<div>
openserMIB.1.2.3.1.0 = Gauge32: 0</div>
<div>
openserMIB.1.2.3.2.0 = INTEGER: -1</div>
<div>
openserMIB.1.2.3.3.0 = INTEGER: -1</div>
<div>
openserMIB.1.2.4.1.0 = Hex-STRING: 00</div>
<div>
openserMIB.1.2.4.2.0 = INTEGER: 0</div>
<div>
openserMIB.1.2.4.3.0 = INTEGER: 0</div>
<div>
openserMIB.1.3.2.1.0 = Gauge32: 0</div>
<div>
openserMIB.1.3.2.2.0 = Gauge32: 0</div>
<div>
openserMIB.1.3.2.3.0 = Gauge32: 0</div>
<div>
openserMIB.1.3.2.4.0 = Counter32: 0</div>
<div>
openserMIB.1.3.2.5.0 = INTEGER: -1</div>
<div>
openserMIB.1.3.2.6.0 = INTEGER: -1</div>
<div>
openserMIB.1.3.3.1.0 = INTEGER: 0</div>
<div>
openserMIB.1.3.4.1.0 = Hex-STRING: 00</div>
<div>
openserMIB.1.3.4.2.0 = INTEGER: 0</div>
<div>
openserMIB.1.3.4.3.0 = INTEGER: 0</div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
root@opensips-1:/var/lib/mibs/ietf# snmpbulkwalk -O s -v 2c -c public localhost OPENSER-SIP-SERVER-MIB::openserSIPServerObjects<br />
openserSIPProxyStatefulness.0 = INTEGER: callStateful(3)<br />
openserSIPProxyRecordRoute.0 = INTEGER: true(1)<br />
openserSIPProxyAuthMethod.0 = BITS: 20 digest(2)<br />
openserSIPNumProxyRequireFailures.0 = Counter32: 0<br />
openserSIPRegMaxContactExpiryDuration.0 = Gauge32: 0 seconds<br />
openserSIPRegMaxUsers.0 = Gauge32: 4294967295<br />
openserSIPRegCurrentUsers.0 = Gauge32: 1<br />
openserSIPRegDfltRegActiveInterval.0 = Gauge32: 3600 seconds<br />
openserSIPUserUri.1 = STRING: DefaultUser<br />
openserSIPUserUri.16 = STRING: 40277@192.168.56.3<br />
openserSIPUserAuthenticationFailures.1 = Counter32: 0<br />
openserSIPUserAuthenticationFailures.16 = Counter32: 0<br />
openserSIPContactDisplayName.1.1 = STRING: DefaultUser<br />
openserSIPContactDisplayName.16.1 = STRING: sip:40277@192.168.82.5:6074<br />
openserSIPContactDisplayName.16.3 = STRING: sip:40277@192.168.56.1:65118;rinstance=840080c63710e46b<br />
openserSIPContactURI.1.1 = STRING: DefaultUser<br />
openserSIPContactURI.16.1 = STRING: sip:40277@192.168.82.5:6074<br />
openserSIPContactURI.16.3 = STRING: sip:40277@192.168.56.1:65118;rinstance=840080c63710e46b<br />
openserSIPContactLastUpdated.1.1 = STRING: 0-0-0,0:0:0.0<br />
openserSIPContactLastUpdated.16.1 = STRING: 2012-9-7,14:35:52.0<br />
openserSIPContactLastUpdated.16.3 = STRING: 2012-9-7,14:22:58.0<br />
openserSIPContactExpiry.1.1 = STRING: 0-0-0,0:0:0.0<br />
openserSIPContactExpiry.16.1 = STRING: 2012-9-7,15:35:52.0<br />
openserSIPContactExpiry.16.3 = STRING: 2012-9-7,15:22:58.0<br />
openserSIPContactPreference.1.1 = STRING: -0.01<br />
openserSIPContactPreference.16.1 = STRING: -0.01<br />
openserSIPContactPreference.16.3 = STRING: -0.01<br />
openserSIPRegUserLookupCounter.0 = Counter32: 66<br />
openserSIPRegAcceptedRegistrations.0 = Counter32: 238<br />
openserSIPRegRejectedRegistrations.0 = Counter32: 0</div>
</div>
</div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com2tag:blogger.com,1999:blog-7979378259821020425.post-75492371409099215742012-09-12T01:54:00.000-07:002012-09-14T06:26:27.393-07:00OpenSIPS Monitoring using MI_XMLRPC [ Part-II ]<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="text-align: center;">
<span style="font-size: x-large;">OpenSIPS Monitoring </span></div>
<div style="text-align: center;">
<span style="font-size: large;">using <a href="http://www.opensips.org/html/docs/modules/1.8.x/mi_xmlrpc.html">MI_XMLRPC</a></span><br />
<br /></div>
<br />
To monitor stats from OpenSIPS there can be more possible ways than just using the SNMP module.One of them is using the MI_XMLRPC module.I found this from this post:<br />
<a href="http://remarks.peurat.net/integrating-opensips-and-cacti-using-xmlrpc/">http://remarks.peurat.net/integrating-opensips-and-cacti-using-xmlrpc/</a><br />
<br />
That gave me an inspiration to add more things into my monitoring and so I found out a very simple script which sends MI_XML request to opensips and returns data back.<br />
<br />
<a href="http://www.opensips.org/Resources/DocsTipsFaqs#toc3">http://www.opensips.org/Resources/DocsTipsFaqs#toc3</a><br />
<br />
Taking the example code from the above URL - I added few lines on top to query more modules and return output in numbers only.<br />
<br />
<pre style="background-color: transparent; line-height: 16px;">#!/usr/bin/php
<span style="color: #007020;"><?php</span>
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"core:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"net:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"pkmem:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"tm:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"sl:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"shmem:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"dialog:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"usrloc:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"registrar:"</span>;
<span style="color: #bb60d5;">$params</span>[] <span style="color: #666666;">=</span> <span style="color: #4070a0;">"usr:"</span>;
<span style="color: #bb60d5;">$method</span> <span style="color: #666666;">=</span> <span style="color: #4070a0;">"get_statistics"</span>;
<span style="color: #bb60d5;">$request</span> <span style="color: #666666;">=</span> <span style="color: #007020;">xmlrpc_encode_request</span>(<span style="color: #bb60d5;">$method</span>,<span style="color: #bb60d5;">$params</span>);
<span style="color: #bb60d5;">$context</span> <span style="color: #666666;">=</span> <span style="color: #007020;">stream_context_create</span>(<span style="color: #007020; font-weight: bold;">array</span>(<span style="color: #4070a0;">'http'</span> <span style="color: #666666;">=></span> <span style="color: #007020; font-weight: bold;">array</span>(
<span style="color: #4070a0;">'method'</span> <span style="color: #666666;">=></span> <span style="color: #4070a0;">"POST"</span>,
<span style="color: #4070a0;">'header'</span> <span style="color: #666666;">=></span> <span style="color: #4070a0;">"Content-Type: text/xml"</span>,
<span style="color: #4070a0;">'content'</span> <span style="color: #666666;">=></span> <span style="color: #bb60d5;">$request</span>
)));
<span style="color: #bb60d5;">$file</span> <span style="color: #666666;">=</span> <span style="color: #007020;">file_get_contents</span>(<span style="color: #4070a0;">"http://127.0.0.1:8000/RPC2"</span>, <span style="color: #007020; font-weight: bold;">false</span>, <span style="color: #bb60d5;">$context</span>);
<span style="color: #bb60d5;">$response</span> <span style="color: #666666;">=</span> <span style="color: #007020;">xmlrpc_decode</span>(<span style="color: #bb60d5;">$file</span>);
<span style="color: #007020; font-weight: bold;">if</span> (<span style="color: #007020;">is_array</span>(<span style="color: #bb60d5;">$response</span>)) {
<span style="color: #007020;">trigger_error</span>(<span style="color: #4070a0;">"xmlrpc: </span><span style="color: #70a0d0; font-style: italic;">$response[faultString]</span><span style="color: #4070a0;"> (</span><span style="color: #70a0d0; font-style: italic;">$response[faultCode]</span><span style="color: #4070a0;">)"</span>);
} <span style="color: #007020; font-weight: bold;">else</span> {
<span style="color: #bb60d5;">$response</span> <span style="color: #666666;">=</span> <span style="color: #007020;">str_replace</span>(<span style="color: #bb60d5;">$params</span>,<span style="color: #4070a0;">""</span>,<span style="color: #bb60d5;">$response</span>);
<span style="color: #bb60d5;">$response</span> <span style="color: #666666;">=</span> <span style="color: #007020;">str_replace</span>(<span style="color: #4070a0;">":"</span>, <span style="color: #4070a0;">""</span>, <span style="color: #bb60d5;">$response</span>);
<span style="color: #bb60d5;">$response</span> <span style="color: #666666;">=</span> <span style="color: #007020;">str_replace</span>(<span style="color: #4070a0;">" = "</span>, <span style="color: #4070a0;">":"</span>, <span style="color: #bb60d5;">$response</span>);
<span style="color: #60a0b0; font-style: italic;">//$response = str_replace("\n", " ", $response);</span>
<span style="color: #bb60d5;">$pieces</span> <span style="color: #666666;">=</span> <span style="color: #007020;">explode</span>(<span style="color: #4070a0;">"</span><span style="color: #4070a0; font-weight: bold;">\n</span><span style="color: #4070a0;">"</span>, <span style="color: #bb60d5;">$response</span>);
<span style="color: #bb60d5;">$total</span> <span style="color: #666666;">=</span> <span style="color: #007020;">count</span>(<span style="color: #bb60d5;">$pieces</span>);
<span style="color: #bb60d5;">$final_response</span> <span style="color: #666666;">=</span> <span style="color: #007020; font-weight: bold;">NULL</span>;
<span style="color: #007020; font-weight: bold;">for</span> (<span style="color: #bb60d5;">$i</span><span style="color: #666666;">=</span><span style="color: #40a070;">0</span>; <span style="color: #bb60d5;">$i</span><span style="color: #666666;"><</span> <span style="color: #bb60d5;">$total</span>; <span style="color: #bb60d5;">$i</span><span style="color: #666666;">++</span>)
{
<span style="color: #007020; font-weight: bold;">if</span>(<span style="color: #bb60d5;">$pieces</span>[<span style="color: #bb60d5;">$i</span>] <span style="color: #666666;">!=</span> <span style="color: #007020; font-weight: bold;">NULL</span> )
<span style="color: #bb60d5;">$value</span> <span style="color: #666666;">=</span> <span style="color: #007020;">explode</span>(<span style="color: #4070a0;">':'</span>,<span style="color: #bb60d5;">$pieces</span>[<span style="color: #bb60d5;">$i</span>]);
<span style="color: #bb60d5;">$real_value</span> <span style="color: #666666;">=</span> (int)<span style="color: #bb60d5;">$value</span>[<span style="color: #40a070;">1</span>];
<span style="color: #bb60d5;">$final_response</span> <span style="color: #666666;">.=</span> <span style="color: #bb60d5;">$real_value</span>;
<span style="color: #bb60d5;">$final_response</span> <span style="color: #666666;">.=</span> <span style="color: #4070a0;">"</span><span style="color: #4070a0; font-weight: bold;">\n</span><span style="color: #4070a0;">"</span>;
}
<span style="color: #bb60d5;">$final_response</span> <span style="color: #666666;">=</span> trim(<span style="color: #bb60d5;">$final_response</span>);
<span style="color: #60a0b0; font-style: italic;">// $response = trim($response);</span>
<span style="color: #007020;">print_r</span>(<span style="color: #bb60d5;">$final_response</span>);
}
<span style="color: #007020;">?></span></pre>
<br />
saved the script with any filename i.e <span style="font-family: Courier New, Courier, monospace;"><b>php_xmlrpc.php</b></span> file in /usr/src/ folder.<br />
<br />
Add MI_XMLRPC module in opensips.cfg with its params i.e<br />
<br />
<span style="color: #ffe599;">loadmodule "mi_xmlrpc.so"</span><br />
<div>
<span style="color: #ffe599;"><br /></span></div>
<span style="color: #ffe599;">modparam("mi_xmlrpc", "port", 8000)</span><br />
<span style="color: #ffe599;">modparam("mi_xmlrpc", "reply_option", 2)</span><br />
<div>
<br /></div>
Restart opensips, once started successfully ensure that port 8000 or w.e you've assigned is listening on the interface.<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># netstat -pln | grep opens</span>
<span style="color: white;">tcp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">8000</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: white;">LISTEN</span> <span style="color: #0086f7; font-weight: bold;">1668</span><span style="color: white;">/opensips</span>
<span style="color: white;">udp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">56.3</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">5060</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: #0086f7; font-weight: bold;">1665</span><span style="color: white;">/opensips</span></pre>
<br />
<br />
Now execute the script mentioned above<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># php /usr/src/php_xmlrpc.php</span></pre>
<br />
This should print a long list of numbers - See end of this blog for the Full List.<br />
<br class="Apple-interchange-newline" />
Now What I did was call this script from the SNMPD daemon and pull the data list via SNMP. I already had SNMP based Zabbix monitoring setup for OpenSIPS so all I had to do is execute this script from opensips-server SNMP, collect the results, and plot these.<br />
<br />
To call the script from SNMP add the following line in your <b><span style="font-family: Courier New, Courier, monospace;">/etc/snmpd/snmpd.conf</span></b><br />
<br />
<span style="color: #ffe599; font-family: Courier New, Courier, monospace;">extend opensip_details /usr/bin/php /usr/src/php_xmlrpc.php</span><br />
<br />
Restart the SNMPD service i.e<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#/etc/init.d/snmpd restart</span></pre>
<br />
<br />
Now your SNMP should be able to execute this script. Test this by using this command.<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># snmpwalk -v 1 -c voip_monitoring localhost NET-SNMP-EXTEND-MIB::nsExtendOutLine</span></pre>
<br />
<br />
This will print out a huge list again. For meaning of these number see the end of this post second column.<br />
<br />
Pick any data of your interest and find out its full OID to use un Zabbix for pulling this Data and plotting it.<br />
To get the OID of any interesting data use the following line.<br />
<br />
<pre style="background-color: transparent; line-height: 16px;"><span style="color: white;">root@opensips-</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># snmptranslate -On 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".1'</span></pre>
<br />
<b><span style="font-family: Courier New, Courier, monospace;">.1.3.6.1.4.1.8072.1.3.2.4.1.2.15.111.112.101.110.115.105.112.95.100.101.116.97.105.108.115.1</span></b><br />
<br />
The above huge dotted number is now to be used in item creation in Zabbix and then make beautiful looking graphs.(See Part-1 of this post to do that)<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-msQVNTB9OuY/UFBBlpX_2YI/AAAAAAAAAJQ/omhUV4Qf12Y/s1600/Zabbix+Server++Configuration+of+graphs-124802.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="162" src="http://1.bp.blogspot.com/-msQVNTB9OuY/UFBBlpX_2YI/AAAAAAAAAJQ/omhUV4Qf12Y/s320/Zabbix+Server++Configuration+of+graphs-124802.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Rate of Stateless SIP Responses on OpenSIPS</td></tr>
</tbody></table>
<br />
Thats all for now, Use the above script be creative and fetch data of your favourite module via MI_XMLRPC and plot it in your NMS.<br />
<br />
I will see how can I use<a href="http://www.opensips.org/html/docs/modules/1.8.x/statistics.html"> OpenSIPS STATISTICS module</a> to define our custom data and pull&plot that data using MI_XMLRPC monitoring approach.<br />
<br />
---------------------------END OF POST-------------------------------<br />
<br />
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; width: 893px;">
<colgroup><col style="mso-width-alt: 6802; mso-width-source: userset; width: 140pt;" width="186"></col>
<col style="mso-width-alt: 25856; mso-width-source: userset; width: 530pt;" width="707"></col>
</colgroup><tbody>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt; width: 140pt;" width="186"><span style="font-size: x-small;">rcv_requests:1080</span></td>
<td style="width: 530pt;" width="707"><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".1
= STRING: core:rcv_requests = 94</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">rcv_replies:21</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".2 =
STRING: core:rcv_replies = 12</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">fwd_requests:6</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".3 =
STRING: core:fwd_requests = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">fwd_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".4 =
STRING: core:fwd_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">drop_requests:151</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".5 =
STRING: core:drop_requests = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">drop_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".6 =
STRING: core:drop_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">err_requests:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".7 =
STRING: core:err_requests = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">err_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".8 =
STRING: core:err_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">bad_URIs_rcvd:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".9 =
STRING: core:bad_URIs_rcvd = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">unsupported_methods:3</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".10 =
STRING: core:unsupported_methods = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">bad_msg_hdr:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".11 =
STRING: core:bad_msg_hdr = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">timestamp:149900</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".12 =
STRING: core:timestamp = 41455</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">waiting_udp:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".13 =
STRING: net:waiting_udp = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">waiting_tcp:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".14 =
STRING: net:waiting_tcp = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".15 =
STRING: pkmem:0-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-used_size:105104</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".16 =
STRING: pkmem:0-used_size = 104824</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-real_used_size:132748</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".17 =
STRING: pkmem:0-real_used_size = 132444</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-max_used_size:132748</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".18 =
STRING: pkmem:0-max_used_size = 132444</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-free_size:1964404</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".19 =
STRING: pkmem:0-free_size = 1964708</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">0-fragments:1</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".20 =
STRING: pkmem:0-fragments = 1</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".21 =
STRING: pkmem:1-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-used_size:104020</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".22 =
STRING: pkmem:1-used_size = 103892</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-real_used_size:131796</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".23 =
STRING: pkmem:1-real_used_size = 131644</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-max_used_size:132052</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".24 =
STRING: pkmem:1-max_used_size = 131700</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-free_size:1965356</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".25 =
STRING: pkmem:1-free_size = 1965508</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1-fragments:10</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".26 =
STRING: pkmem:1-fragments = 4</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".27 =
STRING: pkmem:2-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-used_size:123276</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".28 =
STRING: pkmem:2-used_size = 123608</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-real_used_size:151172</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".29 =
STRING: pkmem:2-real_used_size = 152092</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-max_used_size:151172</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".30 =
STRING: pkmem:2-max_used_size = 154492</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-free_size:1945980</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".31 =
STRING: pkmem:2-free_size = 1945060</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".32 =
STRING: pkmem:2-fragments = 53</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".33 =
STRING: pkmem:3-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-used_size:120492</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".34 =
STRING: pkmem:3-used_size = 120472</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-real_used_size:150308</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".35 =
STRING: pkmem:3-real_used_size = 150396</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-max_used_size:157692</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".36 =
STRING: pkmem:3-max_used_size = 157788</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-free_size:1946844</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".37 =
STRING: pkmem:3-free_size = 1946756</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3-fragments:119</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".38 =
STRING: pkmem:3-fragments = 130</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".39 =
STRING: pkmem:4-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-used_size:120032</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".40 =
STRING: pkmem:4-used_size = 119380</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-real_used_size:148624</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".41 =
STRING: pkmem:4-real_used_size = 147612</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-max_used_size:152640</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".42 =
STRING: pkmem:4-max_used_size = 151052</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-free_size:1948528</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".43 =
STRING: pkmem:4-free_size = 1949540</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4-fragments:70</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".44 =
STRING: pkmem:4-fragments = 44</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".45 =
STRING: pkmem:5-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-used_size:119728</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".46 =
STRING: pkmem:5-used_size = 119448</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-real_used_size:148236</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".47 =
STRING: pkmem:5-real_used_size = 147932</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-max_used_size:152256</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".48 =
STRING: pkmem:5-max_used_size = 151868</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-free_size:1948916</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".49 =
STRING: pkmem:5-free_size = 1949220</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5-fragments:70</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".50 =
STRING: pkmem:5-fragments = 72</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".51 =
STRING: pkmem:6-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-used_size:119800</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".52 =
STRING: pkmem:6-used_size = 119392</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-real_used_size:148308</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".53 =
STRING: pkmem:6-real_used_size = 147876</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-max_used_size:152288</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".54 =
STRING: pkmem:6-max_used_size = 151624</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-free_size:1948844</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".55 =
STRING: pkmem:6-free_size = 1949276</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6-fragments:70</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".56 =
STRING: pkmem:6-fragments = 72</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".57 =
STRING: pkmem:7-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-used_size:119748</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".58 =
STRING: pkmem:7-used_size = 119112</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-real_used_size:148208</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".59 =
STRING: pkmem:7-real_used_size = 147260</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-max_used_size:152264</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".60 =
STRING: pkmem:7-max_used_size = 150772</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-free_size:1948944</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".61 =
STRING: pkmem:7-free_size = 1949892</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">7-fragments:66</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".62 =
STRING: pkmem:7-fragments = 44</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".63 =
STRING: pkmem:8-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-used_size:102772</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".64 =
STRING: pkmem:8-used_size = 102492</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-real_used_size:129984</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".65 =
STRING: pkmem:8-real_used_size = 129680</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-max_used_size:129984</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".66 =
STRING: pkmem:8-max_used_size = 129680</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-free_size:1967168</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".67 =
STRING: pkmem:8-free_size = 1967472</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">8-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".68 =
STRING: pkmem:8-fragments = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".69 =
STRING: pkmem:9-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-used_size:116928</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".70 =
STRING: pkmem:9-used_size = 116648</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-real_used_size:144764</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".71 =
STRING: pkmem:9-real_used_size = 144460</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-max_used_size:144884</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".72 =
STRING: pkmem:9-max_used_size = 144580</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-free_size:1952388</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".73 =
STRING: pkmem:9-free_size = 1952692</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">9-fragments:7</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".74 =
STRING: pkmem:9-fragments = 7</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".75 =
STRING: pkmem:10-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-used_size:163024</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".76 =
STRING: pkmem:10-used_size = 162744</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-real_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".77 =
STRING: pkmem:10-real_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-max_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".78 =
STRING: pkmem:10-max_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-free_size:1906508</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".79 =
STRING: pkmem:10-free_size = 1906812</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">10-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".80 =
STRING: pkmem:10-fragments = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".81 =
STRING: pkmem:11-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-used_size:163024</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".82 =
STRING: pkmem:11-used_size = 162744</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-real_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".83 =
STRING: pkmem:11-real_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-max_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".84 =
STRING: pkmem:11-max_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-free_size:1906508</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".85 =
STRING: pkmem:11-free_size = 1906812</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">11-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".86 =
STRING: pkmem:11-fragments = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".87 =
STRING: pkmem:12-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-used_size:163024</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".88 =
STRING: pkmem:12-used_size = 162744</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-real_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".89 =
STRING: pkmem:12-real_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-max_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".90 =
STRING: pkmem:12-max_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-free_size:1906508</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".91 =
STRING: pkmem:12-free_size = 1906812</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">12-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".92 =
STRING: pkmem:12-fragments = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".93 =
STRING: pkmem:13-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-used_size:163024</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".94 =
STRING: pkmem:13-used_size = 162744</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-real_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".95 =
STRING: pkmem:13-real_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-max_used_size:190644</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".96 =
STRING: pkmem:13-max_used_size = 190340</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-free_size:1906508</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".97 =
STRING: pkmem:13-free_size = 1906812</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">13-fragments:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".98 =
STRING: pkmem:13-fragments = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-total_size:2097152</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".99 =
STRING: pkmem:14-total_size = 2097152</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-used_size:154528</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".100 =
STRING: pkmem:14-used_size = 154248</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-real_used_size:182028</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".101 =
STRING: pkmem:14-real_used_size = 181724</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-max_used_size:182028</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".102 =
STRING: pkmem:14-max_used_size = 181724</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-free_size:1915124</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".103 =
STRING: pkmem:14-free_size = 1915428</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">14-fragments:1</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".104 =
STRING: pkmem:14-fragments = 1</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">received_replies:21</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".105 =
STRING: tm:received_replies = 12</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">relayed_replies:16</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".106 =
STRING: tm:relayed_replies = 9</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">local_replies:30008</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".107 =
STRING: tm:local_replies = 8286</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">UAS_transactions:43</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".108 =
STRING: tm:UAS_transactions = 4</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">UAC_transactions:29976</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".109 =
STRING: tm:UAC_transactions = 8290</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2xx_transactions:11</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".110 =
STRING: tm:2xx_transactions = 4</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3xx_transactions:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".111 =
STRING: tm:3xx_transactions = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4xx_transactions:30003</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".112 =
STRING: tm:4xx_transactions = 8284</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5xx_transactions:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".113 =
STRING: tm:5xx_transactions = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6xx_transactions:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".114 =
STRING: tm:6xx_transactions = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">inuse_transactions:8</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".115 =
STRING: tm:inuse_transactions = 8</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">1xx_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".116 =
STRING: sl:1xx_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">2xx_replies:322</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".117 =
STRING: sl:2xx_replies = 42</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">3xx_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".118 =
STRING: sl:3xx_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">4xx_replies:540</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".119 =
STRING: sl:4xx_replies = 44</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">5xx_replies:18</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".120 =
STRING: sl:5xx_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">6xx_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".121 =
STRING: sl:6xx_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">sent_replies:880</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".122 =
STRING: sl:sent_replies = 86</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">sent_err_replies:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".123 =
STRING: sl:sent_err_replies = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">received_ACKs:151</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".124 =
STRING: sl:received_ACKs = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">total_size:16777216</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".125 =
STRING: shmem:total_size = 16777216</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">used_size:1888760</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".126 =
STRING: shmem:used_size = 1888368</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">real_used_size:1932040</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".127 =
STRING: shmem:real_used_size = 1931564</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">max_used_size:1961760</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".128 =
STRING: shmem:max_used_size = 1953812</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">free_size:14845176</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".129 =
STRING: shmem:free_size = 14845652</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">fragments:33</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".130 =
STRING: shmem:fragments = 30</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">active_dialogs:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".131 =
STRING: dialog:active_dialogs = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">early_dialogs:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".132 =
STRING: dialog:early_dialogs = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">processed_dialogs:18</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".133 =
STRING: dialog:processed_dialogs = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">expired_dialogs:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".134 =
STRING: dialog:expired_dialogs = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">failed_dialogs:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".135 =
STRING: dialog:failed_dialogs = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">registered_users:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".136 =
STRING: usrloc:registered_users = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">location-users:2</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".137 =
STRING: usrloc:location-users = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">location-contacts:3</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".138 =
STRING: usrloc:location-contacts = 2</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">location-expires:9</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".139 =
STRING: usrloc:location-expires = 6</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">max_expires:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".140 =
STRING: registrar:max_expires = 0</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">max_contacts:5</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".141 =
STRING: registrar:max_contacts = 5</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">default_expire:3600</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".142 =
STRING: registrar:default_expire = 3600</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">accepted_regs:322</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".143 =
STRING: registrar:accepted_regs = 42</span></td>
</tr>
<tr height="20" style="height: 15.0pt;">
<td height="20" style="height: 15.0pt;"><span style="font-size: x-small;">rejected_regs:0</span></td>
<td><span style="font-size: x-small;">NET-SNMP-EXTEND-MIB::nsExtendOutLine."opensip_details".144 =
STRING: registrar:rejected_regs = 0</span></td>
</tr>
</tbody></table>
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com1tag:blogger.com,1999:blog-7979378259821020425.post-2794966248007552852012-08-08T01:12:00.000-07:002012-08-08T01:34:03.907-07:00Adventures with CISCO AS-5350 [Integration with RADIUS Server for AAA of calls]<div dir="ltr" style="text-align: left;" trbidi="on">
Continuing from the last <a href="http://saevolgo.blogspot.com/2012/08/adventures-with-cisco-as-5350-setting.html">blog-post</a> on setting up a remote syslog server for CISCO devices. In this writeup I will share the configurations I did to integrate the CISCO universal gateway with my FreeRadius server for AAA of calls made from a specific dial-peer.<br />
<br />
<br />
<b><u>Define the RADIUS Server:</u></b><br />
<br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">radius-server host 192.168.137.85 auth-port 1812 acct-port 1813 key 0 radius-pa$$w0rd</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">radius-server vsa send accounting</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">radius-server vsa send authentication</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<br />
<b><u>Bind SIP services on the Public interface of CISCO AS</u></b><br />
<br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">voice service voip </span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> sip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> bind control source-interface FastEthernet0/0</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> bind media source-interface FastEthernet0/0</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> header-passing </span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> registrar server</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<div>
<br /></div>
<br />
<b><u>Set AAA options:</u></b><br />
<br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">aaa new-model</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><span style="color: #fff2cc; font-family: 'Courier New', Courier, monospace;">aaa accounting connection voip start-stop group radius</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">aaa dnis map enable</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">aaa preauth</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> group radius </span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> clid required </span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> dnis required </span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">aaa session-id common</span><br />
<div>
<br /></div>
<br />
<b><u>Create a Voice Class for AAA</u></b><br />
<br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">voice class aaa 2</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> authentication method voip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> authorization method voip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> accounting method voip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> accounting template out-bound</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<div>
<b><u>[OPTIONAL] Create a Codec class</u></b></div>
<div>
<div>
<br /></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">voice class codec 1</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> codec preference 1 g711alaw</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> codec preference 2 g711ulaw</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> codec preference 3 g723ar53</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> codec preference 4 g729br8</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
</div>
<div>
<br /></div>
<br />
<b><u><br /></u></b>
<b><u>Creating a Dial-Peer:</u></b><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">dial-peer voice 10 voip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> destination-pattern [0-9].%</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> voice-class aaa 2</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> voice-class codec 1</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> voice-class sip url sip</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> session protocol sipv2</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> session target ipv4:192.168.137.87</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> session transport udp</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<br />
<br />
<br />
<br />
Where 192.168.137.87 is the IP address of my Kamailio server which will receive the calls.<br />
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">"destination-pattern [0-9].%" </span><span style="font-family: inherit;">Will Match everything of any length</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<b><u>Send CDR on Accounting Server:</u></b></div>
To automatically generate accounting packets by enabling voice accounting, enter the gw-accounting aaa command in global configuration mode. Use Callhistory-detail to Send All VSAs (default and new) to the accounting server:<br />
<div>
<div>
<br /></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">gw-accounting aaa</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> acct-template callhistory-detail</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-family: inherit;"><b><u>[OPTIONAL] set SIP-UA parameters.</u></b></span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">sip-ua </span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> registrar ipv4:
192.168.137.87 expires 3600</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> sip-server ipv4:192.168.137.87</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
</div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"><br /></span></div>
I think thats pretty much it. Now calls matching dial-peer 10 will send AAA info to the RADIUS server.<br />
<br />
<br />
<b><u>Reference URLs:</u></b><br />
[1] <a href="http://www.cisco.com/en/US/products/sw/iosswrel/ps1839/products_feature_guide_chapter09186a00800b5de9.html#1028579">http://www.cisco.com/en/US/products/sw/iosswrel/ps1839/products_feature_guide_chapter09186a00800b5de9.html#1028579</a>
<br />
[2]<br />
<a href="http://docwiki.cisco.com/wiki/Cisco_IOS_Voice_Troubleshooting_and_Monitoring_--_AAA_for_Voice_Troubleshooting">http://docwiki.cisco.com/wiki/Cisco_IOS_Voice_Troubleshooting_and_Monitoring_--_AAA_for_Voice_Troubleshooting</a>
<br />
[3]<br />
<a href="http://www.cisco.com/en/US/docs/ios/12_2t/12_2t11/feature/guide/ft_trg.html#wp1077327">http://www.cisco.com/en/US/docs/ios/12_2t/12_2t11/feature/guide/ft_trg.html#wp1077327</a>
<br />
[4]<br />
<a href="http://www.cisco.com/en/US/docs/ios/12_3/security/configuration/guide/scgrdat3.html">http://www.cisco.com/en/US/docs/ios/12_3/security/configuration/guide/scgrdat3.html</a>
<br />
<br />
<i><span style="font-size: x-small;">And some 5/6 PDF Manuals/Books from CISCO around 1200 pages !</span></i></div>Anonymoushttp://www.blogger.com/profile/05010083637635292524noreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-66389240806892660932012-08-08T00:18:00.000-07:002012-08-08T01:14:14.748-07:00Adventures with CISCO AS-5350 [Setting up remote Log server]<div dir="ltr" style="text-align: left;" trbidi="on">
Though not really an adventure but more sort of a dream to be at-least as good on CISCO VoIP things as I'm with OpenSource VoIP projects. So I keep on practicing CISCO stuff on my <a href="http://www.gns3.net/">GNS3</a>. So that I be ready if someday I be given opportunity to work full-time with these devices.<br />
<br />
I was cleaning my drives for space and found something useful to share on experience with CISCO AS-5350, which is a Universal Gateway supporting T1/ E1 configurations that provides universal port data, voice, and fax services on any port at any time.<br />
<br />
So before deleting, I wanted to share it here so it could be useful for not just me but for all who might be interested.<br />
<br />
Current post is about setting up a remote SYSLOG server for our cisco devices. So, basically in a network environment all the logs should be sent to a secure remote logging server. This is a big thing to analyse what happened on a particular device.<br />
<br />
This is the version info of the cisco device.<br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #fff2cc;">Cisco IOS Software, 5350 Software (C5350-JS-M), Version 12.4(18), RELEASE SOFTWARE (fc1)</span></span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #fff2cc;"><br /></span></span>
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #fff2cc;">ROM: System Bootstrap, Version 12.2(1r)1, RELEASE SOFTWARE (fc1)</span></span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">BOOTLDR: 5350 Software (C5350-BOOT-M), Version 12.2(2)XB2, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: 'Courier New', Courier, monospace;"><span style="color: #fff2cc;">System image file is "flash:c5350-js-mz.124-18.bin"</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<u><b>Setting up Remote-Logs:</b></u><br />
<br />
I've set the device to send everything on a remote-log server and record everything happening, from logins to commands executed.<br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span><br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">service timestamps debug datetime msec</span><br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">service timestamps log datetime msec</span><br />
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"></span><br />
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">
</span>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">login on-failure log</span></div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">
</span></div>
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">login on-success log</span><br />
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">archive</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> log config</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> logging enable</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"> notify syslog</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
</div>
<div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">logging history debugging</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">logging trap debugging</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">logging facility local6</span></div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">logging <b>192.168.137.6</b></span></div>
</div>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<br />
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;"></span><br />
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">no logging buffered</span></div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">
</span>
<div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">no logging console</span></div>
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">
</span></div>
<br />
<br />
<span style="color: #fff2cc; font-family: Courier New, Courier, monospace;">!</span></div>
<div>
<br /></div>
<div>
# Where 192.168.137.6 is the remote syslog server. Make sure that rsyslog server is configured properly.</div>
<div>
# My /etc/default/rsyslog contains this line</div>
<div>
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">RSYSLOGD_OPTIONS="-c2 -r514"</span></div>
<div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">A quick look at the "netstat -pln"</span></div>
<div>
<div style="font-family: inherit;">
<br /></div>
<div>
<pre style="background-color: transparent; line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@debian:~</span><span style="background-color: transparent; color: lime; font-style: italic;"># netstat -pln | grep 514</span>
<span style="color: white;">udp</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:</span><span style="color: #0086f7; font-weight: bold;">514</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">:*</span> <span style="color: #0086f7; font-weight: bold;">31026</span><span style="color: white;">/rsyslogd</span>
<span style="color: white;">root@debian:~</span><span style="background-color: transparent; color: lime; font-style: italic;">#</span></pre>
</div>
</div>
<div style="font-family: inherit;">
<br /></div>
<div>
<span style="font-family: inherit;">and in the file </span><span style="font-family: Courier New, Courier, monospace;">/etc/rsyslog.conf</span><span style="font-family: inherit;"> I've this line</span></div>
<div style="font-family: inherit;">
<br /></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">local6.* -/var/log/cisco/as5350.log</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div style="font-family: inherit;">
### Back to CISCO ###</div>
<div style="font-family: inherit;">
<br /></div>
<div style="font-family: inherit;">
An excerpt from the CISCO pages on configuration change notifications and logging <span style="font-size: xx-small;">[1]</span>:</div>
<div style="font-family: inherit;">
<br /></div>
<div>
<div class="pB1_Body1" style="margin: 1px 0em 6px;">
<span style="font-family: inherit;">Only complete commands that result in the invocation of action routines are logged. The following types of entries are not logged:</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1050079" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />Commands that result in a syntax error message</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1050080" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />Partial commands that invoke the router help system</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1050081" style="text-align: -webkit-auto;"></a></span><br />
<div class="pB1_Body1" style="margin: 1px 0em 6px;">
<span style="font-family: inherit;">For each configuration command that is executed, the following information is logged:</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1048068" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />The command that was executed</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1048080" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />The configuration mode in which the command was executed</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1048161" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />The name of the user that executed the command</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1048172" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />The time at which the command was executed</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1048181" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />A configuration change sequence number</span></div>
<span style="font-family: inherit;"><a href="http://www.blogger.com/blogger.g?blogID=7979378259821020425" name="wp1050208" style="text-align: -webkit-auto;"></a></span><br />
<div class="pBu1_Bullet1" style="margin-bottom: 7px; margin-left: 0.25in; margin-right: 0em; text-indent: -0.25in;">
<span style="font-family: inherit;">•<img alt="" border="0" height="2" src="http://www.cisco.com/en/US/i/templates/blank.gif" style="border: 0px;" width="19" />Parser return codes for the command</span></div>
</div>
<div style="font-family: inherit;">
<br /></div>
<div>
<span style="font-family: inherit;">That concludes this post: </span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">After those cli commands a router/cisco device should be able to send logs to the remote </span>logging<span style="font-family: inherit;"> server. </span>Make<span style="font-family: inherit;"> sure that at least the log port (udp:514 in my case) is accessible between CISCO device and the syslog server.</span></div>
<div>
<span style="font-family: inherit;"><br /></span></div>
<div>
<span style="font-family: inherit;">In <a href="http://saevolgo.blogspot.com/2012/08/adventures-with-cisco-as-5350.html">next post</a> I will share </span>configuration for Integration with RADIUS server for AAA the calls or even the incoming SIP registrations.</div>
<br />
<div>
<span style="font-family: inherit;">References:</span></div>
<div style="font-family: inherit;">
[1]: <a href="http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gtconlog.html#wp1027171">http://www.cisco.com/en/US/docs/ios/12_3t/12_3t4/feature/guide/gtconlog.html#wp1027171</a></div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-5129241975741553042012-08-07T23:05:00.000-07:002012-08-07T23:05:15.115-07:00FreeSWITCH, making calls via web-browser [using mod_rtmp]<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Finally back to blog after a longtime. Continuing from the FreeSWITCH stuff. I learned about the RTMP module which enables us to connect to the FreeSWITCH server via web browser and make calls just like any other Soft-phone.<br />
<br />
This is wonderful, I don't need to install any soft-phone or anything, just open up my FS server RTMP phone page - login using my SIP credentials and once authenticated make calls !! simple.<br />
<br />
In order to get it working I went back to the source directory of Freeswitch and just compiled thertmp module. Learn more about the <a href="http://wiki.freeswitch.org/wiki/Mod_rtmp">FreeSWITCH RTMP Module from this link</a>.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><pre><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/src/freeswitch</span></pre>
</pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#make mod_rtmp && make mod_rtmp install</span></pre>
<br />
once compiled and installed successfully, enable the rtmp module to be loaded automatically by freeswitch.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/local/freeswitch/conf/autoload_configs/</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
<span style="color: white; line-height: 16px; text-align: -webkit-auto;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic; line-height: 16px; text-align: -webkit-auto;">#vim modules.conf.xml</span><br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
<br />
Uncomment by removing the "<!--" and "-->"<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: #fb660a; font-weight: bold;"><load</span> <span style="color: #ff0086; font-weight: bold;">module=</span><span style="color: #0086d2;">"mod_rtmp"</span><span style="color: #fb660a; font-weight: bold;">/></span></pre>
<br />
Save and exit from the file after uncommenting.<br />
<br />
Goto FreeSwitch console.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#fs_cli</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
Since my freeswitch was already started so to load RTMP module either I need to restart my Freeswitch server or I can just load the module from the console just like this.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">freeswitch</span><span style="color: #fb660a;">@internal</span><span style="color: white;">></span> <span style="color: white;">load</span> <span style="color: white;">mod_rtmp</span></pre>
<br />
It will print lots of output lines on console. Once loaded successfully edit the module settings to your choice.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/local/freeswitch/conf/autoload_configs/</span></pre>
<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim rtmp.conf.xml</span></pre>
<br />
I didn't need to change anything so I just simply reviewed the rtmp.conf.xml file and exited.<br />
<br />
Now, time to copy the web-phone from the source directory to the web root.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/src/freeswitch/clients/</span></pre>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cp -rf flex/ /var/www/html/</span></pre>
<br />
Now we need to edit the html file and change one small thing there.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim /var/www/html/flex/freeswitch.html</span></pre>
<br />
We need to change the rtmp url to that of our server's public IP.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">var</span> <span style="color: white;">flashvars</span> <span style="color: white;">=</span> <span style="color: white;">{</span>
<span style="color: white;">rtmp_url:</span> <span style="color: #0086d2;">'rtmp://193.195.196.193/phone'</span>
<span style="color: white;">};</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span></pre>
Save and exit, now open your browser and type down this URL.<br />
<br />
<span style="font-family: Trebuchet MS, sans-serif;"><i>http://193.195.196.193/flex/freeswitch.html</i></span><br />
<br />
You;ll see a sample dialer. Login using your SIP credentials and if asked for allowing the browser to use your webcam/microphone/speaker accept it.<br />
<br />
After successful login you should be able to make calls given the context your user is assigned to is configured likewise.</div>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-7979378259821020425.post-13599623717427960532012-07-11T06:30:00.000-07:002012-07-11T06:59:14.865-07:00FreeSWITCH with SIP Users in MySQL [Mod XML_CURL]<div dir="ltr" style="text-align: left;" trbidi="on">
FreeSWITCH is one of the biggest attraction for me since my introduction to VoIP. Since I like it too much and work with it most of the time but couldn't post anything good related to Freeswitch so far. Luckily I got a link from one of my friend's blog <a href="http://www.touchkanology.com/freeswitch-mod_xml_curl.html#more-272">Touchkanalogy</a> about Freeswitch module mod_xml_curl sort-of saying "FreeSWITCH SIP Realtime". Like Asterisk's SIP real-time where SIP users are inserted into database and asterisk authenticates incoming SIP user REGISTRATIONs from database settings.<br />
<br />
FreeSWITCH don't exactly work like asterisk. FreeSWITCH needs XML configurations for users' settings. Following my friend's blog and the source document for the freeswitch <a href="http://wiki.freeswitch.org/wiki/Mod_xml_curl">XML_CURL module</a>. I was able to successfully insert users in Database and incoming SIP user's authentication requests were processed according to the data in DB.<br />
<br />
<a name='more'></a><br /><br />
The Logic is simple. Incoming SIP requests are received by Freeswitch which asks a web-service about the details of the user. The web-server just queries data and if any relevant details are found returns them in XML format. Freeswitch accepts or reject the SIP request depending upon the XML response.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-yOXSxKW5WiA/T_xp5aRbiiI/AAAAAAAABHI/ZXBIVNt3bLE/s1600/Mod_XML_Curl_Outline.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img alt="" border="0" src="http://4.bp.blogspot.com/-yOXSxKW5WiA/T_xp5aRbiiI/AAAAAAAABHI/ZXBIVNt3bLE/s1600/Mod_XML_Curl_Outline.png" title="Flowchart" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Ref URL:
<a href="http://wiki.freeswitch.org/wiki/Mod_xml_curl">http://wiki.freeswitch.org/wiki/Mod_xml_curl</a> </td></tr>
</tbody></table>
Another way to represent the above flowchart.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-vhbR2jG_vig/T_0F0k1Rl2I/AAAAAAAABHU/P13odY4p-fc/s1600/FreeSwitch_XML_CURL.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="246" src="http://1.bp.blogspot.com/-vhbR2jG_vig/T_0F0k1Rl2I/AAAAAAAABHU/P13odY4p-fc/s320/FreeSwitch_XML_CURL.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">With SIP Proxy REGISTER Load-Balancer</td></tr>
</tbody></table>
<div>
<br />
Following are the commands and steps I performed to make this happen. Remember I had a CentOS server hosting Freeswitch so Ubuntu or other OS users need to find corresponding packages and directories accordingly.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#yum install mysql mysql-server php-pdo curl php-xml</span></pre>
<br />
Next Edit the php.ini file to include the extension for mysql and pdo.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim /etc/php.ini</span></pre>
<br />
<span style="background-color: transparent;">Just below this Huge tag</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">;;;;;;;;;;;;;;;;;;;;;;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">; Dynamic Extensions ;</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">;;;;;;;;;;;;;;;;;;;;;;</span><br />
<span style="background-color: transparent;">Add these two lines.</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">extension=pdo.so<br /> extension=pdo_mysql.so</span><br />
<br />
<span style="background-color: transparent;">Restart the web server to make changes effective.</span><br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#/etc/init.d/httpd restart</span></pre>
Then goto the freeswitch source directory. I already had FS installed so I installed the module explicitly.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/src/freeswitch</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#make mod_xml_curl && make mod_xml_curl-install</span></pre>
Then enable the module in modules.conf<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/local/freeswitch/conf/</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim autoload_configs/modules.conf.xml</span></pre>
<br />
Uncomment the following tag by removing the "<!--"and "-->"<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;"><!--</span> <span style="color: white;"><load</span> <span style="color: white;">module=</span><span style="color: #0086d2;">"mod_xml_curl"</span><span style="color: white;">/></span> <span style="color: white;">--></span></pre>
<br />
Edit the settingfor the XML_CURL module.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim autoload_configs/xml_curl.conf.xml</span></pre>
<br />
The most importthing is to set the web-service URL where FS will send all the queries.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"> <span style="color: white;"><param</span> <span style="color: white;">name=</span><span style="color: #0086d2;">"gateway-url"</span> <span style="color: white;">value=</span><span style="color: #0086d2;">"<b>http://localhost/fs_curl/</b>"</span> <span style="color: white;">bindings=</span><span style="color: #0086d2;">"directory"</span><span style="color: white;">/></span></pre>
<br />
In my case the web-server is on localhost and I plan on using the sub directory fs_curl for the php pages.<br />
<br />
Now its time to download the real thing.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /usr/src/</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#git clone git://git.freeswitch.org/freeswitch-contrib.git</span></pre>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd freeswitch-contrib/intralanman/PHP/fs_curl/</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mkdir /var/www/html/fs_curl</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cp -rf * /var/www/html/fs_curl</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /var/www/html/fs_curl/</span></pre>
<br />
Edit the DB connector values and debugging stuff from the global configurations file for FS_CURL<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim global_defines.php</span></pre>
<br />
Edit the following lines.<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">define('<span style="background-color: #ffe599; color: red;">DEFAULT_DSN</span>', 'mysql:dbname=FS_DB;host=127.0.0.1');</span><span style="font-family: 'Courier New', Courier, monospace;">define('DEFAULT_DSN_LOGIN', 'freeswitch');</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">define('<span style="background-color: #ffe599; color: red;">DEFAULT_DSN_PASSWORD</span>', 'passw0rd');</span></blockquote>
<br />
If you want to debug <span style="background-color: transparent;">uncomment the following (Not recommended for production servers)</span><br />
<span style="background-color: white;"><br /></span><br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace;">define('<span style="background-color: #ffe599; color: red;">FS_CURL_DEBUG</span>', 9);</span><span style="font-family: 'Courier New', Courier, monospace;">define('FS_DEBUG_TYPE', 2);</span><span style="background-color: white;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">define('</span><span style="background-color: #ffe599; color: red; font-family: 'Courier New', Courier, monospace;">FS_DEBUG_FILE</span><span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">', '/var/log/fs_curl.debug');</span></blockquote>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#touch /var/log/fs_curl.debug</span>
<span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#chown apache:apache /var/log/fs_curl.debug</span></pre>
<br />
We need to modify the <b>fs_directory.php</b> file a bit to use the correct table names.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim fs_directory.php</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
<br />
<b><u>CHANGE</u></b><br />
<u>[ON LINE:88]</u><br />
<br />
<b>FROM:</b><span style="font-family: 'Courier New', Courier, monospace;">$where_array [] = sprintf ( "<span style="color: red;">domain_id</span>='%s'", $domain ['id'] );</span><br />
<b>TO:</b><span style="font-family: 'Courier New', Courier, monospace;">$where_array [] = sprintf ( "<span style="color: red;">domain</span>='%s'", $domain ['id'] );</span><br />
<br />
<u>[LINE:106]</u><br />
<b>FROM:</b><span style="font-family: 'Courier New', Courier, monospace;">$query = sprintf ( "SELECT * FROM <span style="color: red;">directory d</span> %s %s ORDER BY username", $join_clause, $where_clause );</span><br />
<b>TO:</b><span style="font-family: 'Courier New', Courier, monospace;">$query = sprintf ( "SELECT * FROM <span style="color: red;">directory</span> %s %s ORDER BY username", $join_clause, $where_clause );</span><br />
<br />
Save and Exit.<br />
<br />
Create DATABASE<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#cd /var/www/html/fs_curl/sql/</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#vim +93 mysql-5.0-with-samples.sql</span></pre>
Delete this line all-together <span style="background-color: transparent;">else you may get this error:</span><br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">ERROR</span> <span style="color: #0086f7; font-weight: bold;">1231</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">42000</span><span style="color: white;">)</span> <span style="color: white;">at</span> <span style="color: white;">line</span> <span style="color: #0086f7; font-weight: bold;">93</span><span style="color: #fb660a; font-weight: bold;">:</span> <span style="color: #cdcaa9; font-weight: bold;">Variable</span> <span style="color: white;">'</span><span style="color: #cdcaa9; font-weight: bold;">character_set_client</span><span style="color: white;">'</span> <span style="color: #cdcaa9; font-weight: bold;">can</span><span style="color: white;">'</span><span style="color: #cdcaa9; font-weight: bold;">t</span> <span style="color: #cdcaa9; font-weight: bold;">be</span> <span style="color: #cdcaa9; font-weight: bold;">set</span> <span style="color: #cdcaa9; font-weight: bold;">to</span> <span style="color: #cdcaa9; font-weight: bold;">the</span> <span style="color: #cdcaa9; font-weight: bold;">value</span> <span style="color: #cdcaa9; font-weight: bold;">of</span> <span style="color: white;">'</span><span style="color: #cdcaa9; font-weight: bold;">NULL</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mysql -uroot -p</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">mysql></span> <span style="color: #fb660a; font-weight: bold;">create</span> <span style="color: #fb660a; font-weight: bold;">database</span> <span style="color: white;">FS_DB;</span>
<span style="color: white;">mysql></span> <span style="color: white;">quit;</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mysql FS_DB < mysql-5.0-with-samples.sql</span></pre>
Create New users and passwords for them, domain needs to be added as well.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@FS_HA1</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mysql -uroot -p</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><pre><span style="color: white;">mysql></span><span style="color: #fb660a; font-weight: bold;">use</span> <span style="color: white;">FS_DB;</span></pre>
</pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">mysql></span> <span style="color: #fb660a; font-weight: bold;">insert</span> <span style="color: #fb660a; font-weight: bold;">into</span> <span style="color: white;">directory_domains</span> <span style="color: #fb660a; font-weight: bold;">values</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">3</span><span style="color: white;">,</span><span style="color: #0086d2;">'192.168.137.6'</span><span style="color: white;">);</span>
<span style="color: white;">Query</span> <span style="color: white;">OK,</span> <span style="color: #0086f7; font-weight: bold;">1</span> <span style="color: white;">row</span> <span style="color: #ff0086; font-weight: bold;">affected</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">00</span> <span style="color: white;">sec)</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">mysql></span><span style="color: #fb660a; font-weight: bold;">INSERT</span> <span style="color: #fb660a; font-weight: bold;">into</span> <span style="color: #ff0086; font-weight: bold;">directory</span> <span style="color: white;">(username,domain)</span> <span style="color: #fb660a; font-weight: bold;">VALUES</span> <span style="color: white;">(</span><span style="color: #0086d2;">"40277"</span><span style="color: white;">,</span><span style="color: #0086f7; font-weight: bold;">3</span><span style="color: white;">);</span>
<span style="color: white;">mysql></span><span style="color: #fb660a; font-weight: bold;">INSERT</span> <span style="color: #fb660a; font-weight: bold;">into</span> <span style="color: #ff0086; font-weight: bold;">directory</span> <span style="color: white;">(username,domain)</span> <span style="color: #fb660a; font-weight: bold;">VALUES</span> <span style="color: white;">(</span><span style="color: #0086d2;">"50354"</span><span style="color: white;">,</span><span style="color: #0086f7; font-weight: bold;">3</span><span style="color: white;">);</span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span></pre>
<br />
GET THE "id" from the directory table for these newly created users.<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">mysql></span> <span style="color: #fb660a; font-weight: bold;">select</span> <span style="color: white;">*</span> <span style="color: #fb660a; font-weight: bold;">from</span> <span style="color: white;">directory;</span>
<span style="color: white;">+----+----------+-----------------+</span>
<span style="color: white;">|</span> <span style="color: white;">id</span> <span style="color: white;">|</span> <span style="color: white;">username</span> <span style="color: white;">|</span> <span style="color: white;">domain</span> <span style="color: white;">|</span>
<span style="color: white;">+----+----------+-----------------+</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1000</span> <span style="color: white;">|</span> <span style="color: white;">example.com</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">2</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1001</span> <span style="color: white;">|</span> <span style="color: white;">example.org</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">3</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1002</span> <span style="color: white;">|</span> <span style="color: white;">example.net</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">5</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1003</span> <span style="color: white;">|</span> <span style="color: white;">example.info</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">6</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1004</span> <span style="color: white;">|</span> <span style="color: white;">example.com</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">7</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1005</span> <span style="color: white;">|</span> <span style="color: white;">example.org</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">8</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1006</span> <span style="color: white;">|</span> <span style="color: white;">example.net</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">9</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1007</span> <span style="color: white;">|</span> <span style="color: white;">example.info</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">10</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">2000</span> <span style="color: white;">|</span> <span style="color: #fb660a; font-weight: bold;">default</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">11</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">1009</span> <span style="color: white;">|</span> <span style="color: white;">$${local_ip_v4}</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">12</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">40277</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">3</span> <span style="color: white;">|</span>
<span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">13</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">50354</span> <span style="color: white;">|</span> <span style="color: #0086f7; font-weight: bold;">3</span> <span style="color: white;">|</span>
<span style="color: white;">+----+----------+-----------------+</span>
<span style="color: #0086f7; font-weight: bold;">12</span> <span style="color: white;">rows</span> <span style="color: #fb660a; font-weight: bold;">in</span> <span style="color: #cdcaa9; font-weight: bold;">set</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">00</span> <span style="color: white;">sec)</span>
<span style="color: white;">mysql></span></pre>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">
</span>
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">mysql></span> <span style="color: #fb660a; font-weight: bold;">insert</span> <span style="color: #fb660a; font-weight: bold;">into</span> <span style="color: #ff0086; font-weight: bold;">directory_params</span> <span style="color: white;">(directory_id,param_name,param_value)</span> <span style="color: #fb660a; font-weight: bold;">VALUES</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">12</span><span style="color: white;">,</span><span style="color: #0086d2;">'password'</span><span style="color: white;">,</span><span style="color: #0086d2;">'S3cr3t40277'</span><span style="color: white;">);</span>
<span style="color: white;">mysql></span> <span style="color: #fb660a; font-weight: bold;">insert</span> <span style="color: #fb660a; font-weight: bold;">into</span> <span style="color: #ff0086; font-weight: bold;">directory_params</span> <span style="color: white;">(directory_id,param_name,param_value)</span> <span style="color: #fb660a; font-weight: bold;">VALUES</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">13</span><span style="color: white;">,</span><span style="color: #0086d2;">'password'</span><span style="color: white;">,</span><span style="color: #0086d2;">'S3cr3t50354'</span><span style="color: white;">);</span></pre>
</pre>
Thats All, now try registering your SOFT Phone using new username/password and see if your requests reach to WEB-Server.<br />
You can troubleshoot the XML_CURL module by issuing the following command on FS Console.
<br />
<pre style="text-align: -webkit-auto;"><pre style="line-height: 16px;"><span style="color: #fb660a; font-weight: bold;">freeswitch@internal></span> <span style="color: #0086d2;">xml_curl</span> <span style="color: #0086d2;">debug_on</span>
<span style="color: #0086d2;">OK</span></pre>
</pre>
For each XML response we'll now get an output on FS_CLI<br />
<span style="background-color: transparent; color: #fb660a; font-weight: bold; line-height: 16px;">mod_xml_curl.c:318</span><span style="background-color: transparent; line-height: 16px;"> </span><span style="background-color: transparent; color: #0086d2; line-height: 16px;">XML</span><span style="background-color: transparent; line-height: 16px;"> </span><span style="background-color: transparent; color: #0086d2; line-height: 16px;">response</span><span style="background-color: transparent; line-height: 16px;"> </span><span style="background-color: transparent; color: #0086d2; line-height: 16px;">is</span><span style="background-color: transparent; line-height: 16px;"> </span><span style="background-color: transparent; color: #0086d2; line-height: 16px;">in</span><span style="background-color: transparent; line-height: 16px;"> </span><span style="background-color: transparent; color: #0086d2; line-height: 16px;">/tmp/d8fc4b98-cb1a-11e1-b16b-2f327a1d3f98.tmp.xml</span>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"></pre>
</div>
</div>Unknownnoreply@blogger.com27tag:blogger.com,1999:blog-7979378259821020425.post-371327348026572582012-07-09T07:32:00.000-07:002012-07-11T06:59:30.968-07:00Asterisk behind Kamailio & Voicemail MWI<div dir="ltr" style="text-align: left;" trbidi="on">
Once again my workaholic nature didn't let me rest this Saturday and Sunday as I kept thinking about how can the MWI indications work with Asterisk as voicemail server behind a Kamailio server. Kamailio is the REGISTRAR of SIP users.<br />
<div>
<br /></div>
<div>
Since SIP users register on Kamailio, so Asterisk won't trigger a NOTIFY on it's voice-message recording.<br />
<br />
There are <a href="http://www.voip-info.org/wiki/view/Asterisk+at+large" target="_blank">many methods</a> discussed on voip-info.org page. Among the other which weren't working or required patching I worked on manual SUBSCRIBE-NOTIFY triggering method by "Andreas Granig" which is openly discussed and shared on <a href="http://lists.iptel.org/pipermail/serusers/2004-September/011552.html" target="_blank">this mailing-list post</a> in 2004. I haven't modified anything except the IP addresses for my servers.<br />
<div>
<br />
<a name='more'></a><br /><br />
<div>
Since a picture is worth a thousand words so see the attached image below for the logical flow of the solution.</div>
<div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://3.bp.blogspot.com/-CAGyRtuJASk/T_pyzi3tFAI/AAAAAAAABG8/Ls6REhkhXPg/s1600/Kamailio_Asterisk_MWI.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="245" src="http://3.bp.blogspot.com/-CAGyRtuJASk/T_pyzi3tFAI/AAAAAAAABG8/Ls6REhkhXPg/s320/Kamailio_Asterisk_MWI.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Kamailio and Asterisk with MWI working</td></tr>
</tbody></table>
<br />
Since the time the solution was posted a lot of things have changed with SER and Kamailio. I am using Kamailio 3.3 so I had to change a few variables and minor things to make this work for me.<br />
<br />
<br />
<div>
In Kamialio configurations File</div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(is_method(</span><span style="color: #0086d2;">"NOTIFY"</span><span style="color: white;">)</span> <span style="color: white;">&</span> <span style="color: white;">ds_is_from_list())</span> <span style="color: white;">{</span>
<span style="color: white;">route(LOCATION);</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(!t_relay())</span> <span style="color: white;">{</span>
<span style="color: white;">sl_reply_error();</span>
<span style="color: white;">break;</span>
<span style="color: white;">};</span>
<span style="color: white;">};</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(method==</span><span style="color: #0086d2;">"SUBSCRIBE"</span><span style="color: white;">)</span> <span style="color: white;">{</span>
<span style="color: #fb660a; font-weight: bold;">#</span> <span style="color: white;">challenge/response</span>
<span style="color: #fb660a; font-weight: bold;">if</span> <span style="color: white;">(!www_authorize(</span><span style="color: #0086d2;">"$td"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"asv_sip"</span><span style="color: white;">))</span> <span style="color: white;">{</span>
<span style="color: white;">www_challenge(</span><span style="color: #0086d2;">"$td"</span><span style="color: white;">,</span> <span style="color: #0086d2;">"0"</span><span style="color: white;">);</span>
<span style="color: white;">break;</span>
<span style="color: white;">};</span>
<span style="color: #fb660a; font-weight: bold;">#</span> <span style="color: white;">notify</span> <span style="color: white;">the</span> <span style="color: white;">Asterisk</span> <span style="color: white;">server</span> <span style="color: white;">to</span> <span style="color: white;">update</span> <span style="color: white;">the</span> <span style="color: white;">UAs</span> <span style="color: white;">MWI.</span> <span style="color: white;">I</span>
<span style="color: #fb660a; font-weight: bold;">#</span> <span style="color: white;">believe</span> <span style="color: white;">most</span> <span style="color: white;">UAs</span> <span style="color: white;">that</span> <span style="color: white;">support</span> <span style="color: white;">SUBSCRIBE</span> <span style="color: white;">will</span>
<span style="color: #fb660a; font-weight: bold;">#</span> <span style="color: white;">periodically</span> <span style="color: white;">send</span> <span style="color: white;">a</span> <span style="color: white;">SUBSCRIBE</span> <span style="color: white;">message.</span> <span style="color: white;">These</span> <span style="color: white;">cause</span>
<span style="color: #fb660a; font-weight: bold;">#</span> <span style="color: white;">the</span> <span style="color: white;">Asterisk</span> <span style="color: white;">server</span> <span style="color: white;">to</span> <span style="color: white;">update</span> <span style="color: white;">their</span> <span style="color: white;">MWI.</span>
<span style="color: white;">exec_avp(</span><span style="color: #0086d2;">"subscribe sip:$rU@192.168.2.181"</span><span style="color: white;">,</span><span style="color: #0086d2;">"$avp(s:test)"</span><span style="color: white;">);</span>
<span style="color: white;">sl_send_reply(</span><span style="color: #0086d2;">"200"</span><span style="color: white;">,</span><span style="color: #0086d2;">"OK"</span><span style="color: white;">);</span>
<span style="color: white;">break;</span>
<span style="color: white;">};</span>
</pre>
</div>
<br />
where subscribe is a scrip placed in directory <span style="background-color: transparent;"><span style="font-family: 'Courier New', Courier, monospace;"><b>/usr/bin/mwi </b></span></span><br />
A <u>symbolic link</u> of the subscribe script is created in <b><span style="font-family: 'Courier New', Courier, monospace;">/usr/sbin</span></b> directory as well.<br />
<br />
<div>
<a href="http://pastebin.pk/8" target="_blank">subscribe</a></div>
<div>
--------------------------------
</div>
<div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#!/bin/sh</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># this script simply accepts as input the subscriber URI such</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># as sip:1001 at sip01.mycompany.com and "touches" a file with the</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># same name. It stores the file in /var/spool/mwi/immediate</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># which is later processed in a CRON job</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">USER=$1</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># some input arguments may contain ";user=phone" so we need to</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># strip it off. We also need to strip of the "sip:" piece so that</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># all we are left with is "1001 at sip.mycompany.com"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">IDX1=`expr index "$1" ":"`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">IDX1=$(($IDX1 + 1))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">IDX2=`expr index "$1" ";"`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if [ $IDX2 != 0 ]; then</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> IDX2=$(($IDX2 - $IDX1))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> USER=`expr substr $1 $IDX1 $IDX2`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">fi</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">if [ $IDX2 = 0 ]; then</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> USER=`expr substr $1 $IDX1 80`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">fi</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">echo "touch /var/spool/mwi/$USER"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">touch /var/spool/mwi/$USER</span></div>
</div>
<div>
--------------------------------
</div>
<br />
<br />
Once this scripts create a file for the user requesting Voicemail Notify the next script cron-subscribe transports the username to the Asterisk server which is saving the voicemails for that user. The subscribe and the cron-subcribe scripts can be merged into just one script as well.<br />
<br />
<br />
<a href="http://pastebin.pk/7" target="_blank">cron-subscribe</a><br />
<div>
--------------------------------</div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#!/bin/sh</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># this script uses scp to copy the files from /var/spool/mwi/immediate</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># to the Asterisk server. It is important to note that the scp works</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># without being prompted for a password.</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">MSG_HOME=/var/spool/mwi</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">VM_HOME=/var/spool/mwi/immediate</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">for file in $MSG_HOME/*</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">do</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if [ -f $file ]; then</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> echo $file</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> scp $file 192.168.2.86:$VM_HOME</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> rm -f $file</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> fi</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">done</span><br />
<div>
--------------------------------</div>
Don;t forget to create the directory:<br />
<br />
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mkdir -p /var/spool/mwi/</span>
</pre>
</div>
<br /></div>
<div>
Set in cronjob</div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;"><b>* * * * * /usr/bin/mwi/cron-subscribe</b></span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<div style="text-align: center;">
<b><u>IN ASTERISK SERVER/VOICEMAIL DIRECTORY SERVER</u></b><br />
<b><u><br /></u></b></div>
</div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#yum install sipsak</span>
</pre>
</div>
<div>
<br />
Create the following scripts in Asterisk server directory :: <b> <span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">/usr/bin/mwi</span></b><br />
Don't forget to change the IP addresses accordingly in your setup.<br />
<br /></div>
<div>
<span style="background-color: transparent;"><a href="http://pastebin.pk/9">notify.msg</a></span></div>
<div>
---------------------</div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace; font-size: x-small;">NOTIFY sip:SUBSCRIBER SIP/2.0</span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Via: SIP/2.0/UDP 192.168.2.86:5060</span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Max-Forwards: 70</span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace; font-size: x-small;">Route: <sip:SUBSCRIBER></span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace; font-size: x-small;">From: "VM-MWI" <sip:VM-MWI@192.168.2.86:5060></span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">To: <sip:SUBSCRIBER></span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Contact: <sip:VM-MWI@192.168.2.86></span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Call-ID: 29320a42d73ae512NWM4OTc4ODI0YmVlNjJkMjQ1MmJmYTYyOGFlNDMzY2Y.</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">CSeq: 103 NOTIFY</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">User-Agent: Vocemail-MWI Server</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Event: message-summary</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Content-Type: application/simple-message-summary</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Subscription-State: active</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Content-Length: CONTENT_LENGTH</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Messages-Waiting: HAS_MESSAGE</span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Message-Account: sip:*97@</span><span style="font-family: 'Courier New', Courier, monospace;"><b>mysipserver.mycompany.com</b></span></div>
<div style="background-color: transparent;">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">Voice-Message: NEW_COUNT/OLD_COUNT (0/0)</span></div>
</div>
<div>
-----------------------<br />
<br />
notify.msg is the sample file which will get called in cron-mwi-immediate file and all variables will be replaced there and this NOTIFY will be sent out to Kamailio server.<br />
<br />
<br /></div>
<div>
<a href="http://pastebin.pk/10">mwi-immediate</a></div>
<div>
-----------------------</div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#!/bin/sh</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># this script "touches" files in the spool directory which a</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># cron jobs later processes. The cron job is where we actually</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># send the SIP NOTIFY back to the UAs</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">CONTEXT=$1</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">EXTENSION=$2</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">VM_COUNT=$3</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">touch /var/spool/mwi/immediate/$EXTENSION</span></div>
</div>
<div>
-------------------
<br />
<br />
mwi-immediate script is used from within the dialplan. Once we receive a voicemail we can execute this script from asterisk dialplan to send out a NOTIFY after receiving the message.<br />
<br /></div>
<div>
<a href="http://pastebin.pk/11">cron-mwi-immediate</a></div>
<div>
-------------------</div>
<div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#!/bin/sh</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># This script sends the SIP NOTIFY message to UAs. The NOTIFY message</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># can either enable or disable the UA message indicator. The script</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># looks for any file in $VM_HOME and creates the NOTIFY message via</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># the template in $TEMPLATE.</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># The actual NOTIFY message is sent to the SIP proxy by the sipsak</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># utilty. After the message is send we delete the processed file</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># from VM_HOME so we don't keep resending the same message. Most</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># UAs will periodically send a SUBSCRIBE message to the SIP proxy.</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># When this occurs the SIP proxy will place a file in the location</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># /var/spool/mwi/delay and a less frequent CRON job will process it.</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># ALSO NOTE: I am not using the Asterisk "telnet API". I can't</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># remember what it's called, but I think looking for voice mail</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># files on disk is quicker. I do not know if this is 100% safe since</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># I am totally bypassing Asterisk in order to determine if a user has</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># new voice mail messages. Can anyone verify this as a good way to</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># handle this?</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">VM_ROOT=/var/spool/asterisk/voicemail/default</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">VM_HOME=/var/spool/mwi/immediate</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">TEMPLATE=/usr/bin/mwi/notify.msg</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">cd $VM_HOME</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">for file in *</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">do</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #echo $file</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> LEN=`expr length $file`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> IDX1=`expr index "$file" \@`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> IDX2=$(($IDX1 + 1))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> IDX1=$(($IDX1 - 1))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> MAILBOX=`expr substr $file 1 $IDX1`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> DOMAIN=`expr substr $file $IDX2 $LEN`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> TOTAL_MESSAGES=`find $VM_ROOT/$MAILBOX -name "*.txt" |</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> wc -l | sed 's/^ *\(.*\) *$/\1/'`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># echo $TOTAL_MESSAGES</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> NEW_MESSAGES=`find $VM_ROOT/$MAILBOX/INBOX -name "*.txt" |</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> wc -l | sed 's/^ *\(.*\) *$/\1/'`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #echo $NEW_MESSAGES</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> OLD_MESSAGES=$(($TOTAL_MESSAGES - $NEW_MESSAGES))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #echo $OLD_MESSAGES</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> if [ "$NEW_MESSAGES" == "0" ]; then</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> HAS_NEW="no"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> else</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> HAS_NEW="yes"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> fi</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> CONTENT_LENGTH=$((84 + `expr length $HAS_NEW` +</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> `expr length $NEW_MESSAGES` +</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> `expr length $OLD_MESSAGES`))</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #echo $CONTENT_LENGTH</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> CMD="s/SUBSCRIBER/$file/g;s/MAILBOX/$MAILBOX/g;s/CONTENT_LENGTH/$CONTENT_LENGTH/g;s/HAS_MESSAGE/$HAS_NEW/g;s/NEW_COUNT/$NEW_MESSAGES/g;s/OLD_COUNT/$OLD_MESSAGES/g"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> cat /usr/bin/mwi/notify.msg | sed -e $CMD > /tmp/mwi-immediate</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> #echo "Notifying $file"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> `sipsak shoot -a number4 -f /tmp/mwi-immediate -s sip:$file`</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"><br /></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> rm $file</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">done</span></div>
</div>
<div>
<span style="background-color: transparent;">----------------------------------------------------</span></div>
<div>
<br />
This cron-mwi-immediate is the heart of the logic. This script search the directories of the required user and if there are newer messgaes waiting then it takes in the file "notify.msg" and fill in the variables accordingly and shoot out the NOTIFY towards the Kamailio server.<br />
<br />
This NOTIFY is already handled in kamailio configuration.<br />
<br /></div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#mkdir -p /var/spool/mwi/immediate</span>
</pre>
</div>
<div>
<br />
Set in crontab<br />
<b style="background-color: transparent; font-family: 'Courier New', Courier, monospace;"> * * * * /usr/bin/mwi/cron-mwi-immediate</b></div>
<div>
<br />
Thats all... now you'r MWI should work. :)</div>
<div>
<br />
Hope this was a helpful post for the needy one's.</div>
<br />
REF LINK: <a href="http://lists.iptel.org/pipermail/serusers/2004-September/011552.html" style="background-color: transparent;">http://lists.iptel.org/pipermail/serusers/2004-September/011552.html</a><br />
<a href="http://www.voip-info.org/wiki/view/Asterisk+at+large">http://www.voip-info.org/wiki/view/Asterisk+at+large</a>
<br />
<br />
<div>
<br /></div>
</div>Unknownnoreply@blogger.com20tag:blogger.com,1999:blog-7979378259821020425.post-10429217544221610702012-07-08T02:15:00.000-07:002013-01-19T02:51:10.151-08:00OpenSIPS working with Redis<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: transparent;">I recently was trying some experiment to make opensips work with redis. This was pretty easy task but since Redis support in opensips is very new and not much of help is available and to be honest it doesn't require huge documentation to follow to make this work.</span><br />
<br />
As I started on it, I got few minor problems which, I think, are worth writing here so that some other day when I forget these things I could read from here and refresh my memory.<br />
<br />
We already know what is OpenSIPS, now what is Redis !?<br />
<br />
Redis is a Key-Value pair storage tool running in memory - making it super fast, accessible over the network. Redis can be configured in cluster mode to save your data in case one node dies. To know more start from <a href="http://lmgtfy.com/?q=what+is+redis" target="_blank">here</a>. ;)<br />
<br />
<a name='more'></a><br />
<br />
The two things which you obviously require for this are<br />
1- <a href="http://redis.io/topics/quickstart" target="_blank">Redis server</a> installation<br />
2- Hiredis client for Redis (required for opensips)<br />
3- <a href="http://saevolgo.blogspot.com/2012/05/installing-opensips-on-ubuntu-server.html" target="_blank">OpenSIPS server installation</a> (version 1.8)<br />
<br />
But before you proceed with OpenSIPS installation we need to install a prerequisite library <a href="https://github.com/antirez/hiredis" target="_blank">hiredis</a>.<br />
<u><b><br /></b></u>
<u><b>Hiredis installtion.</b></u><br />
These are the steps I performed in order to have Hiredis installed.<br />
<br />
<div style="background: #111111; background: transparent;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@debian:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd /usr/src</span>
<span style="color: white;">root@debian:/usr/src</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># apt-get install git</span>
<span style="color: white;">root@debian:/usr/src</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># git clone https://github.com/redis/hiredis</span>
<span style="color: white;">root@debian:/usr/src</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd hiredis/</span>
<span style="color: white;">root@debian:/usr/src/antirez-hiredis-f8debbf</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make</span>
<span style="color: white;">root@debian:/usr/src/antirez-hiredis-f8debbf</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># make install</span>
</pre>
</div>
<br />
Now edit the opensips Makefile and make sure you've "cachedb_redis" not mentioned in exlude_module<br />
Mine looked like this.<br />
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">exclude_modules?= osp db_oracle \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">#exclude_modules?= b2b_logic jabber cpl-c xmpp rls mi_xmlrpc xcap_client \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># db_mysql db_postgres db_unixodbc db_oracle db_berkeley aaa_radius \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># osp perl snmpstats perlvdb carrierroute mmgeoip \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># presence presence_xml presence_mwi presence_dialoginfo \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># pua pua_bla pua_mi pua_usrloc pua_xmpp pua_dialoginfo \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># ldap h350 identity regex cachedb_memcached cachedb_redis event_rabbitmq \</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"># db_http json python dialplan mi_http</span><br />
<div>
<br /></div>
<div>
<br /></div>
<div>
Once opensips installed I tooka quick look if the required module is placed in directory or not !! and surprisingly it wasn't there.<br />
<br /></div>
<div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@debian:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#ls /usr/local/lib/opensips/modules/</span>
</pre>
</div>
</div>
<div>
<br />
No cachedb_redis.so found :( !!<br />
<br /></div>
<div>
I tried reinstalling carefully but the module shared-object (.so) file wasn't in modules. </div>
<div>
<br /></div>
<div>
I even tried a module specific installation:<br />
<br /></div>
<div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@debian:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#make include_modules="cachedb_redis" modules</span>
</pre>
</div>
<br />
and again no cachedb_redis.so file !!</div>
<div>
<br /></div>
<div>
what resolved this was a symbolic link from the source installation directory of the module where the cachedb_redis.so file was created to the modules directory.<br />
<br /></div>
<div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@debian:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#ln -s /usr/src/svn-src/opensips_1_8/modules/cachedb_redis/cachedb_redis.so /usr/local/lib/opensips/modules/</span>
</pre>
</div>
<br />
This wasn't enough - OpenSIPS did recognize the new module but it agve me an error for hiredis like this.</div>
<div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: #fb660a; font-weight: bold;">
</span></pre>
<pre style="line-height: 125%; margin: 0;"><span style="color: #fb660a; font-weight: bold;">ERROR</span><span style="color: white;">:core:sr_load_module:</span> <span style="color: #fb660a; font-weight: bold;">could</span> <span style="color: #fb660a; font-weight: bold;">not</span> <span style="color: #fb660a; font-weight: bold;">open</span> <span style="color: #fb660a; font-weight: bold;">module</span> <span style="color: white;"></</span><span style="color: #fb660a; font-weight: bold;">usr</span><span style="color: white;">/</span><span style="color: #fb660a; font-weight: bold;">local</span><span style="color: white;">/</span><span style="color: #fb660a; font-weight: bold;">lib</span><span style="color: white;">/</span><span style="color: #fb660a; font-weight: bold;">opensips</span><span style="color: white;">/</span><span style="color: #fb660a; font-weight: bold;">modules</span><span style="color: white;">/</span><span style="color: #fb660a; font-weight: bold;">cachedb_redis</span><span style="color: white;">.so>:</span> <span style="color: #fb660a; font-weight: bold;">libhiredis</span><span style="color: white;">.so.0.10:</span> <span style="color: #fb660a; font-weight: bold;">cannot</span> <span style="color: #fb660a; font-weight: bold;">open</span> <span style="color: #fb660a; font-weight: bold;">shared</span> <span style="color: #fb660a; font-weight: bold;">object</span> <span style="color: #fb660a; font-weight: bold;">file</span><span style="color: white;">:</span> <span style="color: #fb660a; font-weight: bold;">No</span> <span style="color: #fb660a; font-weight: bold;">such</span> <span style="color: #fb660a; font-weight: bold;">file</span> <span style="color: #fb660a; font-weight: bold;">or</span> <span style="color: #fb660a; font-weight: bold;">directory</span>
</pre>
</div>
<div>
<br />
so quickly I executed this command:<br />
<br /></div>
<div style="background: #111111; background: transparent; color: black; overflow: auto; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@debian:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ldconfig -v</span>
</pre>
</div>
<br />
and then opensips started perfectly fine.</div>
<div>
<br /></div>
<div>
Now using redis in the configurations.</div>
<div>
<br /></div>
<div>
loading the module</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">#### ---- REDIS MODULE ---- #####</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">loadmodule "cachedb_redis.so"</span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">modparam("cachedb_redis", "cachedb_url","redis:group1://localhost:6379/")</span></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Now in configuration store values in some key like this</div>
<div>
<span style="background-color: transparent;"><br /></span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">cache_store("redis:group1","Call_Count","$avp(counter)");</span></div>
<div>
<span style="background-color: transparent;"><br /></span></div>
<div>
<span style="background-color: transparent;">To fetch the data:</span></div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">cache_fetch("redis:group1","Call_Count",$avp(101));</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span></div>
<div>
<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">xlog("L_NOTICE","[$pr:$fU@$si:$sp]: Total Calls processed = $avp(101)\n");</span></div>
</div>
<span style="background-color: transparent;">See </span><a href="http://www.opensips.org/Resources/DocsTutKvinterface" style="background-color: transparent;" target="_blank">this link</a><span style="background-color: transparent;"> for some more reading.</span></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7979378259821020425.post-18849990994299097472012-07-05T06:30:00.000-07:002013-05-14T02:46:24.715-07:00OpenSIPS/Kamailio High Availability Clustering - 1<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: center;">
<b><span style="font-size: large;">Using <a href="http://linux-ha.org/wiki/Heartbeat" target="_blank">Heartbeat</a></span></b></div>
<div style="text-align: center;">
<b><br /></b></div>
I've been implementing SIP proxies (Either Kamailio or OpenSIPS) for some time now. These SIP proxies were mainly used to Load-balance the Media-Servers (Asterisks, FreeSWITCH mainly) and detect if any of the Media-Server is down and send its calls to some other available media-server. Thus we don;t need to worry about any of the Asterisk or FreeSWITCH crashes anymore.<br />
<div>
<br /></div>
<div>
But now the Single Point of Failure is the SIP proxy. If our SIP proxy application crashes or the server drops dead then we're nowhere !</div>
<div>
<br /></div>
<div>
In this post we will create a High-Available cluster of SIP proxy. There will be minimum of two SIP proxy servers (Physically unique) in one cluster.</div>
<div>
<br /></div>
<div>
One of the node will be defined as the primary node and our set of applications will run on the primary server. If the application set fails on primary node then our HearBeat will first try to restart it. If the restarting retries fails then it migrates the group of applications to the secondary node or any other node in the cluster.</div>
<div>
<br /></div>
<h4 style="text-align: left;">
<u style="text-align: left;">H</u><u>A Resources</u></h4>
<h4>
<span style="font-weight: normal;">The Set/Group of services which run on the any node in cluster are as follows (Priority in the order written)</span><b><br /></b></h4>
<h4>
<b>1- Floating/Virtual IP</b><span style="font-weight: normal;"><br />This IP is basically the only Public IP assigned on the cluster node. SIP proxy Listens to this address. </span><b><br /></b></h4>
<h4>
<b>2- Linux Default Route</b></h4>
<h4>
<span style="font-weight: normal;">This will use Virtual IP configurations and use it as only way In&Out of Server to Internet.</span></h4>
<h4>
<b>3- SIP proxy</b></h4>
<h4>
<span style="font-weight: normal;">kamailio or OpenSIPS</span><span style="font-weight: normal;"> - </span><span style="font-weight: normal;">This is the primary application which will be monitored for any crashes.</span></h4>
<h4>
<b>4- Add on Applications</b></h4>
<h4>
<span style="font-weight: normal;">Any other applications which are required in combination with SIP proxy and need to be started along with the SIP proxy i.e RTPproxy or Media-Proxy or any other application.</span></h4>
<div>
<h4>
<b><u><br /></u></b></h4>
<h4>
<b><u>Setup Details</u></b><br /><span style="font-weight: normal;">What this setup requires is atleast two physically unique serverswith atleast two NICs. eth0 IP of each server will have a unique Private IP, eth1 of both will be unused. The most important thing to mention here is that we don't set default-gateway on these machines. We can only access these machine from anyother third machine on Private IPs.</span></h4>
</div>
<div>
<div>
The only way these machines connect to internet is that they become primary node. When they become primary node the Public IP is assigned on eth1 and then default-gateway is set by the heartbeat application.</div>
<div>
Once the default-gateway is set on primary node only then internet is accessible.<br />
<h4 style="text-align: left;">
<span style="text-align: left;"><u><br /></u></span></h4>
<h4 style="text-align: left;">
<span style="text-align: left;"><u>Setup Diagram</u></span></h4>
</div>
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-FdDHKNrhxmY/T_V166UAuDI/AAAAAAAABGw/IKhw9WQ3y_c/s1600/SIPproxy-HA.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="247" src="http://4.bp.blogspot.com/-FdDHKNrhxmY/T_V166UAuDI/AAAAAAAABGw/IKhw9WQ3y_c/s320/SIPproxy-HA.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">SIP proxy HA design</td></tr>
</tbody></table>
<br />
<div>
We have a separate independent Database for SIP proxy servers to save the User-Location Records. In case of primary server failure the secondary servers connects to the same DB and have all the registered users and active calls record in DB already. This is the key for this setup to work.</div>
<div>
<br /></div>
<div>
Read on to <a href="http://saevolgo.blogspot.com/2013/05/opensipskamailio-high-availability.html" target="_blank">this blog's Second part</a> on creating such a setup.</div>
</div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-7979378259821020425.post-48089356047931401642012-06-19T13:43:00.001-07:002012-06-19T23:02:07.299-07:00Multi-Site OpenVPN Interconnect [Server-Client mode] + GRE tunnel over OpenVPN<div dir="ltr" style="text-align: left;" trbidi="on">
Last time I connected two sites, with one site behind NAT router and had no direct Public access, so then I continued with the setup and wanted to add another node into my network and this time it was my another cousin's home I invaded, setup Vyatta at their home and created a 3-Site OpenVPN network in Server-Client fashion.This can grow from 3 to N sites if I need.<br />
<br />
<br />
Here's the network topology I worked on.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-J91V_KQmDOI/T-Dc-xaGr0I/AAAAAAAABGk/P9ufSECx-Bo/s1600/openvpn-vyatta.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="246" src="http://1.bp.blogspot.com/-J91V_KQmDOI/T-Dc-xaGr0I/AAAAAAAABGk/P9ufSECx-Bo/s320/openvpn-vyatta.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Server-Client 3 Site OpenVPN network diagram</td></tr>
</tbody></table>
<b style="background-color: transparent;"><u>Main-Site</u></b><br />
<span style="background-color: transparent;">Now Starting from Main-Site Vyatta, create the required certificates and keys files for Server as well as the clients</span><span style="background-color: transparent;">.</span><br />
<br />
<div style="background: #111111; background: transparent; border-width: .1em .1em .1em .8em; border: none; color: black; overflow: auto; padding: .2em .6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">vyatta@Main-Vyatta:~$</span> <span style="color: white;">sudo</span> <span style="color: white;">su</span> <span style="color: white;">-</span>
<span style="color: white;">root@Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd /usr/share/doc/openvpn/examples/easy-rsa/2.0</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cp * /etc/openvpn/</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># cd /etc/openvpn/</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># nano vars </span>
</pre>
</div>
<br />
Edit the parameter<br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_DIR="/config/auth"</span><br />
<br />
These parameters should be modified too.<br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_COUNTRY="US"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_PROVINCE="CA"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_CITY="SanFrancisco"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_ORG="Fort-Funston"</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">export KEY_EMAIL="me@myhost.mydomain"</span><br />
<br />
Save and Exit<br />
<br />
Now execute<br />
<div style="background: #111111; background: transparent; border-width: .1em .1em .1em .8em; border: none; color: black; overflow: auto; padding: .2em .6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># source ./vars</span>
</pre>
</div>
now Build CA<br />
<br />
<div style="background: #111111; background: transparent; border-width: .1em .1em .1em .8em; border: none; color: black; overflow: auto; padding: .2em .6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./build-ca</span>
</pre>
</div>
<br />
Enter Data as inquired.<br />
<br />
After this completes you should be able to have an output like this<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ls /config/auth/</span>
<span style="color: white;">ca.crt</span> <span style="color: white;">ca.key</span></pre>
Now time to Build Server side CA<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># touch /config/auth/index.txt</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># echo 01 > /config/auth/serial</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./build-key-server Main-Vyatta</span></pre>
<br />
This will ask at the end<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">1 out of 1 certificate requests certified, commit? [y/n]y</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Write out database with 1 new entries</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">Data Base Updated</span><br />
<br />
Next generate DH parameters file<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./build-dh</span></pre>
<br />
Now all set. Time to generate files for the Remote end points/Clients.<br />
<br />
I've genrates Client files in password protected mode. This password will be asked whenever any client tries to use these files. If this matches then the setup will proceed on remote end.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./build-key-pass site1</span></pre>
<br />
Again questions will be asked, type as you like.<br />
<br />
Buliding another set of files for the second remote-site;<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ./build-key-pass site2</span></pre>
<br />
At this point these are the contents of my /config/auth directory<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ls /config/auth/</span>
<span style="color: #0086f7; font-weight: bold;">01.</span><span style="color: white;">pem</span> <span style="color: #0086f7; font-weight: bold;">03.</span><span style="color: white;">pem</span> <span style="color: white;">Main-Vyatta.csr</span> <span style="color: white;">ca.crt</span> <span style="color: white;">dh1024.pem</span> <span style="color: white;">index.txt.attr</span> <span style="color: white;">index.txt.old</span> <span style="color: white;">serial.old</span> <span style="color: white;">site1.csr</span> <span style="color: white;">site2.crt</span> <span style="color: white;">site2.key</span>
<span style="color: #0086f7; font-weight: bold;">02.</span><span style="color: white;">pem</span> <span style="color: white;">Main-Vyatta.crt</span> <span style="color: white;">Main-Vyatta.key</span> <span style="color: white;">ca.key</span> <span style="color: white;">index.txt</span> <span style="color: white;">index.txt.attr.old</span> <span style="color: white;">serial</span> <span style="color: white;">site1.crt</span> <span style="color: white;">site1.key</span> <span style="color: white;">site2.csr</span>
<span style="color: white;">root@Main-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># exit</span></pre>
<br />
<br />
Do the last step of generating site certificates and keys for as many sites as could be in the network i.e "<span style="background-color: transparent; font-family: 'Courier New', Courier, monospace;">./build-key-pass siteN</span><span style="background-color: transparent;">".I only had access to two distinct locations.</span><br />
<br />
Now time to get back to Main-Router's Vyatta Console.<br />
<br />
Explaining the lines below before it gets too complicated. I declared a server mode OpenVPN interface vtun0 on Main Vyatta. Set static IPs of each site into the node so they don't change their IPs on reboots and mess up with my static routes(see at the end). Also I declared the subnets on each site so vtun0 knows which subnet is located on which site.<br />
Then I configured vtun0 to use the TLS keys and certificates for Main-Vyatta. Thats it. Server is done.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Main-Vyatta:~$</span> <span style="color: white;">configure</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 mode server</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server subnet 172.16.15.0/24</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server topology point-to-point</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server client site1 ip 172.16.15.2</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server client site1 subnet 192.168.114.0/24</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server client site2 ip 172.16.15.3</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 server client site2 subnet 10.10.1.0/24</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 tls ca-cert-file /config/auth/ca.crt</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 tls cert-file /config/auth/Main-Vyatta.crt</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 tls dh-file /config/auth/dh1024.pem</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces openvpn vtun0 tls key-file /config/auth/Main-Vyatta.key</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># commit</span></pre>
<br />
Now time to export the files to the Site-1 and Site-2 so they use their files accordingly.<br />
This should be done in a more secure way, make sure we don't atleast loose the ca.crt file to any hacker.<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># sudo cp /config/auth/site* /tmp/</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># sudo chown vyatta /tmp/site*</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># sudo cp /config/auth/ca.crt /tmp/</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># sudo chown vyatta /tmp/ca.crt</span></pre>
<br />
<br />
Copy-pasted the files in /tmp directory and changed the ownership of files so that they can be fetched by remote ends via SCP.<br />
<b style="background-color: transparent;"><u>Site-1</u></b><br />
Goto Site1 Router and fetch the files from the Main-Site:<br />
<br />
Goto Linux root console<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">root@Site1-Vyatta~:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># scp vyatta@172.16.31.101:/tmp/site1.* /tmp/</span>
<span style="color: white;">root@Site1-Vyatta~:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># scp vyatta@172.16.31.101:/tmp/ca.crt /tmp/</span>
<span style="color: white;">root@Site1-Vyatta~:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># mv /tmp/* /config/auth/</span>
<span style="color: white;">root@Site1-Vyatta~:</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># exit</span></pre>
<br />
Back to Vyatta console<br />
<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interface openvpn vtun0 mode client</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interface openvpn vtun0 remote-host 123.111.222.2</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interface openvpn vtun0 tls ca-cert-file /config/auth/ca.crt</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interface openvpn vtun0 tls cert-file /config/auth/site1.crt</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interface openvpn vtun0 tls key-file /config/auth/site1.key</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span></pre>
<br />
<br />
In above steps I've only defined that the remote server is on IP 123.111.222.2 and the mode of this OpenVPN interface vtun0 is client then certificates and keys are configured.<br />
<br />
Once you commit it , it'll ask about the passphrase that we entered on server while creating it.<br />
<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#save</span>
<span style="color: white;">vyatta@Site1-Vyatta:</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#exit</span>
<span style="color: white;">vyatta@Site1-Vyatta:~$</span> <span style="color: white;">show</span> <span style="color: white;">interfaces</span>
<span style="color: white;">Codes:</span> <span style="color: white;">S</span> <span style="color: white;">-</span> <span style="color: white;">State,</span> <span style="color: white;">L</span> <span style="color: white;">-</span> <span style="color: white;">Link,</span> <span style="color: white;">u</span> <span style="color: white;">-</span> <span style="color: white;">Up,</span> <span style="color: white;">D</span> <span style="color: white;">-</span> <span style="color: white;">Down,</span> <span style="color: white;">A</span> <span style="color: white;">-</span> <span style="color: white;">Admin</span> <span style="color: white;">Down</span>
<span style="color: white;">Interface</span> <span style="color: white;">IP</span> <span style="color: white;">Address</span> <span style="color: white;">S/L</span> <span style="color: white;">Description</span>
<span style="color: white;">---------</span> <span style="color: white;">----------</span> <span style="color: white;">---</span> <span style="color: white;">-----------</span>
<span style="color: white;">eth0</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">137.2</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">u/u</span>
<span style="color: white;">eth1</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">114.2</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">u/u</span>
<span style="color: white;">lo</span> <span style="color: #0086f7; font-weight: bold;">127.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.1</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">8</span> <span style="color: white;">u/u</span>
<span style="color: white;">::</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">128</span>
<span style="color: white;">vtun0</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.3</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">u/u</span>
<span style="color: white;">vyatta@vyatta:~$</span></pre>
<br />
Repeat the same steps of Site1 on Site2.<br />
<br />
After this just add Static Routes in Main-Router for each subnets and Viola !!<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set protocols static route 10.10.1.0/24 next-hop 172.16.15.3</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set protocols static route 192.168.114.0/24 next-hop 172.16.15.2</span></pre>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># run show ip route</span>
<span style="color: white;">Codes:</span> <span style="color: white;">K</span> <span style="color: white;">-</span> <span style="color: white;">kernel</span> <span style="color: white;">route,</span> <span style="color: white;">C</span> <span style="color: white;">-</span> <span style="color: white;">connected,</span> <span style="color: white;">S</span> <span style="color: white;">-</span> <span style="color: white;">static,</span> <span style="color: white;">R</span> <span style="color: white;">-</span> <span style="color: white;">RIP,</span> <span style="color: white;">O</span> <span style="color: white;">-</span> <span style="color: white;">OSPF,</span>
<span style="color: white;">I</span> <span style="color: white;">-</span> <span style="color: white;">ISIS,</span> <span style="color: white;">B</span> <span style="color: white;">-</span> <span style="color: white;">BGP,</span> <span style="color: white;">></span> <span style="color: white;">-</span> <span style="color: white;">selected</span> <span style="color: white;">route,</span> <span style="color: white;">*</span> <span style="color: white;">-</span> <span style="color: white;">FIB</span> <span style="color: white;">route</span>
<span style="color: white;">S>*</span> <span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">0</span> <span style="color: white;">[</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">]</span> <span style="color: white;">via</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">2.50</span><span style="color: white;">,</span> <span style="color: white;">eth0</span>
<span style="color: white;">S>*</span> <span style="color: #0086f7; font-weight: bold;">10.10</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">1.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">[</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">]</span> <span style="color: white;">via</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.3</span> <span style="color: white;">,</span> <span style="color: white;">vtun0</span>
<span style="color: white;">C>*</span> <span style="color: #0086f7; font-weight: bold;">127.0</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">8</span> <span style="color: white;">is</span> <span style="color: white;">directly</span> <span style="color: white;">connected,</span> <span style="color: white;">lo</span>
<span style="color: white;">C>*</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">0.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">16</span> <span style="color: white;">is</span> <span style="color: white;">directly</span> <span style="color: white;">connected,</span> <span style="color: white;">eth0</span>
<span style="color: white;">K>*</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">via</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.2</span><span style="color: white;">,</span> <span style="color: white;">vtun0</span>
<span style="color: white;">C>*</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.2</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">32</span> <span style="color: white;">is</span> <span style="color: white;">directly</span> <span style="color: white;">connected,</span> <span style="color: white;">vtun0</span>
<span style="color: white;">C>*</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">30.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">is</span> <span style="color: white;">directly</span> <span style="color: white;">connected,</span> <span style="color: white;">eth1</span>
<span style="color: white;">S>*</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">114.0</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">24</span> <span style="color: white;">[</span><span style="color: #0086f7; font-weight: bold;">1</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">]</span> <span style="color: white;">via</span> <span style="color: #0086f7; font-weight: bold;">172.16</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">15.2</span><span style="color: white;">,</span> <span style="color: white;">vtun0</span>
<span style="color: white;">[edit]</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ping 192.168.114.2</span>
<span style="color: white;">PING</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">114.2</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">114.2</span><span style="color: white;">)</span> <span style="color: #0086f7; font-weight: bold;">56</span><span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">84</span><span style="color: white;">)</span> <span style="color: white;">bytes</span> <span style="color: white;">of</span> <span style="color: white;">data.</span>
<span style="color: #0086f7; font-weight: bold;">64</span> <span style="color: white;">bytes</span> <span style="color: #fb660a; font-weight: bold;">from</span> <span style="color: white;">192.168.114.2:</span> <span style="color: white;">icmp_req=1</span> <span style="color: white;">ttl=64</span> <span style="color: white;">time=2.25</span> <span style="color: white;">ms</span>
<span style="color: white;">^C</span>
<span style="color: white;">---</span> <span style="color: #0086f7; font-weight: bold;">192.168</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">114.2</span> <span style="color: white;">ping</span> <span style="color: white;">statistics</span> <span style="color: white;">---</span>
<span style="color: #0086f7; font-weight: bold;">1</span> <span style="color: white;">packets</span> <span style="color: white;">transmitted,</span> <span style="color: #0086f7; font-weight: bold;">1</span> <span style="color: white;">received,</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">%</span> <span style="color: white;">packet</span> <span style="color: white;">loss,</span> <span style="color: white;">time</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">ms</span>
<span style="color: white;">rtt</span> <span style="color: white;">min/avg/max/mdev</span> <span style="color: white;">=</span> <span style="color: #0086f7; font-weight: bold;">2.250</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">2.250</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">2.250</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">0.000</span> <span style="color: white;">ms</span>
<span style="color: white;">[edit]</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># ping 10.10.1.1</span>
<span style="color: white;">PING</span> <span style="color: #0086f7; font-weight: bold;">10.10</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">1.1</span> <span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">10.10</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">1.1</span><span style="color: white;">)</span> <span style="color: #0086f7; font-weight: bold;">56</span><span style="color: white;">(</span><span style="color: #0086f7; font-weight: bold;">84</span><span style="color: white;">)</span> <span style="color: white;">bytes</span> <span style="color: white;">of</span> <span style="color: white;">data.</span>
<span style="color: #0086f7; font-weight: bold;">64</span> <span style="color: white;">bytes</span> <span style="color: #fb660a; font-weight: bold;">from</span> <span style="color: white;">10.10.1.1:</span> <span style="color: white;">icmp_req=1</span> <span style="color: white;">ttl=64</span> <span style="color: white;">time=21.9</span> <span style="color: white;">ms</span>
<span style="color: #0086f7; font-weight: bold;">64</span> <span style="color: white;">bytes</span> <span style="color: #fb660a; font-weight: bold;">from</span> <span style="color: white;">10.10.1.1:</span> <span style="color: white;">icmp_req=2</span> <span style="color: white;">ttl=64</span> <span style="color: white;">time=3.29</span> <span style="color: white;">ms</span>
<span style="color: white;">^C</span>
<span style="color: white;">---</span> <span style="color: #0086f7; font-weight: bold;">10.10</span><span style="color: white;">.</span><span style="color: #0086f7; font-weight: bold;">1.1</span> <span style="color: white;">ping</span> <span style="color: white;">statistics</span> <span style="color: white;">---</span>
<span style="color: #0086f7; font-weight: bold;">2</span> <span style="color: white;">packets</span> <span style="color: white;">transmitted,</span> <span style="color: #0086f7; font-weight: bold;">2</span> <span style="color: white;">received,</span> <span style="color: #0086f7; font-weight: bold;">0</span><span style="color: white;">%</span> <span style="color: white;">packet</span> <span style="color: white;">loss,</span> <span style="color: white;">time</span> <span style="color: #0086f7; font-weight: bold;">1001</span><span style="color: white;">ms</span>
<span style="color: white;">rtt</span> <span style="color: white;">min/avg/max/mdev</span> <span style="color: white;">=</span> <span style="color: #0086f7; font-weight: bold;">3.297</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">12.603</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">21.909</span><span style="color: white;">/</span><span style="color: #0086f7; font-weight: bold;">9.306</span> <span style="color: white;">ms</span>
<span style="color: white;">[edit]</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#</span></pre>
<br />
<div>
<br /></div>
<div>
Thats it, we are done here. I did something interesting while doing it as well. Like Creating a GRE tunnel over OpenVPN.<br />
<br />
<h2 style="text-align: center;">
<b><u>GRE over OpenVPN</u></b></h2>
</div>
<div>
This has nothing to do with the static Routes. Once the OpenVPN is set and I was able to ping between the 172.16.15.0/24 subnet I went to Main-Vyatta created a tun0 GRE interface and set the remote and local IPs to use for this tunnel.</div>
<div>
<br />
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun0 encapsulation gre</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun0 remote-ip 172.16.15.2</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun0 local-ip 172.16.15.1</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun0 address 10.20.20.1/30</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun1 address 10.20.20.5/30</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun1 remote-ip 172.16.15.3</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun1 local-ip 172.16.15.1</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># set interfaces tunnel tun1 encapsulation gre</span>
<span style="color: white;">vyatta@Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;"># commit</span></pre>
<br />
<div>
Then on the 172.16.15.2/Site1 I ran the following commands</div>
<div>
<br /></div>
<div>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Site1-Vyatta:~$</span> <span style="color: white;">configure</span>
<span style="color: white;">vyatta@Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 address 10.20.20.2/30</span>
<span style="color: white;">vyatta@Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 local-ip 172.16.15.2</span>
<span style="color: white;">vyatta@Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 remote-ip 172.16.15.1</span>
<span style="color: white;">vyatta@Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 encapsulation gre</span>
<span style="color: white;">vyatta@Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span></pre>
</div>
<div>
<br /></div>
<div>
<br />
<div>
Then on the 172.16.15.3/Site2 I ran the following commands</div>
<div>
<br /></div>
<div>
<br />
<pre style="line-height: 16px; text-align: -webkit-auto;"><span style="color: white;">vyatta@Site2-Vyatta:~$</span> <span style="color: white;">configure</span>
<span style="color: white;">vyatta@Site2-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 address 10.20.20.6/30</span>
<span style="color: white;">vyatta@Site2-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 local-ip 172.16.15.3</span>
<span style="color: white;">vyatta@Site2-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 remote-ip 172.16.15.1</span>
<span style="color: white;">vyatta@Site2-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces tunnel tun0 encapsulation gre</span>
<span style="color: white;">vyatta@Site2-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span></pre>
</div>
<div>
<br /></div>
<div>
<br />
That's it I was able to ping between Main-Site IP:10.20.20.1 and Site-1 10.20.20.2, similarly site-2 10.20.20.6 was able to ping Main-Site tunnel interface 10.20.20.5 :)</div>
<div>
<br />
I've couple more ideas in mind to play with VPNs on Vyatta and then I'll revert back to VoIP Stuff.<br />
<br /></div>
<div>
<br /></div>
</div>
</div>
</div>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-7979378259821020425.post-27997819097517875182012-06-18T10:15:00.002-07:002012-06-18T11:16:20.163-07:00OpenVPN with Vyatta [Site Behind NAT | Firewall]<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Yesterday I was at my cousin's place and suddenly I remembered that I forgot to bring some documents from my desktop at home, going back home wasn't an option. I knew I've Static IP provisioned at home and at cousin's place its Dynamic IP modem.<br />
<br />
It was a good thing that Vyatta controls my home internet traffic so I quickly accessed my vyata-router and from there fetching documents was a piece of cake.<br />
Later I decided to create a VPN between me and my cousin's home so we could always access our "Shared Documents" without involving any hi-fi router/linux commands.<br />
<br />
<b>So here is the scenario:</b><br />
<u>Main Site/My Home:</u> It listen for incoming OpenVPN requests and then listen for RIP messages.<br />
<u>Site-B/Cousin's Home:</u> This initiates a VPN to main-site and shares the network routing table via RIP protocol.<br />
<br />
Note that only Main Site haS static IP and other site has dynamic IP which changes on every reset maybe. So after this setup I will be able to access their home network without caring for their Public IPs.<br />
<br />
Here is a network diagram for better understanding.<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-U_Y7g1VRYNo/T99Vzm1MrwI/AAAAAAAABGY/mMwVx8Yyb9s/s1600/site-2-site-openvpn-vyatta.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="246" src="http://1.bp.blogspot.com/-U_Y7g1VRYNo/T99Vzm1MrwI/AAAAAAAABGY/mMwVx8Yyb9s/s320/site-2-site-openvpn-vyatta.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Site-to-Site OpenVPN tunnel topology</td></tr>
</tbody></table>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<u style="background-color: transparent;"><b>Main-Site Router:</b></u><br />
Here's the break down of the commands you're about to see. Assign the Public IP, set the gateway address, set the public DNS server, <span style="color: red;">start the SSH service</span><span style="color: #cc0000;"> </span>(<span style="color: red;">This is optional - don't do this to risk your router by making it's SSH accessible over the internet</span>)<br />
<br />
Then the LAN interface was configured, I verified that router's internet connectivity is good by resolving www.msn.com and then later I pinged it as well. All perfect at this point.<br />
<br />
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: transparent; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="margin: 0px;"><span style="color: white; line-height: 125%;">Main-Vyatta:~$<span style="background-color: #0f140f; color: lime; font-style: italic;">configure</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces ethernet eth0 address 123.111.222.2/30</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set system gateway-address 123.111.222.1</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set system name-server 8.8.8.8</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set service ssh</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces ethernet eth1 address 10.10.1.1/24</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#sudo nslookup www.msn.com</span>
</span><span style="line-height: 125%;"> </span><div>
</div>
<span style="background-color: transparent; font-family: 'Times New Roman'; white-space: normal;">Then I created NAT rules for my LAN stations to reach out internet by NAT'd to Public IP. </span>
<span style="color: white; line-height: 125%;"><span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set nat source rule 5 outbound-interface eth0</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set nat source rule 5 source address 10.10.1.1/24</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set nat source rule 5 translation address masquerade</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#exit</span>
</span></pre>
<pre style="margin: 0px;"><span style="color: white; line-height: 125%;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></span></pre>
</div>
Uptil here, my Home network is all set. Now Starting the OpenVPN Setup.<br />
Create openvpn key , copy it it temporary directory, change its user ownership.<br />
<br />
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: transparent; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">$generate openvpn key /etc/openvpn/key.psk</span>
<span style="color: white;">Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">$sudo cp /etc/openvpn/key.psk /tmp/</span>
<span style="color: white;">Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">$sudo chown vyatta /tmp/key.psk</span>
<span style="color: white;">Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">$ls -l /etc/openvpn/key.psk</span>
<span style="color: white;">Main-Vyatta:~</span><span style="background-color: #0f140f; color: lime; font-style: italic;">$configure</span>
</pre>
<pre style="line-height: 125%; margin: 0px;"><span style="color: lime;"><i>
</i></span></pre>
Create openVPN interface vtun0 with a Local-IP to assign and a remote IP.<br />
<br />
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 mode site-to-site</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 local-address 172.16.1.1</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 remote-address 172.16.1.2</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 shared-secret-key-file /etc/openvpn/key.psk</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span></pre>
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
</div>
</div>
In last five lines above I've created a "vtun0" interface of type openvpn. Its mode is set to site-to-site. Main site is addressed as 172.16.1.1, other site have this as its remote site address, and very important step to use the key file.<br />
<br />
Start RIP interface on Main router's vtun0 interface to accept other side routes.<br />
<br />
<div style="background: #111111; background: transparent; border-width: .1em .1em .1em .8em; border: none; color: black; overflow: auto; padding: .2em .6em; width: auto;">
<pre style="line-height: 125%; margin: 0;"><span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip interface vtun0</span>
<span style="color: white;">Main-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip neighbor 172.16.1.2</span>
</pre>
</div>
<u style="background-color: transparent;"><br /></u><br />
<u style="background-color: transparent;"><b>Now, Site-B Router.</b></u><br />
<u style="background-color: transparent;"><br /></u><br />
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: transparent; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Site1-Vyatta$configure</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces ethernet eth0 address 192.168.1.2/24</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces ethernet eth1 10.1.3.1/24</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set system gateway-address 192.168.1.1</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set service ssh</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span>
</pre>
<br />
Configure the Site1 router's IP address, gateway is the DSL modem 192.168.2.1, name server, and NAT rules and interface for this LAN should be set as well, Im skipping those.<br />
<br />
Fetch the OpenVPN Key for this site to use.</div>
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: transparent; overflow: auto; padding: 0.2em 0.6em; width: auto;">
<br />
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#sudo scp vyatta@123.111.222.2:/tmp/key.psk /etc/openvpn/key.psk</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#sudo chown root:root /etc/openvpn/key.psk</span>
</pre>
Now, time to configure the "vtun0" interface. Once we commit this this router will try connecting to the Main-Site router.<br />
<br />
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 mode site-to-site</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 local-address 172.16.1.2</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 remote-address 172.16.1.1</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 remote-host 123.111.222.2</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set interfaces openvpn vtun0 shared-secret-key-file /etc/openvpn/key.psk</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#save</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#exit</span>
<span style="color: white;">Site1-Vyatta$show</span> <span style="color: white;">interfaces</span>
<span style="color: white;">
</span></pre>
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">
</span></pre>
<div style="background-color: transparent; background-position: initial initial; background-repeat: initial initial; border: transparent; overflow: auto; padding: 0.2em 0.6em; width: auto;">
Executing the show interfaces will show the new interface.<br />
<br />
<span style="background-color: transparent;">Now, Time to advertise my local network to the Main-Site, this way the Main-Site router will get to know which next-hop to take for reaching to 10.1.3.0/24 network.</span><br />
<span style="background-color: transparent;"><br /></span></div>
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="color: white;">Site1-Vyatta$configure</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip interface eth0</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip network 10.1.3.0/24</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip neighbor 172.16.1.1</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#set protocols rip interface vtun0</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#commit</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#save</span>
<span style="color: white;">Site1-Vyatta</span><span style="background-color: #0f140f; color: lime; font-style: italic;">#exit</span>
</pre>
<pre style="color: black; line-height: 125%; margin: 0px;"><span style="background-color: #0f140f; color: lime; font-style: italic;">
</span></pre>
<br />
Thats all, everything is set and should be working fine. Ping from Main-Site to Site-B is flowing smoothly.<br />
<br />
I'm thinking of exploring different ways and types of creating VPN between two or more Vyatta routers. Hope to publish those soon too.<br />
<br /></div>
</div>Unknownnoreply@blogger.com3