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
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@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello All
I am also start to integrate Kamailio IMS with PSTN, may I know my understanding below is correct or not?
1. Inbound calls need to point to the I-CSCF 2. Outbound gateways are defined in Dispatcher on the Serving-CSCF
Also, what configuration should I change to support the above configuration?
any help is appreciated.
- RBK
On Tue, Jul 7, 2020 at 2:21 PM Daniel-Constantin Mierla miconda@gmail.com wrote:
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@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
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users