Configure Proxy Server in Asterisk

I want to configure proxy server in Asterisk. What will the pjsip.conf and extensions.conf and dialplan’s changes to configure proxy to relay any incoming and outgoing call? I don’t need PSTN trunking now.

None to extensions .conf. The dialplan is extensions.conf. There are outbound proxy options in pjsip.conf. Inbound might not need any chances; you haven’t provided enough information, in particular about how the source is identified and authenticated.

Thanks for your reply. I am actually new to Asterisk.
I am using PJSUA as client. PJSUA clients are registered in Asterisk Server. I am using Routr as a proxy just to relay the requests from one terminal to another.


type = wizard
sends_auth = yes
sends_registrations = yes
remote_hosts =
outbound_auth/username = ast
outbound_auth/password = 1234
registration/retry_interval = 10
registration/expiration = 900
endpoint/allow = ulaw
endpoint/allow = alaw
endpoint/allow = opus
endpoint/context = from-internal
trasnport = transport-udp

; is the IP of proxy server(Routr)

Whenever I try to register in command-line application of PJSUA, I can’t even register if I have --proxy=sip:;lr or without lr. It always fails
But if I remove the --proxy parameter, from the registration, I get a successful registration for each client in asterisk. Asterisk is not a proxy server so it can’t relay the requests(INVITE etc.) to the terminals. Can you tell me how to I can configure the files and use a proxy server with asterisk?

Are you escaping the ; a it terminates a shell command?

I’m afraid I can only read pjsip configurations well in the standard form, with all the sections separate. However, this is not valid:

as there is no traSNport keyword.

I am not escaping ; in the shell command:
./pjsua-x86_64-unknown-linux-gnu --id=sip:1002@ --registrar=sip:asterisk@ --proxy=sip:;lr --realm=* --username=1002 --password=1002 --local-port=5060 --no-tcp --add-codec=pcmu

Shows registration failed, 408 request timeout

I tried commenting out the transport or using udp/tcp but it remains the same. Clients can’t register to Asterisk when I am adding --proxy.

I just want a proxy server to relay requests. If it isn’t a Routr server, fine by me. I am ready to try Kamailio or else.
But I can’t find any documentation regarding how to set up any proxy with asterisk. Please guide me
I am trying to set up a system like the below system:
SIP Proxy+Registerer

You need to escape ; in shell commands.


I was told to do so by my superior. He do not want re-invites and direct rtp transmission between clients in pjsip.

Using a proxy has no effect on the use of re-INVITE and direct media! In fact a good proxy will also ensure that it, itself, is eliminated from the media path

Most people who care about direct media want it enabled, not disabled.

You need to get a clear specification of the real requirements, as against your boss’s proposed design to achieve them. In particular, there are at least three different reasons for re-INVITEs, an only one of those is about direct media. I think all of them can be disabled, but understanding the real objectives will help to work out which ones really need to be disabled. Using a proxy won’t disable any of them.