[Kamailio-Users] Get send_socket if I have no new branch

Daniel-Constantin Mierla miconda at gmail.com
Wed May 13 11:25:26 CEST 2009


Hello,

On 05/13/2009 11:05 AM, catalina oancea wrote:
> Hello all
>
> In my kamailio.cfg I don't use append_branch at all and I listen on
> multiple addresses. Before running t_relay I need to know on which
> socket will the request be sent. I don't want to change the socket,
> but I want to know which socket is chosen. I tried
> $(branch(send_socket)[0]) and $(branch(send_socket)) but I got error
> "ERROR:pv:pv_get_branchx: error accessing branch [0]"
> Does anybody know how I can get this info?
>   
send socket is set if you do force_send_socket() or assignment to $fs.

It is a bit hard to get outgoing socket while processing the incoming 
message. As a rule, if it can be routed from same socket as the message 
arrived, then that one is used.

You get the error above as you didn't added the branch, so the branch 
index was not updated and it is out of range what you want to access. 
Use $fs to get the send socket from the sip message structure.

Anyhow, not sure it really helps, as it might not be the used value at 
the end, can you give more details of what you look for?

In the very close future, you can get it via using the send_route with 
kamailio 3.0.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com/





More information about the sr-users mailing list