Hi Bogdan,<div><br></div><div>Thanks for being so patient.</div><div>I''ll try to explain, ofcourse OpenSIPS should be te register and proxy, do authentication etc.</div><div>The Asterisk servers should always be in the call path for rtp streams. So OpenSIPS should also keep state and forward sip messages.</div>
<div><br></div><div>In FreePBX (Asterisk) there are options to not allow anonymous sip invite's If Asterisk and OpenSIPS do not share the database subscribers can not register with Asterisk. Asterisk will only allow invite requests from the proxy. And there is an option not not allow the party that is being called to do on hold and dial out.</div>
<div><br></div><div>Sometimes it is difficult to explain but OpenSIPS should receive an invite from Ekiga,net or a local subscriber.</div><div>Check the usrloc and alias table, send an invite to the destination (101@ourdomain or user@ekiga dials 102@ourdomain. Then the destination 102 is invited and both are send to Asterisk</div>
<div><br></div><div>But for this I do not need an on_reply route? You gave me the option to do dialplan translation.</div><div>Last night I only took the parts I am really sure about, so the below part is just incomplete but hopefully shows what I am trying to do.</div>
<div><br>Thanks</div><div><br></div><div>Albert</div><div><br></div><div><div># ----- main routing logic ----- #</div><div><br></div><div>route{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (!mf_process_maxfwd_header("10")) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> sl_send_reply("483","Too Many Hops looping");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>-------------------------- ^ initial and or sequential requests</div><div>
<br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># handle cancel and re-transmissions</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (is_method("CANCEL"))</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (t_check_trans())</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>t_relay();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>t_check_trans();</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># authenticate if from local subscriber multidomain version</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (!(method=="REGISTER") && is_from_local()) </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if(!proxy_authorize("","subscriber")) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>proxy_challenge("","0");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}<span class="Apple-tab-span" style="white-space:pre">        </span> </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (!db_check_from()) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>sl_send_reply("","Forbidden auth ID");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>consume_credentials();<span class="Apple-tab-span" style="white-space:pre">                        </span># caller authenticated</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div>-------------------</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># requests for my domain</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (!lookup("location")) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($rU==NULL) {<span class="Apple-tab-span" style="white-space:pre">                        </span>#request with no Username in RURI</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>send_reply("484","Address Incomplete");</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div>--------------------------</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># Dialplan transformation #</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>dp_translate("1");<span class="Apple-tab-span" style="white-space:pre">                        </span># dialplan ID</div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span>switch ($avp(attrs) ) {</div><div> <span class="Apple-tab-span" style="white-space:pre">        </span> case "usrloc" :</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> load_balance("1","usrloc");<span class="Apple-tab-span" style="white-space:pre">        </span># local subscribers & sip requests</div>
<div> break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case "pstn" :</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> load_balance("1","pstn");<span class="Apple-tab-span" style="white-space:pre">                </span># free pstn destinations</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case "media" :</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> load_balance("1","media");<span class="Apple-tab-span" style="white-space:pre">        </span># media services</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case "prepaid" :</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> load_balance("1","prepaid");<span class="Apple-tab-span" style="white-space:pre">        </span># non-free pstn destinantions</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> case "announcement" :</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> load_balance("1","announcement");<span class="Apple-tab-span" style="white-space:pre">        </span># </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($retcode<0) {...</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>---------------------------</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>failure_route[1] {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (t_was_cancelled()) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span># failure code "408 - timeout", "484 - Address Incomplete", "486 - busy"</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span># forward the calls to voicemail recording</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (t_check_status("408")) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>prefix("timeout_");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>load_balance("1","media");</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>} else</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (t_check_status("484"); {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>prefix("incomplete_");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>load_balance("1","media");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>} else</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (t_check_status("486")) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>prefix("busy_");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>load_balance("1","media");</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>} else {<span class="Apple-tab-span" style="white-space:pre">                                </span># unknown service</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>prefix("notavailable_");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>load_balance("1","media");</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>t_relay();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>exit;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
</div><div><br></div>