Discussion:
[SR-Users] parallel forking
(too old to reply)
Yuriy Gorlichenko
2014-10-17 16:33:43 UTC
Permalink
Hello. I try to do parallel fork calls to endpoints that have same
username and different destination URI. Logic of my script:
checking location table for rows with needed account
get info from contact at loop

for every step

check technology (sip or ws)
append_branch with existing destination for this account
rewrite packet with rtpengine to needed technology


forward packets via t_relay



sql_query("ca", "select contact from location where username='$tU'", "ra");
xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
if($dbr(ra=>rows)>0){
$var(i)=0;
while($var(i)<$dbr(ra=>rows)){
xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for {$tU}
at step {$var(i)}\n");
if ($dbr(ra=>[$var(i),0])=~"transport=ws"){
xlog("L_INFO", "This is a Websocket call to endpoint");
sql_pvquery("ca", "select received from location where
contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n");
$du=$var(recieved);
xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is {$du}\n");
xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for {$tU}\n");
rtpproxy_manage("froc+SP");
t_on_reply("REPLY_FROM_WS");
append_branch("sip:$tU@$du");
$var(i) = $var(i) + 1;
}
else
{
xlog("L_INFO", "This is a classic UDP call to endpoint");
$du="sip:"+$(dbr(ra=>[$var(i),0]){s.select,1,@});
xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for
{$tU}\n");
rtpproxy_manage("co");
t_on_reply("MANAGE_CLASSIC_REPLY");
append_branch("sip:$tU@$du");
$var(i) = $var(i) + 1;
}
#append_branch("sip:$tU@$du");
}
}
return 1;


So it customised schema of standart example


seturi("sip:***@example.com");
append_branch("sip:***@example.com");
append_branch("sip:***@example.com");
append_branch("sip:***@example.com");

t_relay();

At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS
and 2 step it UDP). when I do these steps (at my script) I see packet at
TCP dump and saw that sended only one packet to UDP but body of packet is
WS. Then I saw log of kamailio. I see that at second step packet changed
body to WS body (so strange because other steps before and after goes for
UDP (as at logic of script))

What I need to do for send parallel INVITES to multiple endpoints
correctly? Thanks
Yuriy Gorlichenko
2014-10-17 16:41:32 UTC
Permalink
Forget some things:
All calls going form asterisk viaUDP.
t_relay calling out of loop. At the end.

When t_relay at loop first packet goes great but INVITE to second
destinationd not going and ended with ERROR "can't generate 200 reply when
a final 200 was sent out"
Post by Yuriy Gorlichenko
Hello. I try to do parallel fork calls to endpoints that have same
checking location table for rows with needed account
get info from contact at loop
for every step
check technology (sip or ws)
append_branch with existing destination for this account
rewrite packet with rtpengine to needed technology
forward packets via t_relay
sql_query("ca", "select contact from location where username='$tU'", "ra");
xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
if($dbr(ra=>rows)>0){
$var(i)=0;
while($var(i)<$dbr(ra=>rows)){
xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for
{$tU} at step {$var(i)}\n");
if ($dbr(ra=>[$var(i),0])=~"transport=ws"){
xlog("L_INFO", "This is a Websocket call to endpoint");
sql_pvquery("ca", "select received from location where
contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n");
$du=$var(recieved);
xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is
{$du}\n");
xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for {$tU}\n");
rtpproxy_manage("froc+SP");
t_on_reply("REPLY_FROM_WS");
$var(i) = $var(i) + 1;
}
else
{
xlog("L_INFO", "This is a classic UDP call to endpoint");
xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for
{$tU}\n");
rtpproxy_manage("co");
t_on_reply("MANAGE_CLASSIC_REPLY");
$var(i) = $var(i) + 1;
}
}
}
return 1;
So it customised schema of standart example
t_relay();
At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS
and 2 step it UDP). when I do these steps (at my script) I see packet at
TCP dump and saw that sended only one packet to UDP but body of packet is
WS. Then I saw log of kamailio. I see that at second step packet changed
body to WS body (so strange because other steps before and after goes for
UDP (as at logic of script))
What I need to do for send parallel INVITES to multiple endpoints
correctly? Thanks
Kamrul Khan
2014-10-17 17:45:16 UTC
Permalink
Hi,

Im trying to compile TLS module in my kamailio. Below is my console log. It came up with lots of warnings and errors. But it generates the tls.so. What im supposed to do now and how to fix it?

***@ubuntu:/usr/local/src/kamailio-4.1/kamailio$ sudo make -C modules/tls
make: Entering directory `/usr/local/src/kamailio-4.1/kamailio/modules/tls'
make: Leaving directory `/usr/local/src/kamailio-4.1/kamailio/modules/tls'
make: Entering directory `/usr/local/src/kamailio-4.1/kamailio/modules/tls'
CC (gcc) [M tls.so] tls_bio.o
CC (gcc) [M tls.so] tls_cfg.o
CC (gcc) [M tls.so] tls_config.o
CC (gcc) [M tls.so] tls_ct_wrq.o
CC (gcc) [M tls.so] tls_domain.o
In file included from tls_domain.c:39:0:
tls_domain.c: In function âload_certâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:506:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_cert:");
^
tls_domain.c: In function âload_ca_listâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:536:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_ca_list:");
^
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:543:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_ca_list:");
^
tls_domain.c: In function âload_crlâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:575:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_crl:");
^
tls_domain.c: In function âload_private_keyâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:990:5: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_private_key:");
^
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:998:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_private_key:");
^
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_domain.c:1005:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("load_private_key:");
^
CC (gcc) [M tls.so] tls_dump_vf.o
CC (gcc) [M tls.so] tls_init.o
CC (gcc) [M tls.so] tls_locking.o
CC (gcc) [M tls.so] tls_mod.o
CC (gcc) [M tls.so] tls_rpc.o
CC (gcc) [M tls.so] tls_select.o
CC (gcc) [M tls.so] tls_server.o
In file included from tls_server.c:52:0:
tls_server.c: In function âtls_complete_initâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:192:3: note: in expansion of macro âTLS_ERRâ
TLS_ERR("Failed to create SSL or BIO structure:");
^
tls_server.c: In function âtls_shutdownâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:521:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR("SSL error:");
^
tls_server.c: In function âtls_encode_fâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:798:5: note: in expansion of macro âTLS_ERRâ
TLS_ERR(err_src);
^
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:832:5: note: in expansion of macro âTLS_ERRâ
TLS_ERR(err_src);
^
tls_server.c: In function âtls_read_fâ:
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:1186:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR(err_src);
^
tls_util.h:52:6: warning: variable âretâ set but not used [-Wunused-but-set-variable]
int ret; \
^
tls_server.c:1220:4: note: in expansion of macro âTLS_ERRâ
TLS_ERR(err_src);
^
CC (gcc) [M tls.so] tls_util.o
CC (gcc) [M tls.so] tls_verify.o
LD (gcc) [M tls.so] tls.so
make: Leaving directory `/usr/local/src/kamailio-4.1/kamailio/modules/tls'
Yuriy Gorlichenko
2014-10-20 10:18:55 UTC
Permalink
I found INFO about "b" flag for rtpproxy-ng module. It may solve my
porblem, but as I understand, rtpengine not support this flag.
I thought about adiing rtpproxy handling after append_branch (something
like branch_route) but con not find any info how to use it after
branching... Does anybody help me to solve this issue, or give me an advice
about this issue? Thks
Post by Yuriy Gorlichenko
All calls going form asterisk viaUDP.
t_relay calling out of loop. At the end.
When t_relay at loop first packet goes great but INVITE to second
destinationd not going and ended with ERROR "can't generate 200 reply when
a final 200 was sent out"
Post by Yuriy Gorlichenko
Hello. I try to do parallel fork calls to endpoints that have same
checking location table for rows with needed account
get info from contact at loop
for every step
check technology (sip or ws)
append_branch with existing destination for this account
rewrite packet with rtpengine to needed technology
forward packets via t_relay
sql_query("ca", "select contact from location where username='$tU'",
"ra");
xlog("rows: $dbr(ra=>rows) cols: $dbr(ra=>cols)\n");
if($dbr(ra=>rows)>0){
$var(i)=0;
while($var(i)<$dbr(ra=>rows)){
xlog("L_INFO","SQL query return contact {$dbr(ra=>[$var(i),0])} for
{$tU} at step {$var(i)}\n");
if ($dbr(ra=>[$var(i),0])=~"transport=ws"){
xlog("L_INFO", "This is a Websocket call to endpoint");
sql_pvquery("ca", "select received from location where
contact='$dbr(ra=>[$var(i),0])'","$var(recieved)");
xlog("L_INFO","SQL query return recieved {$var(recieved)} for {$tU}\n");
$du=$var(recieved);
xlog("L_INFO", "Request going FROM ASTERISK to WS. Destination is
{$du}\n");
xlog("L_INFO","Websocket Destination URI is {$var(recieved)} for
{$tU}\n");
rtpproxy_manage("froc+SP");
t_on_reply("REPLY_FROM_WS");
$var(i) = $var(i) + 1;
}
else
{
xlog("L_INFO", "This is a classic UDP call to endpoint");
xlog("L_INFO","Classic Destination URI is {$dbr(ra=>[$var(i),0])} for
{$tU}\n");
rtpproxy_manage("co");
t_on_reply("MANAGE_CLASSIC_REPLY");
$var(i) = $var(i) + 1;
}
}
}
return 1;
So it customised schema of standart example
t_relay();
At my test I have 2 endpoints with WS and UDP phones (at fist step ir WS
and 2 step it UDP). when I do these steps (at my script) I see packet at
TCP dump and saw that sended only one packet to UDP but body of packet is
WS. Then I saw log of kamailio. I see that at second step packet changed
body to WS body (so strange because other steps before and after goes for
UDP (as at logic of script))
What I need to do for send parallel INVITES to multiple endpoints
correctly? Thanks
Loading...