<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi,</div><div>is there someone could give me a hint on how to configure this module?</div><div>I can see that the call is going out to my external gateway interrogating the routing table, however I'm getting a CANCEL from Kamailio.</div><div><br></div><div>If using this cr_route I can see that users can't place calls themself (internal calls) because all calls are going out to the external IP.</div><div>In my opinion the cr_route should be placed replacing PSTN route, right?</div><div>However I'm still getting the problem.</div><div><br></div><div>Thanks</div><div>Max</div><div><br></div><div><br></div><div><br></div><br><div><br><div>Inizio messaggio inoltrato:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Da: </b></span><span style="font-family:'Helvetica'; font-size:medium;">"Massimo Varriale (IPZeta)" <<a href="mailto:m.varriale@ipzeta.it">m.varriale@ipzeta.it</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Oggetto: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>[Kamailio 4.2.0] Carrieroute Routing Questions</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Data: </b></span><span style="font-family:'Helvetica'; font-size:medium;">25 novembre 2014 16:27:05 GMT+01:00<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>A: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Guys,<div>I'm new on Kamailio and this list, so be patient with me :)</div><div><br></div><div>I've built an almost "complete" working SIP server on Ubuntu 14.04 LTS.</div><div>I told almost complete because my problem is with carrierroute module because I'm not understanding the routing file and where I should put the code to use function <b>cr_route</b></div><div><br></div><div>I would like to allow SIP calls/video between users for free and send calls to different external Gateways / Switches, etc based on the dialled destination.</div><div><br></div><div>In particular, I can send outbound calls a prepaid platform that will allow to bill calls based on CLI validation, but in all my tests, it seems that calls are going out always to the IP address of the remote gateway found into the carrierroute table ignoring the SIP user I'm calling.....what is the correct routing?</div><div><br></div><div>I'm finding some docs around there, but some refer to very old versions of Kamailio and some others are not clear to me.</div><div><br></div><div>What's wrong with my routing logic?</div><div><br></div><div>Thank you so much!</div><div>Max</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><div><font class="Apple-style-span" face="Courier">route {</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span># per request initial checks</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">    </span>route(REQINIT);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">   </span># NAT detection</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>route(NAT);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">       </span># handle requests within SIP dialogs</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">    </span>route(WITHINDLG);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>### only initial requests (no To tag)</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span># CANCEL processing</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span>if (is_method("CANCEL"))</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span>{</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">               </span>if (t_check_trans())</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">                    </span>t_relay();</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">              </span>exit;</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">   </span>}</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>t_check_trans();</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span># authentication</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>route(AUTH);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span># record routing for dialog forming requests (in case they are routed)</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span># - remove preloaded route headers</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span>remove_hf("Route");</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">   </span>if (is_method("INVITE|SUBSCRIBE"))</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">            </span>record_route();</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">   </span># account only INVITEs</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span>if (is_method("INVITE"))</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span>{</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">               </span>setflag(FLT_ACC); # do accounting</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">       </span>}</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">               </font></span></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span># dispatch requests to foreign domains</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span>route(SIPOUT);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">    </span>### requests for my local domains</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span># handle presence related requests</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span>route(PRESENCE);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span># handle registrations</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span>route(REGISTRAR);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>if ($rU==$null)</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>{</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">               </span># request with no Username in RURI</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">              </span>sl_send_reply("484","Address Incomplete");</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">          </span>exit;</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">   </span>}</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span># dispatch destinations to PSTN</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>#route(PSTN);</font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">           </font></span></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span># CARRIERROUTE MODULE routing logic</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">     </span># check table for carrier default and domain default</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">    </span>if(!cr_route("default", "default", "$rU", "$rU", "call_id")){</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">         </span>sl_send_reply("403", "Not allowed");</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span>} else {</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">                </span># In case of failure, re-route the request</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">              </span>t_on_failure("1");</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">            </span># Relay the request to the gateway</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">              </span>t_relay();</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">      </span>}<span class="Apple-tab-span" style="white-space:pre">                   </span></font></div><div><font class="Apple-style-span" face="Courier"> </font></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">      </font></span></div><div><span class="Apple-tab-span" style="white-space:pre"><font class="Apple-style-span" face="Courier">        </font></span></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">        </span># user location service</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"> </span>route(LOCATION);</font></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">  </span>route(RELAY);</font></div><div><font class="Apple-style-span" face="Courier">}</font></div></div><div><font class="Apple-style-span" face="Courier"><br></font></div><div><b><br></b></div></div></blockquote></div><br></body></html>