Asterisk with ClearIP In-Line Proxy for STIR/SHAKEN

1. Introduction

This documentation explains how to configure Asterisk to work withto use the ClearIP in-line proxy for STIR/SHAKEN services. These instructions are based on Asterisk version 18.11.2 but will likely work with older versions.

2. Configure Asterisk

ClearIP returns Asterisk as the target destination. The inline proxy sends the calls back to Asterisk. Asterisk routes the calls based on its internal routing logic.

ClearIP with in-line proxy  for routing and SHAKEN

2.1. Configuration with pjsip

Add the following to pjsip.conf:

[clearipinlineproxy]
type=endpoint
aors=clearipinlineproxy
context=clearipinlineproxy
disallow=all
allow=ulaw

[clearipinlineproxy]
type=aor
contact=sip:ClearIP_inline_proxy_IP_address_here:5060
qualify_frequency=10
qualify_timeout=3.0

[clearipinlineproxy]
type=identify
match=ClearIP_inline_proxy_IP_address_here:5060
endpoint=clearipinlineproxy

Add the following to extensions.conf, rename the original context block for outbound calls in extensions.conf to afterproxy, and add the predial subroute to the dial command to the provider (e.g., Dial(PJSIP/${EXTEN}@provider,,b(preDial^passParam^1))):

[original_context_for_outbound_calls_here]
exten => _1XXXXXXXXXX,1,NoOp(ToProxy)
same => n,Dial(PJSIP/${EXTEN}@clearipinlineproxy)
same => n,NoOp(afterToProxy)

[clearipinlineproxy]
exten => _1XXXXXXXXXX,1,NoOp(FromProxy)
same => n,Set(_IDENTITY=${PJSIP_HEADER(read,Identity)})
same => n,Goto(afterproxy,_1XXXXXXXXXX,1,)
same => n,NoOp(afterFromProxy)

[preDial]
exten => passParam,1,NoOp(preDial)
same => n(sti),GotoIf($["${_IDENTITY}" = ""]?end)
same => n,Set(PJSIP_HEADER(add,Identity)=${_IDENTITY})
same => n(end),Return()

2.2. Configuration with chan_sip

Add the following to sip.conf:

[general]
qualifyfreq=10

[clearipinlineproxy]
type=peer
host=ClearIP_inline_proxy_IP_address_here
port=5060
context=clearipinlineproxy
disallow=all
allow=ulaw
qualify=yes

Add the following to extensions.conf, rename the original context block for outbound calls in extensions.conf to afterproxy, and add the predial subroute to the dial command to the provider (e.g., Dial(SIP/${EXTEN}@provider,,b(preDial^passParam^1))):

[original_context_for_outbound_calls_here]
exten => _1XXXXXXXXXX,1,NoOp(ToProxy)
same => n,Dial(SIP/${EXTEN}@clearipinlineproxy)
same => n,NoOp(afterToProxy)

[clearipinlineproxy]
exten => _1XXXXXXXXXX,1,NoOp(FromProxy)
same => n,Set(_IDENTITY=${SIP_HEADER(Identity)})
same => n,Goto(afterproxy,_1XXXXXXXXXX,1,)
same => n,NoOp(afterFromProxy)

[preDial]
exten => passParam,1,NoOp(preDial)
same => n(sti),GotoIf($["${_IDENTITY}" = ""]?end)
same => n,SIPAddHeader(Identity: ${_IDENTITY})
same => n(end),Return()
gears