Hi Brett!
From what I could understand, my client (a Carrier) assigns services and
products to its customers identified by trunkgroups (depending on the
customer and the service requested, as well as the ingress trunkgroup
the call will be forwarded to a specific egress trunkgroup).
.
The INVITE is sent by customer to the SBC (ingress), where some kind of
process (which i have no details) will decide what IP:Port to forward the
messages to Kamailio with additional infos (Kamailio is listening on
different NICs/IPs/Ports). Then, Kamailio will check on the (external)
routing engine the route to take and forwards to the outbound endpoint.
Depending on the IP:Port that Kamailio receives the call (SBC may choose
one NIC or the other) the request is then received by Kamailio and
verified/processed by the routing engine replying back to kamailio with the
route to take, and then Kamailio forwards to the outbound endpoint (egress
SBC...).
It is a bit confusing, and I want to simplify things as much as possible,
but apparently the old/current solution is set this way and they pretend to
keep the new solution as similar as possible to the old/current solution.
This is mostly due to the billing process, which is very (overly?) complex
and they do not pretend to change it.
IMHO, the routing engine should be much simpler but it is a much more
complex process the Carrier currently has...and wishes to keep.
(sorry for posting without a subject. I did, however, re-posted with
corrected subject)
Atenciosamente / Kind Regards / Cordialement,
*Sérgio Charrua*
On Fri, Jul 12, 2024 at 8:11 PM Brett Nemeroff <brett(a)voicefoxtelephony.com>
wrote:
> Is there a reason you have to identify the trunk group based on received
> IP/Port? I've seen this as a requirement from some more antiquated systems
> and it's always a pain. It's always better to use source IP or even a trunk
> prefix (dialed number prefix) which isn't really secure, but works when
> security isn't an issue.
>
> If you have to do it that way, I'd probably turn the $Ri/$Rp into some
> sort of cache key like $Ri_$Rp and map it to something like a dispatcher
> setid.
>
> There may be a more modern way to do this, but I don't think there is.
>
> Good luck!
> -Brett
>
>
> On Fri, Jul 12, 2024 at 1:40 PM Sergio Charrua via sr-users <
> sr-users(a)lists.kamailio.org> wrote:
>
>> Hi all!
>>
>> for a project under development, one requirement is to be able to
>> forward/relay the call to a specific destination depending on which IP
>> Address and Port the call was received by Kamailio.
>> This also means that Kamailio will be listening on multiple IP Address
>> and Ports
>> listen=udp:IP_1:port_1 # trunkgroup 1
>> listen=udp:IP_2:port_2 # trunkgroup 2
>> listen=udp:IP_3:port_3 # trunkgroup 3
>>
>> I know the pv $Ri and $Rp can be used to identify from which IP address
>> and port the message reached Kamailio and having those details, depending
>> on the value, I can define some conditions that allows Kamailio to relay
>> the call to different destination endpoints.
>> For example:
>> - calls from +32 to + 39 received on trunkgroup1 needs to go to Italy SBC
>> address A.B.C.D
>> - but calls from +32 to +39 received on trunkgroup2 need to go to Germany
>> on SBC address 1.2.3.4 (as it is cheaper)
>>
>> Is there a better way of doing this without using IF/THEN/ELSE or SWITCH
>> blocks and "hard code" destination SBC addresses?
>> I have read the DRouting module's documentation but not sure if it could
>> help and how...
>>
>> Any suggestions?
>>
>>
>>
>> Atenciosamente / Kind Regards / Cordialement,
>>
>>
>> *Sérgio *
>> __________________________________________________________
>> Kamailio - Users Mailing List - Non Commercial Discussions
>> To unsubscribe send an email to sr-users-leave(a)lists.kamailio.org
>> Important: keep the mailing list in the recipients, do not reply only to
>> the sender!
>> Edit mailing list options or unsubscribe:
>>
>
>
> --
>
> ========================================================
> Brett Nemeroff
> Voice Fox Telephony LLC
> Office: 512-670-8369
> Email: brett(a)voicefoxtelephony.com
>
Hello,
I need help with modifying the "To" header in the "failure_route[ID]{...}". Specifically, I want to add the "to tag" parameter from the previous SIP messages of the current dialog(e.g., 180 Ringing, PRACK or final responses).
Here's the scenario:
1. Kamailio receives and relays the SIP messages: INVITE, 180 Ringing, PRACK, 200 OK, 486 Busy Here.
2. In my case, the 180 Ringing includes the "to tag" parameter.
3. When Kamailio receives the 486 response, it triggers "failure_route[ID]" using "t_on_failure(ID)" method.
4. I extract the SIP response code and reason from the final response of the INVITE transcation in this failure_route.
5. After processing and applying some instructions, I send a reply using "t_send_reply" with the code and reason extracted.
The problem:
- The failure_route[ID] holds the initial INVITE, which has no "to tag" parameter.
- When I send a reply using "t_send_reply()", Kamailio generates a random "to tag" different from the previous SIP messages, which confuses my UAC.
I think adding the "to tag" parameter manually might be a solution, but I'm not sure if I'm doing it correctly or if there is a better approach. I also tried using uac_replace_to() method, but it doesn't work in the failure_route[ID].
How can I make sure the reply in failure_route[ID] uses the correct "to tag" from the previous SIP messages? Are there any other possibilities to achieve this?
Any assistance would be appreciated.
Thank you!
Hello,
Please help. I am using Kemi with the python3 module. I get random
TypeError exceptions thrown within the Kamailio code.
For example I have the following code:
event = str(KSR.pv.get("$hdr(Event)"))
log.logInfo(
"KamailioStateful.ksr_request_route_loopback(): " +
"Passing the request to the presence " +
"publish handler for event: " + event
)
rc = KSR.presence.handle_publish()
if rc != 1:
log.logError(
"KamailioStateful.ksr_request_route_loopback(): " +
"The presence publish handler returned " +
"an error code: " + str(rc)
)
This is what I see in the logs:
21(120) ERROR: PY3 {PUBLISH}: app_python3 [python_support.c:167]:
python_handle_exception(): apy_exec: ksr_request_route((null)): Unhandled
exception in the Python code:
TypeError: expected bytes, str found
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/etc/kamailio/kamailio.py", line 91, in ksr_request_route
return ksf.ksr_request_route(msg, "Loopback")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/etc/kamailio/kamailio_stateful.py", line 100, in ksr_request_route
return self.ksr_request_route_loopback(msg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/etc/kamailio/kamailio_stateful.py", line 240, in
ksr_request_route_loopback
rc = KSR.presence.handle_publish()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: <built-in function handle_publish> returned a result with an
exception set
If I put the offending line within a Try/Except it hides it but I would
rather not see it not happen at all. Any Kemi Python3 users experiencing
something similar? What could be causing this?
Regards,
Michel Pelletier
Hi all!
For a project under development, one requirement is to be able to
forward/relay the call to a specific destination depending on which IP
Address and Port the call was received by Kamailio.
This also means that Kamailio will be listening on multiple IP Address and
Ports
listen=udp:IP_1:port_1 # trunkgroup 1
listen=udp:IP_2:port_2 # trunkgroup 2
listen=udp:IP_3:port_3 # trunkgroup 3
I know the pv $Ri and $Rp can be used to identify from which IP address and
port the message reached Kamailio and having those details, depending on
the value, I can define some conditions that allows Kamailio to relay the
call to different destination endpoints.
For example:
- calls from +32 to + 39 received on trunkgroup1 needs to go to Italy SBC
address A.B.C.D
- but calls from +32 to +39 received on trunkgroup2 need to go to Germany
on SBC address 1.2.3.4 (as it is cheaper)
Is there a better way of doing this without using IF/THEN/ELSE or SWITCH
blocks and "hard code" destination SBC addresses?
I have read the DRouting module's documentation but not sure if it could
help and how...
Any suggestions?
Atenciosamente / Kind Regards / Cordialement,
*Sérgio *
Hi all!
for a project under development, one requirement is to be able to
forward/relay the call to a specific destination depending on which IP
Address and Port the call was received by Kamailio.
This also means that Kamailio will be listening on multiple IP Address and
Ports
listen=udp:IP_1:port_1 # trunkgroup 1
listen=udp:IP_2:port_2 # trunkgroup 2
listen=udp:IP_3:port_3 # trunkgroup 3
I know the pv $Ri and $Rp can be used to identify from which IP address and
port the message reached Kamailio and having those details, depending on
the value, I can define some conditions that allows Kamailio to relay the
call to different destination endpoints.
For example:
- calls from +32 to + 39 received on trunkgroup1 needs to go to Italy SBC
address A.B.C.D
- but calls from +32 to +39 received on trunkgroup2 need to go to Germany
on SBC address 1.2.3.4 (as it is cheaper)
Is there a better way of doing this without using IF/THEN/ELSE or SWITCH
blocks and "hard code" destination SBC addresses?
I have read the DRouting module's documentation but not sure if it could
help and how...
Any suggestions?
Atenciosamente / Kind Regards / Cordialement,
*Sérgio *
Hello!
I'm trying to build standard deb packages for Kamailio v5.7.6 for Debian
12.6, but I get an error.
By the way, there are no problems with building v5.7.2 ...
#git clone --single-branch --branch 5.7.6
https://github.com/kamailio/kamailio.git /usr/src/kamailio
#cd /usr/src/kamailio && ln -s pkg/kamailio/deb/bookworm debian
#make cfg && RADCLI=1 make deb
....
Makefile.defs defs skipped
make[6]: 'libkamailio_ims.so.0.1' is up to date.
gcc -shared -g -m64 -Wl,-O2 -Wl,-E -Wl,-z,relro -pthread -rdynamic "-ldl"
-Wl,-Bsymbolic-functions cmd.o ims_ipsec_pcscf_mod.o ipsec.o sec_agree.o
spi_gen.o spi_list.o spi_list_tests.o -lm -lmnl -L../../lib/ims/
-lkamailio_ims -Wl,-rpath,/usr/src/kamailio/src/lib/ims -o
ims_ipsec_pcscf.so
make[4]: Leaving directory '/usr/src/kamailio/src'
make[3]: Leaving directory '/usr/src/kamailio'
make[2]: Leaving directory '/usr/src/kamailio'
*dpkg-buildpackage: error: debian/rules binary subprocess returned exit
status 2*
make[1]: Leaving directory '/usr/src/kamailio/src'
--
BR,
Denys Pozniak
Hi everyone,
I am new to this forum and excited to be here.
I'm eager to learn more about Kamailio and its features and I'm looking forward to participating in discussions here.
Could someone please guide me on how to ask questions here ?
Where should I post if I have a query ?
Looking forward to your advice and connecting with you all.
Thanks,
Hello everybody,
I am using kamailio in AWS behind load balancer and after upgraded from version 5.7 to 5.8 kamailio is not able to keep connection open.
After quick investigation I found out that usrloc module got new parameter ka_interval that replaced timer_interval.
Change is here.
https://github.com/kamailio/kamailio/commit/53ace443020075f7ecd12c72f154193…
Problem is that this interval is not reliable, as it is most probably still called only when timer_interval is executed.
If I set values to
timer_interval = 30
ka_interval = 30
ka_randomize = 20
Maximum time for keep-alive is not 30+20 seconds but 30+30+20 seconds. That is too late for AWS load balancer.
I have fixed it by enabling tcp keepalives on kernel level.
Is there any way how to specify exact time in version 5.8?
Thanks.
Michal
Hi all!
I am using HTTP_CLIENT module, and have created a http configuration file.
The module's config_file parameter is set as:
modparam("http_client", "config_file", "/etc/kamailio/http_client.cfg")
and it works OK on my DEV environment, because there is a symlink
/etc/kamailio pointing to physical folder /usr/local/etc/kamailio/ (using
Kamailio 5.7.4)
However in our integration environment (also using Kamailio 5.7.4), which
is identical to production, and due to limitations on access rights, we
cannot create a symlink /etc/kamailio pointing /usr/local/etc/kamailio/,
so all cfg files are in the installation folder.
So I thought that the config_file parameter should be a relative path,
starting with " ./ " or by just setting the config file name, without path
(as per documentation at http_client (kamailio.org)
<https://kamailio.org/docs/modules/5.1.x/modules/http_client.html#idp38265140>
.
The issue is that even though the file http_client.cfg is present in
/usr/local/etc/kamailio/, as well as other cfg files, the cfg_parser fails
to load it:
Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: <core>
> [core/cfg_parser.c:632]: cfg_parser_init(): cfg_parser: Unable to open file
> './http_client.cfg'
> Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: http_client
> [curlcon.c:782]: http_client_load_config(): Failed to init http_client
> config file parser
> Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: http_client
> [http_client.c:307]: mod_init(): Failed to load http_client connections
> from [./http_client.cfg]
> Jul 11 09:32:09 lab-kamailio kamailio[44114]: ERROR: <core>
> [core/sr_module.c:1030]: init_mod(): Error while initializing module
> http_client (/usr/local/lib64/kam
> ailio/modules/http_client.so)
I have set the parameter to
> modparam("http_client", "config_file", "./http_client.cfg")
and also to
> modparam("http_client", "config_file", "http_client.cfg")
but it only works if I add it as :
> modparam("http_client", "config_file",
> "/usr/local/etc/kamailio/http_client.cfg")
or by adding
> chroot="/usr/local/etc/kamailio"
in the main cfg script, which was my final solution.
Also checked for permissions, and all is fine. Note that this only seems to
happen with http_client config_file parameter. I have other include
commands in the main cfg file with relative paths and all works fine.
I have also analysed the cfg_parser.so file, which loads the configuration
file for http_client module, but could not find anything wrong with it (at
1st glance....)
What am I doing wrong?
Any clue?
Atenciosamente / Kind Regards / Atentamente / Cordialement,
*Sérgio *
Hi Community,
We are setting up a new provider in our VoIP setup for outgoing calls
(FreeSWITCH --> Kamailio --> Provider).
When the provider sends a 200 OK in response to our INVITE, FreeSWITCH's
SIP stack discards the message, and we are unable to determine the cause of
this behavior.
I am sharing the SIP message exchange below. Could any SIP experts assist
us in understanding why FreeSWITCH is not sending an ACK in response to the
200 OK message?
We understand that the issue is not related to Kamailio but seems to be
within the SIP stack or FreeSWITCH itself.
Below are the actual INVITE and its response, which was discarded by
FreeSWITCH:
send 1203 bytes to tcp/[10.xxx.x.30]:5060 at 15:48:23.001054:
------------------------------------------------------------------------
INVITE sip:+86xxxxxxxxxxx@35.xxx.xxx.xxx;transport=tcp SIP/2.0
Via: SIP/2.0/TCP 10.xxx.x.10:5080;rport;branch=z9hG4bKD8p0KmvB8ZKma
Max-Forwards: 69
From: "+1xxxxxxxxxx" <sip:+1xxxxxxxxxx@10.xxx.x.10>;tag=ZSvBBtypKypDS
To: <sip:+86xxxxxxxxxxx@35.xxx.xxx.xxx>
Call-ID: 21b7b9b5-b8a5-123d-63a6-ecf4bbd64f6c
CSeq: 85714459 INVITE
Contact: <sip:gw+commsgroup@10.xxx.x.10:5080;transport=tcp;gw=commsgroup>
User-Agent: FreeSWITCH-mod_sofia/1.10.11-release~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER,
REFER, NOTIFY
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 347
X-FS-Support: update_display,send_info
Remote-Party-ID: "+1xxxxxxxxxx" <sip:+1xxxxxxxxxx@10.xxx.x.10
>;party=calling;screen=yes;privacy=off
v=0
o=Z 5395246197255529491 693195311 IN IP4 10.xxx.x.225
s=Z
c=IN IP4 10.xxx.x.225
t=0 0
m=audio 55319 RTP/AVP 106 9 98 101 0 8 3
a=rtpmap:106 opus/48000/2
a=fmtp:106 sprop-maxcapturerate=16000; minptime=20; useinbandfec=1
a=rtpmap:98 telephone-event/48000
a=fmtp:98 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtcp-mux
tport.c:2316 tport_set_secondary_timer() tport(0x150e6c0291c0): reset timer
nta.c:8400 outgoing_send() nta: sent INVITE (85714459) to
tcp/10.xxx.x.30:5060
tport.c:4191 tport_pend() tport_pend(0x150e6c0291c0): pending
0x150e6c0c52f0 for tcp/10.xxx.x.30:5060 (already 2)
nua_session.c:4131 signal_call_state_change() nua(0x150d9c107460): call
state changed: init -> calling, sent offer
soa.c:1268 soa_get_local_sdp() soa_get_local_sdp(static::0x150e6c0c0210,
[0x150e91772798], [0x150e91772790], [(nil)]) called
nua_stack.c:299 nua_stack_event() nua(0x150d9c107460): event i_state INVITE
sent
nua_stack.c:389 nua_application_event() nua: nua_application_event: entering
nua.c:1170 nua_handle_unref_user() nua nua_handle_unref_user(0x150d9c107460):
entering
nua.c:365 nua_handle_magic() nua: nua_handle_magic: entering
nua_stack.c:558 nua_signal() nua(0x150d9c107460): sent signal r_handle_unref
nua.c:1157 nua_unref_user() nua: nua_unref_user: entering
2024-07-09 15:48:22.985772 100.00% [DEBUG] sofia.c:7493 Channel
sofia/external/+86xxxxxxxxxxx entering state [calling][0]
nua_stack.c:599 nua_stack_signal() nua(0x150d9c107460): recv signal
r_handle_unref
nua.c:365 nua_handle_magic() nua: nua_handle_magic: entering
nua_stack.c:558 nua_signal() nua((nil)): sent signal r_unref
nua.c:1170 nua_handle_unref_user() nua nua_handle_unref_user(0x150d9c107460):
entering
nua_stack.c:599 nua_stack_signal() nua((nil)): recv signal r_unref
nua_stack.c:558 nua_signal() nua(0x150d9c107460): sent signal r_handle_unref
nua_stack.c:599 nua_stack_signal() nua(0x150d9c107460): recv signal
r_handle_unref
nua.c:1157 nua_unref_user() nua: nua_unref_user: entering
nua_stack.c:558 nua_signal() nua((nil)): sent signal r_unref
nua_stack.c:599 nua_stack_signal() nua((nil)): recv signal r_unref
2024-07-09 15:48:22.985772 100.00% [DEBUG] switch_core_state_machine.c:659
(sofia/external/+86xxxxxxxxxxx) State CONSUME_MEDIA
2024-07-09 15:48:22.985772 100.00% [DEBUG] switch_core_state_machine.c:659
(sofia/external/+86xxxxxxxxxxx) State CONSUME_MEDIA going to sleep
tport.c:2796 tport_wakeup() tport_wakeup(0x150e6c0291c0): events IN
tport.c:2900 tport_recv_event() tport_recv_event(0x150e6c0291c0)
tport.c:3237 tport_recv_iovec() tport_recv_iovec(0x150e6c0291c0) msg
0x150e6c0cb390 from (tcp/10.xxx.x.30:5060) has 352 bytes, veclen = 1
recv 352 bytes from tcp/[10.xxx.x.30]:5060 at 15:48:23.004029:
------------------------------------------------------------------------
SIP/2.0 100 Trying
Via: SIP/2.0/TCP
10.xxx.x.10:5080;rport=37555;branch=z9hG4bKD8p0KmvB8ZKma;received=10.xxx.x.10
From: "+1xxxxxxxxxx" <sip:+1xxxxxxxxxx@10.xxx.x.10>;tag=ZSvBBtypKypDS
To: <sip:+86xxxxxxxxxxx@35.xxx.xxx.xxx>
Call-ID: 21b7b9b5-b8a5-123d-63a6-ecf4bbd64f6c
CSeq: 85714459 INVITE
Server: Kamailio 5.8
Content-Length: 0
tport.c:3055 tport_deliver() tport_deliver(0x150e6c0291c0): msg
0x150e6c0cb390 (352 bytes) from tcp/10.xxx.x.30:5060/sip next=(nil)
nta.c:3378 agent_recv_response() nta: received 100 Trying for INVITE
(85714459)
nta.c:3445 agent_recv_response() nta: 100 Trying is going to a transaction
nta.c:9697 outgoing_estimate_delay() nta_outgoing: RTT is 3.038 ms
tport.c:4253 tport_release() tport_release(0x150e6c0291c0): 0x150e6c0c52f0
by 0x150e6c0be9a0 with 0x150e6c0cb390 (preliminary)
tport.c:2316 tport_set_secondary_timer() tport(0x150e6c0291c0): reset timer
nta.c:5904 incoming_reclaim_queued() incoming_reclaim_all((nil), (nil),
0x150e91973a50)
nta.c:7270 _nta_incoming_timer() nta_incoming_timer: 0/0 resent, 0/0 tout,
0/0 term, 2/3 free
nta.c:1310 agent_timer() nta: timer not set
tport.c:2796 tport_wakeup() tport_wakeup(0x150e6c0291c0): events IN
tport.c:2900 tport_recv_event() tport_recv_event(0x150e6c0291c0)
tport.c:3237 tport_recv_iovec() tport_recv_iovec(0x150e6c0291c0) msg
0x150e6c0c9d90 from (tcp/10.xxx.x.30:5060) has 1195 bytes, veclen = 1
recv 1195 bytes from tcp/[10.xxx.x.30]:5060 at 15:48:27.070278:
------------------------------------------------------------------------
SIP/2.0 200 OK
Via: SIP/2.0/TCP
10.xxx.x.10:5080;received=10.xxx.x.10;rport=37555;branch=z9hG4bKD8p0Km
From: "+1xxxxxxxxxx" <sip:+1xxxxxxxxxx@10.xxx.x.10>;tag=ZSvBBtypKypDS
To: <sip:+86xxxxxxxxxxx@35.xxx.xxx.xxx
>;tag=7bQ0OSl9Dl-39455-57712329-1057554-14
Call-ID: 21b7b9b5-b8a5-123d-63a6-ecf4bbd64f6c
CSeq: 85714459 INVITE
Contact:
<sip:127.0.0.8;line=sr-H46V9.fbsXNDlkfEJjGbujK3J4aDo1GzP5GOJ8hcsXwV9LAWw1abHkqWlXczwL7*>
Record-Route:
<sip:13x.xxx.xxx.xx;transport=tcp;lr;ftag=ZSvBBtypKypDS;did=cbd.e581;nat=yes>
Supported: sdp-anat
Allow:
INVITE,PRACK,ACK,UPDATE,CANCEL,BYE,OPTIONS,INFO,SUBSCRIBE,REFER,NOTIFY
Require: timer
Session-Expires: 2000;refresher=uas
Server: Mediant VE SBC/v.7.40A.250.265
P-Asserted-Identity: <sip:4006100666@hk.chinatelecom.com;user=phone>
Accept: application/sdp, application/isup, multipart/mixed,
application/dtmf, application/dtmf-relay
Content-Type: application/sdp
Content-Length: 219
User-Agent: Kamailio 5.8
v=0
o=- 846721169 1919912032 IN IP4 13x.xxx.xxx.xx
s=-
c=IN IP4 13x.xxx.xxx.xx
t=0 0
m=audio 49708 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=rtcp:49709
tport.c:3055 tport_deliver() tport_deliver(0x150e6c0291c0): msg
0x150e6c0c9d90 (1195 bytes) from tcp/10.xxx.x.30:5060/sip next=(nil)
nta.c:3378 agent_recv_response() nta: received 200 OK for INVITE (85714459)
nta.c:3494 agent_recv_response() nta: 200 OK was discarded
Any insights or suggestions would be greatly appreciated,
Specifically, why is the 200 OK response being discarded?. Thank you!
Regards,
Mustafa