Asterisk replaces SIP domain

I have an Asterisk instance which is publicly available. If another server forwards a call to my server Asterisk replaces the original SIP domain (e.g. 1234@sip.provider.org) by its own domain/IP address (e.g. 1234@192.168.1.1). How to stop Asterisk from doing this?

Thanks in advance!

Asterisk isn’t a SIP proxy. It’s a B2BUA and each call leg is independent, so traffic is not passed through unaltered. We do provide an option in both chan_sip and chan_pjsip to explicitly set a From domain (if that’s what you are referring to). It’s fromdomain and from_domain respectively.

1 Like

Thanks for your answer. I know about these config directives but the domain is not static. It depends on the source of each call so there could be an endless number of servers which forward calls to me.

My aim is to put my ITSP on a level with SIP providers like Sip2Sip. So it won’t work with Asterisk?

I need the original domain because if I want to call back Asterisk cannot know which server is the destination.

According to chan_sip you can alter it in the dial string:

; SIP dial strings
; ----------------------------------------------------------
; In the dialplan (extensions.conf) you can use several
; syntaxes for dialing SIP devices.
;        SIP/devicename
;        SIP/username@domain   (SIP uri)
;        SIP/username[:password[:md5secret[:authname[:transport]]]]@host[:port]
;        SIP/devicename/extension
;        SIP/devicename/extension/IPorHost
;        SIP/username@domain//IPorHost
; And to alter the To: or the From: header, you can additionally append
; the following to any of the above strings:
;        [![touser[@todomain]][![fromuser][@fromdomain]]]

This functionality is not available in PJSIP.

For an ITSP Asterisk wouldn’t be the only solution in use. Something like Kamailio would be used as well.

1 Like