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
172.18.30.52 <-------------------> 172.18.23.43
RTP
172.18.134.68 <-------------------> 172.18.123.35

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 172.18.23.43:51056 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.18.23.43:51056;branch=z9hG4bK+a4bcfecdc571d7e73f13bc8749244b021+172.18.23.4351056+1;received=172.18.23.43
From: sip:70610161@172.18.23.43:51056;user=phone;tag=172.18.23.4351056+1+52cf0004+4791f28f
To: sip:B888@172.18.30.52:5060;user=phone;tag=as27162970
Call-ID: 7AF97138-DF6243@172.18.23.43
CSeq: 396998157 INVITE
Server: Asterisk PBX 1.6.2.22
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Contact: sip:B888@172.18.30.52
Content-Type: application/sdp
Content-Length: 225

v=0
o=root 1805971795 1805971795 IN IP4 172.18.30.52
s=Asterisk PBX 1.6.2.22
c=IN IP4 172.18.30.52
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
a=ptime:20

I need to change

c=IN IP4 172.18.30.52

to

c=IN IP4 172.18.134.68

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

Regards,
Martin

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.