Configure SDP/connection information in asterisk SIP

Hi all,

I have an asterisk box in a linux server with 2 IP addresses.
On one IP address I connect to a remote SIP server and on the other I connect to an media (RTP) Server

–my asterisk-- ----remote end----
SIP <------------------->
RTP <------------------->

In this scheme, I need to inform the remote end about my RTP IP address.
This is done configuring the SDP/connection information part of the body of my “200 OK” answer to the INVITE i receive.

In asterisk sip dumps, this “200 Ok” package looks like this

<— Reliably Transmitting (NAT) to —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP;branch=z9hG4bK+a4bcfecdc571d7e73f13bc8749244b021+;received=
From: sip:70610161@;user=phone;tag=
To: sip:B888@;user=phone;tag=as27162970
Call-ID: 7AF97138-DF6243@
CSeq: 396998157 INVITE
Server: Asterisk PBX
Supported: replaces
Contact: sip:B888@
Content-Type: application/sdp
Content-Length: 225

o=root 1805971795 1805971795 IN IP4
s=Asterisk PBX
c=IN IP4
t=0 0
m=audio 11752 RTP/AVP 8 101
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16

I need to change

c=IN IP4


c=IN IP4

Is there a .conf file in asterisk where I can set my RTP IP address ?


Your RTP media address starts as the same as Asterisk. If you actually make a connection and bridge to another SIP source, and you meet various conditions, asterisk will re-invite to the actual RTP address. The conditions are basically that directmedia is enabled on both sides, codecs are compatible, and Asterisk does not need to monitor the RTP stream for any reason.

Asterisk cannot use a third party RTP address without first establishing a session with it. It is a back to back user agent. If you want to specify its RTP address without establishing a session, you need a proxy, not a back to back user agent. Even with a proxy, the RTP address will only be used for RTP going towards the device. If you want RTP direct from it, you are going to have to tell it where to send that RTP.