Summary:ASTERISK-12907: [patch] MWI NOTIFY always tries to use UDP, even if the peer is connected via TCP
Reporter:Andrei Tanas (andrew53)Labels:
Date Opened:2008-10-15 13:05:03Date Closed:2008-10-21 18:17:05
Versions:Frequency of
Environment:Attachments:( 0) sip_notify_use_tcp.patch
Description:When sip_send_mwi_to_peer creates temporary dialog to send MWI notification to peer, it doesn't reset p->socket.type, which results in subsequent create_addr_from_peer failing (it thinks that dialog is using UDP, when the peer uses TCP) and cancelling the attempt to send the notification.
Comments:By: Leif Madsen (lmadsen) 2008-10-16 13:45:08

Assigning this issue to putnopvut in the hopes he can take a quick look at this patch and determine whether it should go into Asterisk. Thanks for the contribution!

By: Mark Michelson (mmichelson) 2008-10-21 18:11:39

I was looking at the patch and thinking, "Wouldn't it make more sense to just copy the peer socket data over to the sip_pvt instead of just setting the sip_pvt's socket type to 0?" But then I saw that that is exactly what happens in create_addr_from_peer right after the part that is failing. I'd say that this patch should work fine, although I'm going to add a comment noting that the socket data is copied in create_addr_from_peer.

Thanks for the patch!

By: Digium Subversion (svnbot) 2008-10-21 18:17:03

Repository: asterisk
Revision: 151428

U   trunk/channels/chan_sip.c

r151428 | mmichelson | 2008-10-21 18:17:03 -0500 (Tue, 21 Oct 2008) | 14 lines

If a peer uses any transport other than UDP, then MWI will
fail for that peer since sip_alloc will allocate a sip_pvt with
a default transport of UDP. This change resets the socket type
immediately after allocating the sip_pvt in sip_send_mwi_from_peer,
so that the proceeding call to create_addr_from_peer does not fail
right away. The socket data from the peer is properly copied to
the sip_pvt in create_addr_from_peer.

(closes issue ASTERISK-12907)
Reported by: andrew53
     sip_notify_use_tcp.patch uploaded by andrew53 (license 519)