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