[sr-dev] Is there a sense in calling run_onsend() after the msg_send() function?

Daniel-Constantin Mierla miconda at gmail.com
Mon Aug 4 16:16:17 CEST 2014


Hello,

the reason for onsend_route was to get access to outgoing buffer (what 
is sent to network) as well as the local socket and remote socket 
attributes (proto, ip, port). There is no option to make changes on the 
outgoing buffer anymore, the action that could be done is stop sending 
to the network (discarding).

It was done for requests, but there were discussions to make this 
available for replies as well. The code you provided in not in public 
repository, but it seems it aims for that (at least for stateless 
replies). The onsend callback should be indeed called before msg_send() 
to get the behavior expected (to be able to drop the reply, for example).

If you get a patch to have the onsend_route for replies, it would be 
welcomed on the public repo.

Cheers,
Daniel

On 04/08/14 15:57, Lucian Balaceanu wrote:
> Hi,
>
> I am currently trying to understand some kamailio code and came across 
> this construct inside do_forward_reply() function (code in italics is 
> not part of upstream kamailio):
>
> *do_forward_reply(struct sip_msg* msg, int mode){*
>     ...
>     ...
>     apply_force_send_socket(&dst, msg);
>
>     if (msg_send(&dst, new_buf, new_len)<0)
>     {
>         STATS_RPL_FWD_DROP();
>         goto error;
>     }
> /*    ...
>     dst.send_sock=get_send_socket(msg, &dst.to, dst.proto);
>     ...
>     run_onsend(msg, &dst, new_buf, new_len);*/
> *}*
>
> Is there really a sense in calling run_onsend() after the msg_send() 
> function? In my understanding (based on onsend_route uasge) 
> run_onsend() is used to make some last minute changes before a message 
> is sent to a destination.
>
> Thank you,
> Lucian Balaceanu
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20140804/545cdb1e/attachment.html>


More information about the sr-dev mailing list