[SR-Users] Route to PSTN no works
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jul 7 08:20:44 CEST 2020
Hello,
which log message you see in the syslog?
***********ROUTE PSTN***********
or:
PSTN ACTIVADO
or none of them?
Cheers,
Daniel
On 03.07.20 21:21, sip user wrote:
> Hi, I have kamailio connect to Teams, and works form Asterisk -> Teams
> calls.
> For Teams -> Asterisk calls I'd worked using extension and register
> Asterisk with that extension.
>
> But I'd like to use direct routing with IP.
>
> In kamailio.cfg I activate define WITH_PSTN.
> I configured the IP and PORT for my PSTN.
>
> I'm using the default route[PSTN]:
>
> route[PSTN] {
> #!ifdef WITH_PSTN
> Â Â Â Â # check if PSTN GW IP is defined
> Â Â Â Â xlog("L_INFO","PSTN ACTIVADO");
> Â Â Â Â if (strempty($sel(cfg_get.pstn.gw_ip))) {
> Â Â Â Â Â Â Â Â xlog("SCRIPT: PSTN routing enabled but pstn.gw_ip not
> defined\n");
> Â Â Â Â Â Â Â Â return;
> Â Â Â Â }
>
> Â Â Â Â # route to PSTN dialed numbers starting with '+' or '00'
> Â Â Â Â # Â Â (international format)
> Â Â Â Â # - update the condition to match your dialing rules for PSTN
> routing
> Â Â Â Â if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$")){
> Â Â Â Â Â Â Â Â xlog("L_INFO", "Error en el formato numerico!!");
> Â Â Â Â Â Â Â Â return;
> Â Â Â Â }
>
> Â Â Â Â # only local users allowed to call
> Â Â Â Â if(from_uri!=myself) {
> Â Â Â Â Â Â Â Â sl_send_reply("403", "Not Allowed");
> Â Â Â Â Â Â Â Â exit;
> Â Â Â Â }
>
> Â Â Â Â # normalize target number for pstn gateway
> Â Â Â Â # - convert leading 00 to +
> Â Â Â Â #if (starts_with("$rU", "00")) {
> Â Â Â Â # Â Â Â strip(2);
> Â Â Â Â # Â Â Â prefix("+");
> Â Â Â Â #}
>
> Â Â Â Â if (strempty($sel(cfg_get.pstn.gw_port))) {
> Â Â Â Â Â Â Â Â #$ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
> Â Â Â Â Â Â Â Â xlog("L_INFO","SELECCION CON PUERTO");
> Â Â Â Â Â Â Â Â $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":"
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â + $sel(cfg_get.pstn.gw_port);
> Â Â Â Â } else {
> Â Â Â Â Â Â Â Â xlog("L_INFO","SELECCION CON PUERTO");
> Â Â Â Â Â Â Â Â $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":"
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â + $sel(cfg_get.pstn.gw_port);
> Â Â Â Â }
>
> Â Â Â Â route(RELAY);
> Â Â Â Â exit;
> #!endif
>
> Â Â Â Â return;
> }
>
> And in my request_route:
>
> Â remove_hf("Route");
> Â Â Â Â if (is_method("INVITE|SUBSCRIBE")) {
> Â Â Â Â Â Â Â Â if($src_ip != "IP ASTERISK"){
> Â Â Â Â Â Â Â Â Â Â Â Â xlog("L_INFO", "***********ROUTE
> PSTN***********");
> Â Â Â Â Â Â Â Â Â Â Â Â route(PSTN);
> Â Â Â Â Â Â Â Â } else {
> Â Â Â Â Â Â Â Â Â Â Â Â xlog("L_INFO","LLamada desde $si con puerto $sp");
> Â Â Â Â Â Â Â Â Â Â Â Â record_route_preset("FQND:5061;transport=tls",
> "IP KAMAILIO:5060");
> Â Â Â Â Â Â Â Â Â Â Â Â add_rr_param(";r2=on");
> Â Â Â Â Â Â Â Â Â Â Â Â route(DISPATCH);
> Â Â Â Â Â Â Â Â Â Â Â Â route(RELAY);
> Â Â Â Â Â Â Â Â }
> Â Â Â Â }
>
> But never see that the call go to PSTN route..
>
> I'd made any wrong??
>
> Thanks
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200707/f4a30b47/attachment.html>
More information about the sr-users
mailing list