[Home]

Summary:ASTERISK-02130: RTP stream sent from wrong IP address if SIP address set to secondary IP address.
Reporter:axelm (axelm)Labels:
Date Opened:2004-07-28 08:50:12Date Closed:2011-06-07 14:10:50
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If a secondary IP address is specified in sip.conf via "bindaddress=", asterisk uses the given address properly for SDP media information, but does not set the IP address when creating the RTP socket. RTP packets are then sent from the primary IP address of the box, which confuses at least some SIP clients.

****** ADDITIONAL INFORMATION ******

Example:
--------

IP addresses on box: xx.xx.xx.122 (primary)
                    xx.xx.xx.124 (secondary)

sip.conf: bindaddress=xx.xx.xx.124

perform an inbound call, e.g. "INVITE 1000@xx.xx.xx.124".

Asterisk answers with:

SIP/2.0 200 OK
[...] (lines removed)
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:1000@xx.xx.xx.124>
Content-Type: application/sdp
Content-Length: 268

v=0
o=root 5413 5413 IN IP4 xx.xx.xx.124
s=session
c=IN IP4 xx.xx.xx.124
t=0 0
m=audio 11426 RTP/AVP 18 0 8 101
a=rtpmap:18 G729/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -

so the ip address is set correctly in the SDP, but ...

15:16:19.147287 xx.xx.xx.122.10534 > yy.yy.yy.14.22488:  udp 172 (DF)
15:16:19.148003 yy.yy.yy.14.22488 > xx.xx.xx.124.10534:  udp 172

etc.

I've mad a dirty hack to my Asterisk box, but this one is *really really* ugly, i simple didn't have the time to do a real fix:

rtp.c:

struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io,
int rtcpenable, int callbackmode)
{
       struct ast_rtp *rtp;
       int x;
       int first;
       int startplace;
       rtp = malloc(sizeof(struct ast_rtp));
       if (!rtp)
               return NULL;
       memset(rtp, 0, sizeof(struct ast_rtp));
       rtp->them.sin_family = AF_INET;
       rtp->us.sin_family = AF_INET;
+        /* WARNING! PLAIN DEAD UGLY BUGFIX! axelm */
+       inet_aton("xx.xx.xx.124", &(rtp->us.sin_addr));
       rtp->s = rtp_socket();
       rtp->ssrc = rand();
       rtp->seqno = rand() & 0xffff;

Comments:By: Tilghman Lesher (tilghman) 2004-07-28 11:23:47

Please update to CVS-HEAD.  This bug has already been fixed.