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
Hi, considering this example :
modparam("acc_json", "acc_missed_flag", 6)
failure_route[test] {
setflag(6); // MISSED_ACC, the failure will be recorded by ACC
t_flush_flags(); // This will set the flags in the newly created transaction
t_reply("500", "Service Unavailable");
}
This does generate an ACC event, however the to-tag is not populated,
my guess this is because the TM callback is done before the to-tag is
generated.
I wonder if there is a way to populate the to-tag immediately ?
I will dig it further, but maybe there is a trick I am missing
Hi,
I am working on a project involving Kamailio dockerezation, which is meant to run alongside Freeswitch and RTPEngine containers, on the basis of a Docker-Compose file which is launched on top of a CentOS 7.7 host system.
I was able to create and run the containers successfully, they are starting and listening to the correct ports, but for some unexplained reason - the incoming SIP traffic is not getting picked up by Kamailio. I can easily trace the traffic from the host, but when SSHing the container and running a test from within, no traffic goes by.
I've used netcat to generate plain UDP traffic to the container, and it was logged into the Kamailio log files, but real-life traffic doesn't seem to work.
I've tried moving to host mode (from bridge), but it didn't make any difference. All required firewall rules were opened obviously, I've also tried shutting the firewall off completely but it didn't help.
Does anyone experienced anything similar while running Kamailio in Dockers, and could provide me a go-through on what steps did he take to fix it?
EXCERPT FROM MY DOCKERFILE
# Getting Kamailio source code from GIT
RUN mkdir -p /usr/local/src/kamailio-5.3
WORKDIR /usr/local/src/kamailio-5.3
RUN git clone --depth 1 --no-single-branch https://github.com/kamailio/kamailio
WORKDIR /usr/local/src/kamailio-5.3/kamailio
RUN git checkout -b 5.3.2
# Compile the source code and install Kamailio
RUN make include_modules="phonenum db_mysql xmlrpc http_async_client jansson auth_db nathelper websocket tls outbound topoh http_client" cfg && \
make all && make install
# Default setting is to run Kamailio as user “kamailio” and group “kamailio”
RUN adduser --quiet --system --group --disabled-password \
--shell /bin/false --gecos "Kamailio" \
--home /var/run/kamailio kamailio
# To use init.d script for starting/stopping the Kamailio server
COPY Init/kamailio /etc/init.d/
RUN chmod 755 /etc/init.d/kamailio
COPY Default/kamailio /etc/default/
COPY kamailio.service /etc/systemd/system/
RUN mkdir -p /var/run/kamailio
RUN chown kamailio:kamailio /var/run/kamailio
COMPOSE (BRIDGE NETWORK VERSION)
kamailioegress:
build: kamailio_egress
image: kamailioegress:latest
container_name: kamailioegress
restart: always
environment:
- DATABASE=kamailioe
- SIP_DOMAIN=XXX
- DBHOST=kamailiodb
- DBROOTUSER=root
- DBROOTPASS=XXX
- PUBLIC_IPV4=XXX
depends_on:
- Kamailio-Base
- kmdb
- freeswitch
- rtpengine
expose:
- "5060/udp"
- "5060/tcp"
ports:
- "XXX:5060:5060/udp"
networks:
private-net:
ipv4_address: "172.18.0.30"
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: always
delay: 5s
max_attempts: 3
window: 120s
networks:
private-net:
driver: bridge
ipam:
config:
- subnet: 172.18.0.0/16
driver_opts:
com.docker.network.bridge.name: wrtcpriv
public-net:
external:
name: host
COMPOSE (HOST MODE VERSION)
kamailioegress:
build: kamailio_egress
image: kamailioegress:latest
container_name: kamailioegress
network_mode: host
restart: always
environment:
- DATABASE=kamailioe
- SIP_DOMAIN=XXX
- DBHOST=172.18.0.10
- DBROOTUSER=root
- DBROOTPASS=XXX
- PUBLIC_IPV4=XXX
- EGPORT=5060
- LINTE=ens224
- LINTI=ens192
- RTPENGINE=localhost
depends_on:
- Kamailio-Base
- kmdb
- freeswitch
- rtpengine
expose:
- "5060/udp"
ports:
- "213.8.76.13:5060:5060/udp"
deploy:
mode: replicated
replicas: 1
restart_policy:
condition: always
delay: 5s
max_attempts: 3
window: 120s
CONFIG FILE
/* uncomment and configure the following line if you want Kamailio to
* bind on a specific interface/port/proto (default bind on all available) */
listen=udp:0.0.0.0:LPORT advertise PUBLIC_IP:LPORT
KAMAILIO-LOCALE
#!define DBURL "mysql://root:XXX@DBHOST/kamailioe"
#!substdef "!MY_DBURL!mysql://root:XXX@DBHOST/kamailioe!g"
#!substdef "!RTPENGINE!MY_RTPENGINE!g"
#!substdef "!SIP_DOMAIN!MY_SIP_DOMAIN!g"
#!substdef "!PUBLIC_IP!MY_PUBLIC_IP!g"
#!substdef "!PRIVATE_IP!MY_PRIVATE_IP!g"
#!substdef "!LPORT!MY_LPORT!g"
#!substdef "!LINT!MY_LINT!g"
#!substdef "!HOMER_IP!10.1.0.100!g"
#!substdef "!API_URL!http://localhost:3000/v1/mock!g"
#!substdef "/CCODES/972|380/"
#!substdef "/NUM_TRANSLATE_OUT_RE/\\\\+?(CCODES)([0-9]+)/"
#!substdef "/NUM_TRANSLATE_IN_RE/0([0-9]+)/"
FIREWALL RULES
-bash-4.2# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192 ens224
sources: 192.168.1.39
services: dhcpv6-client http https sip ssh
ports: 9323/tcp 9323/udp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
rule family="ipv4" destination address="XXX" port port="5060" protocol="udp" accept
rule family="ipv4" destination address="XXX" port port="5060" protocol="tcp" accept
NETSTAT OUTPUT
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 XXX:5060 0.0.0.0:* 22479/kamailio
Edward
Hello,
Does search_append_body require an "\r\n" in the attribute that is being added? If I don't use a "\r\n", it appears to look correct in the trace, however one provider says the attribute that was added was just a continuation of the prior attribute, which Wireshark does not show to be the case.
Thank you,
Hey guys,
I am working on a project involving Kamailio dockerezation, which is meant to run alongside Freeswitch and RTPEngine containers, on the basis of a Docker-Compose file which is launched on top of a CentOS 7.7 host system.
Anyway, I would love to know if there is any way to manipulate / mask the IP addresses that are being appended to a status 183 response for an incoming invite.
For some reason which I am trying to figure out in parallel, Freeswitch uses the local network bridge subnet instead of the defined external RTP IPs, and I was wondering - Can I manipulate them using Kamailio? I know that Mangler module can do it for outbound calls, but can I do the same for inbound?
v=0.
o=FreeSWITCH 1595974788 1595974789 IN IP4 172.18.0.40.
s=FreeSWITCH.
c=IN IP4 172.18.0.40.
t=0 0.
m=audio 45878 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16
Edward
lua_dostring("sr.pv.seti(\"$$var(var1)\", $avp(var1) < $avp(var3) and 1 or
0)");
results in error :
kamailio app lual_dostring(): error from Lua: attempt to index global 'sr'
(a nil value)
replacing sr with KSR is working :
lua_dostring("KSR.pv.seti(\"$$var(var1)\", $avp(var1) < $avp(var3) and 1 or
0)");
Shall we update the docs for
https://kamailio.org/docs/modules/devel/modules/app_lua.html#app_lua.f.lua_…
?
Hello there!
I'm having trouble with kamctl since I upgraded to 5.3.4.
The command is working fine with root user but not with another user. The
problem seems to be that the command try to access to
/var/run/kamailio/kamailio_rpc.fifo even if the file exists.
I guess it's a permission problem. But I was thinking that FIFO is no more
used. Only jsonrpcs.
How can I fix that?
Regards,
Igor.
--
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Hello,
being discussed during the last devel meetings, I published the md5,
sha1 and sha256 hash values for the tarballs with sources and i386
binaries we make available for download on kamailio.org on each release
-- e.g., for 5.4.0:
* https://www.kamailio.org/pub/kamailio/5.4.0/src/
* https://www.kamailio.org/pub/kamailio/5.4.0/bin/
Before making a more official announcement about it and adding to the
download/install docs, I want to discuss a little bit here and get to
the right solution to publish these hash values. For the moment I put
them in a single file, adding -checksums.txt to the tarball name,
listing inside all 3 hashes as computed by md5sum, sha1sum and sha256sum.
That because I couldn't decide alone if there is sort of a standard on
how to do it.
Couple of projects I checked they just list the hash values on the html
page with the link to download file. Others have dedicated files per
hashing type, named like MD5SUMS, SHA1SUMS and SHA256SUMS, containing
hash values for all downloadable files in the folder.
Then, asterisk projects publishes 3 files,
asterisk-VERSION.{md5,sha1,sha256}, corresponding to the tar.gz file
they made available. Freeswitch publishes more than one archive file
type, so it makes available files like
freeswitch-VERSION.EXT.{md5,sha1,sha256}, where EXT can be tar.gz,
tar.xz, zip ...
My questions now. What kind of files with hash values people here are
used with? Any variants that tends to be (or become the standard)?
Any tools you are aware of for automatically checking the integrity with
one of these specific hash files (like, if I have the tarball and the
hashes file in the same folder and run it, it gives the ok/not-ok,
without me having to do md5/sha1/sha256 manually and check "by eye" the
values)?
Cheers,
Daniel
--
Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla