Hello everybody!
Kamailio works as a Registrar. Additionally, rtpengine is deployed next to it.
Using the module rtpgngine I change SDP. Webrtc <-> SIP calls work fine.
RTPengine proxies media. It is necessary to understand that when the call
comes, I determine what Protocol the call came wss/tcp/udp, and then through
the command "rtpengine_manage" change SDP accordingly. Now I have a new task.
Wake up mobile customers through push notification. This client may be as
WebRTC and also regular SIP. Trying to use TSILO module.
# User location service
route[LOCATION] {
lookup("location");
$var(rc) = $rc;
if (is_method("INVITE"))
{
if (t_newtran())
{
route(SEND_PUSH);
xlog("L_INFO", "tsilo store\n");
ts_store();
}
}
switch ($var(rc))
{
case 1:
xlog("L_INFO", "LOCATION, Subscriber found, RC: $var(rc)\n");
route(RELAY);
break;
case -1:
xlog("L_INFO", "LOCATION, Subscriber doesn't found, RC:
$var(rc)\n");
exit;
break;
case -3:
xlog("L_INFO", "LOCATION, Subscriber doesn't found, RC: $var(rc)\n");
send_reply("404", "Not Found");
exit;
case -2:
xlog("L_INFO", "LOCATION, Method Not Allowed, RC: $var(rc)\n");
send_reply("405", "Method Not Allowed");
exit;
}
}
If a call occurs when the called client is registered, then we go to the
route(RELAY), which creates a branch in which I change the SDP. Everything
works.
route[RELAY] {
# enable additional event routes for forwarded requests
# - serial forking, RTP relaying handling, a.s.o.
if (is_method("INVITE|BYE")) {
if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
}
if (!t_relay()) {
sl_reply_error();
}
exit;
}
And already in MANAGE BRANCH the necessary SDP is put.
If the called party is not registered. In the beginning everything goes well.
I find this caller through a separate server. Send push notification. The
client successfully registers on kamailio.
# Handle SIP registrations
route[REGISTRAR] {
if (!is_method("REGISTER")) return;
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
setbflag(FLB_NATSIPPING);
}
if(isflagset(FLT_SRC_WSS))
{
setbflag(FLB_DST_WS);
}
if (!save("location"))
{
sl_reply_error();
}
ts_append("location", "$tu")
exit;
}
Next I better show a piece of the log:
окт 31 14:55:08 /usr/sbin/kamailio[17488]: exec: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} *** cfgtrace:request_route=[REGISTRAR]
c=[/etc/kamailio/kamailio.cfg] l=429 a=26 n=ts_append
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tsilo [ts_append.c:72]: ts_append(): transaction
8800:338205132 found for 1234567890, going to append branches
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_lookup.c:1629]: t_lookup_ident_filter():
transaction found
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} registrar [lookup.c:255]: lookup_helper(): contact
for [1234567890] found by address
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} registrar [lookup.c:456]: lookup_helper(): instance is
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_append_branches.c:77]: t_append_branches():
transaction 8800:338205132 in status 0
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_append_branches.c:99]: t_append_branches():
Call uefn7rvufi112jj5lt91: 0 (1) outgoing branches
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_append_branches.c:126]: t_append_branches():
Current uri
sip:[email protected]:58027;transport=TCP;rinstance=727a64a3a59c508f
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} <core> [core/msg_translator.c:162]:
check_via_address(): (50.7.93.27, uas7i396ceb5.invalid, 0)
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_append_branches.c:149]: t_append_branches():
added branch
[sip:[email protected]:58027;transport=TCP;rinstance=727a64a3a59c508f] with
ruid [uloc-5dbacb09-4450-7]
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} tm [t_append_branches.c:163]: t_append_branches():
Call uefn7rvufi112jj5lt91: 0 (0) outgoing branches after clear_branches()
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} <core> [core/tcp_main.c:2238]: tcpconn_send_put():
send from reader (17488 (21)), reusing fd
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} <core> [core/tcp_main.c:2473]: tcpconn_do_send():
sending...
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} <core> [core/tcp_main.c:2507]: tcpconn_do_send():
after real write: c= 0x7fb39dde4c68 n=3131 fd=12
окт 31 14:55:08 /usr/sbin/kamailio[17488]: DEBUG: {1 2 REGISTER
cY6rPubTvJ3ZbyxOrrvGHw..} <core> [core/tcp_main.c:2508]: tcpconn_do_send(): buf=
Thus, the transaction wakes up and the initial INVITE is sent to the new
registered client without any SDP change! Which eventually leads to 415 error.
Now the question itself. Tell me! As me at this moment intercept this INVITE,
to it has passed through in advance prepared path for changing SDP.
Thank you.
--
Oleg Podguyko_______________________________________________
Kamailio (SER) - Users Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users