[SR-Users] passing $avp to t_relay functions.
Daniel-Constantin Mierla
miconda at gmail.com
Wed Dec 19 08:30:32 CET 2018
Hello,
if you want to send the request to 192.168.1.199:5060 over tcp, then the
way to do it right now is:
$du = "sip:" + $avp(add) + ":" + $avp(pp) + ";transport=tcp";
t_relay();
If it is not this what you want, can you explain and give an example of
what you need to achieve?
Apart of t_relay() and t_relay_to(), the other t_relay_to_*() functions
are coming from SER project (during the 2005-2008 project fork), so I am
not sure what kind of parameters it accepts and yesterday I didn't get
the chance to look at the code.
I would avoid adding a new function that doesn't bring a new
funtionality in the group of t_relay_*(), there are many redundant
there, the plan was to remove those that are actually a duplicate in
functionality.
Cheers,
Daniel
On 19.12.18 08:16, YAS0 CANER wrote:
> Hello;
>
> i added a new function that helps to pass $avp values to t_relay
> functions. it solves my problem. if it is ok , i can send a PR .
>
> Thanks
>
> $avp(pp)=5060;
> $avp(add)="192.168.1.199";
> $avp(t)="tcp";
>
> if(!t_relay_avp( "$avp(add)","$avp(pp)","$avp(t)")){
> xlog("L_ERR","Relay Problem UDP \n");
> sl_send_reply("503","Relay Problemed");
> exit;
> }
> exit;
> ------------------------------------------------------------------------
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> on behalf of
> YAS0 CANER <caner_yaso at hotmail.com>
> *Sent:* Tuesday, December 18, 2018 2:15 PM
> *To:* Kamailio (SER) - Users Mailing List
> *Subject:* Re: [SR-Users] passing $avp to t_relay functions.
>
> Hello Daniel;
>
> here cfg and results . i tested all of them one by one . i added some
> log to understand what is log. Extra note; t_relay_to_avp is not
> documented and fixup function cannot fix_param because it find FPARAM_STR.
>
>
> Thanks
>
> $avp(pp)="5061";
> $avp(add)="192.168.1.17";
> $avp(addr)="192.168.1.17:5061";
> $avp(dd)="udp:192.168.1.17:5061";
> $avp(flags)="0x04";
>
> #xlog("L_INF0","$C(xy) [SIPP] [extra_id_pv : $avp(reng_extraid) ]
> [setid_avp : $avp(setid) ] [rtp_inst_pvar : $avp(rtp_instance) ]
> $C(xx) \n");
>
> if(t_relay_to_udp("$avp(add)", "$avp(pp)")){
> xlog("L_ERR","Relay Problem UDP \n");
> sl_send_reply("503","Relay Problemed");
> exit;
> }
> /*
> if(t_relay_to( "$avp(dd)","$avp(flags)")){
> xlog("L_ERR","Relay Problem UDP \n");
> sl_send_reply("503","Relay Problemed");
> exit;
> }
>
> if(t_relay_to_avp( "$avp(pp)","$avp(add)")){
> xlog("L_ERR","Relay Problem UDP \n");
> sl_send_reply("503","Relay Problemed");
> exit;
> }
>
> if(t_relay( "$avp(add)","$avp(pp)")){
> xlog("L_ERR","Relay Problem UDP \n");
> sl_send_reply("503","Relay Problemed");
> exit;
> }
> */
> }
>
> t_relay_to_udp result on compile
>
> 0(93337) INFO: <core> [core/tcp_main.c:4722]: init_tcp(): using
> epoll_lt as the io watch method (auto detected)
> 0(93339) WARNING: tm [tm.c:765]: mod_init(): reparse_on_dns_failover
> is enabled on a multihomed host -- check the readme of tm module!
> 0(93339) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to
> import bind_ob - maybe module is not loaded
> 0(93339) INFO: rr [rr_mod.c:177]: mod_init(): outbound module not
> available
> 0(93339) INFO: <core> [main.c:2619]: main(): processes (at least): 33
> - shm size: 67108864 - pkg size: 8388608
> 0(93339) ERROR: tm [tm.c:621]: fixup_hostport2proxy(): TM module:
> fixup_hostport2proxy($avp(add), 1)
> 0(93339) ERROR: tm [tm.c:621]: fixup_hostport2proxy(): TM module:
> fixup_hostport2proxy($avp(pp), 2)
> 0(93339) ERROR: tm [tm.c:632]: fixup_hostport2proxy(): bad port
> number <$avp(pp)>
> 0(93339) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:492
> 0(93339) ERROR: <core> [core/rvalue.c:3860]: fix_rval_expr(): failure
> in cfg at line: 492 col: 44
> 0(93339) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:516
> 0(93339) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:517
> error -1 while trying to fix configuration
> 0(93339) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy():
> SCTP API not initialized
>
> t_relay_to result;
> 0(93592) INFO: <core> [core/tcp_main.c:4722]: init_tcp(): using
> epoll_lt as the io watch method (auto detected)
> 0(93594) WARNING: tm [tm.c:765]: mod_init(): reparse_on_dns_failover
> is enabled on a multihomed host -- check the readme of tm module!
> 0(93594) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to
> import bind_ob - maybe module is not loaded
> 0(93594) INFO: rr [rr_mod.c:177]: mod_init(): outbound module not
> available
> 0(93594) INFO: <core> [main.c:2619]: main(): processes (at least): 33
> - shm size: 67108864 - pkg size: 8388608
> 0(93594) ERROR: tm [tm.c:2441]: fixup_t_relay_to(): fixing austring
> 0(93594) ERROR: tm [tm.c:2444]: fixup_t_relay_to(): fixing austring
> Not null 0(93594) ERROR: tm [tm.c:2449]: fixup_t_relay_to(): host
> port proto ($avp(dd), 0, 0)
> 0(93594) CRITICAL: <core> [core/proxy.c:264]: mk_proxy(): could not
> resolve hostname: "$avp(dd)"
> 0(93594) ERROR: tm [tm.c:2453]: fixup_t_relay_to(): failed to build
> proxy structure for <$avp(dd)>
> 0(93594) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:498
> 0(93594) ERROR: <core> [core/rvalue.c:3860]: fix_rval_expr(): failure
> in cfg at line: 498 col: 42
> 0(93594) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:516
> 0(93594) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:517
> error -1 while trying to fix configuration
> 0(93594) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy():
> SCTP API not initialized
>
> t_relay_to_avp result ;
> 0(93807) INFO: <core> [core/tcp_main.c:4722]: init_tcp(): using
> epoll_lt as the io watch method (auto detected)
> 0(93809) WARNING: tm [tm.c:765]: mod_init(): reparse_on_dns_failover
> is enabled on a multihomed host -- check the readme of tm module!
> 0(93809) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to
> import bind_ob - maybe module is not loaded
> 0(93809) INFO: rr [rr_mod.c:177]: mod_init(): outbound module not
> available
> 0(93809) INFO: <core> [main.c:2619]: main(): processes (at least): 33
> - shm size: 67108864 - pkg size: 8388608
> 0(93809) ERROR: tm [tm.c:660]: fixup_proto_hostport2proxy(): Could
> fix AVP 0
> 0(93809) ERROR: tm [tm.c:660]: fixup_proto_hostport2proxy(): Could
> fix AVP 0
> 0(93809) INFO: <core> [core/udp_server.c:153]:
> probe_max_receive_buffer(): SO_RCVBUF is initially 212992
> 0(93809) INFO: <core> [core/udp_server.c:205]:
> probe_max_receive_buffer(): SO_RCVBUF is finally 425984
> 0(93809) INFO: <core> [core/udp_server.c:153]:
> probe_max_receive_buffer(): SO_RCVBUF is initially 212992
> 0(93809) INFO: <core> [core/udp_server.c:205]:
> probe_max_receive_buffer(): SO_RCVBUF is finally 425984
> 21(93830) INFO: jsonrpcs [jsonrpcs_sock.c:443]:
> jsonrpc_dgram_process(): a new child 0/93830
> 22(93831) INFO: ctl [io_listener.c:214]: io_listen_loop():
> io_listen_loop: using epoll_lt io watch method (config)
> 10(94948) INFO: {1 017b733724424d0dfacf197ca78fb74a at 0:0:0:0:0:0:0:0}
> <script>: [INVITE]
>
> 10(94948) ERROR: {1 017b733724424d0dfacf197ca78fb74a at 0:0:0:0:0:0:0:0}
> tm [tm.c:1234]: _t_protoaddr2proxy(): Invalid proto parameter value in
> t_protoaddr2proxy_
> 11(94949) INFO: {1 017b733724424d0dfacf197ca78fb74a at 0:0:0:0:0:0:0:0}
> <script>: [ACK]
> 11(94949) INFO: {1 017b733724424d0dfacf197ca78fb74a at 0:0:0:0:0:0:0:0}
> <script>: Message received over IPv6 link
>
> t_relay result on compile ;
>
> 0(95154) INFO: <core> [core/tcp_main.c:4722]: init_tcp(): using
> epoll_lt as the io watch method (auto detected)
> 0(95156) WARNING: tm [tm.c:807]: mod_init(): reparse_on_dns_failover
> is enabled on a multihomed host -- check the readme of tm module!
> 0(95156) INFO: rr [../outbound/api.h:52]: ob_load_api(): unable to
> import bind_ob - maybe module is not loaded
> 0(95156) INFO: rr [rr_mod.c:177]: mod_init(): outbound module not
> available
> 0(95156) INFO: <core> [main.c:2619]: main(): processes (at least): 33
> - shm size: 67108864 - pkg size: 8388608
> 0(95156) ERROR: tm [tm.c:663]: fixup_hostport2proxy(): TM module:
> fixup_hostport2proxy($avp(add), 1)
> 0(95156) ERROR: tm [tm.c:663]: fixup_hostport2proxy(): TM module:
> fixup_hostport2proxy($avp(pp), 2)
> 0(95156) ERROR: tm [tm.c:674]: fixup_hostport2proxy(): bad port
> number <$avp(pp)>
> 0(95156) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:510
> 0(95156) ERROR: <core> [core/rvalue.c:3860]: fix_rval_expr(): failure
> in cfg at line: 510 col: 37
> 0(95156) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:516
> 0(95156) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:517
> error -1 while trying to fix configuration
> 0(95156) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy():
> SCTP API not initialized
>
>
>
> ------------------------------------------------------------------------
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> on behalf of
> YAS0 CANER <caner_yaso at hotmail.com>
> *Sent:* Tuesday, December 18, 2018 11:30 AM
> *To:* Kamailio (SER) - Users Mailing List
> *Subject:* [SR-Users] passing $avp to t_relay functions.
>
> Hello ,
> is there a way to pass $avp values to t_relay function. i tried ;
>
> t_relay
> t_relay_udp/tcp
> t_relay_to
> t_relay_avp functions
>
> log
> 0(75155) ERROR: tm [tm.c:2456]: fixup_t_relay_to(): fixing ($avp(dd), 1)
> 0(75155) ERROR: tm [tm.c:2459]: fixup_t_relay_to(): param type 8
> 0(75155) ERROR: tm [tm.c:2456]: fixup_t_relay_to(): fixing
> ($avp(flags), 2)
> 0(75155) ERROR: tm [tm.c:2459]: fixup_t_relay_to(): param type 11
> 0(75155) CRITICAL: tm [tm.c:2549]: fixup_t_relay_to(): invalid flags
> <$avp(flags)>
> 0(75155) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:489
> 0(75155) ERROR: <core> [core/rvalue.c:3860]: fix_rval_expr(): failure
> in cfg at line: 489 col: 42
> 0(75155) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:494
> 0(75155) ERROR: <core> [core/route.c:1154]: fix_actions(): fixing
> failed (code=-1) at cfg:/usr/local/etc/kamailio/kamailio.cfg:495
>
> in addition i have a look code , in fixup functions try to resolve
> host values so parameteres cannot find $avp .
>
> in conclusion , does kamailio need new function to pass $avp value?
> Can i try to code?
>
> Thanks.
>
>
--
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
Kamailio Advanced Training - Mar 4-6, 2019 in Berlin; Mar 25-27, 2019, in Washington, DC, USA -- www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181219/dd6c39b2/attachment.html>
More information about the sr-users
mailing list