Trimline2
Guru
- Joined
- May 23, 2013
- Messages
- 524
- Reaction score
- 96
Here is my tested solution.
Problem Abstract:
Callcentric Asterisk users don't have a clear and concise instruction set to follow when using a PIAF setup. Calls do not reach their intended target PBX or are rejected as Callcentric uses multiple IP Peers. This currently is limited to Callcentric, but may in the future, involve other VoIP providers.
Fix, Adjustment:
The "from-sip-external" on Asterisk acts as a funnel for calls that do not have a defined Peer. This module's purpose is to determine if the system permits Anonymous connections, if it does, or if you allow this on your system, no changes are required on your part (setting not recommended). However, if you do not allow anonymous SIP connections, review the below code and adjust accordingly.
See Ward's post #12 above. Prior to changing your config.
Code:
;-------------------------------------------------------------------------------
[from-sip-external]
; from-sip-external Add to extensions_override_freepbx.conf
;
; This context is the default SIP context unless otherwise changed in the SIP
; Settings module or other sip configuration locations. This context is hit by
; either anonymous SIP calls or mis-configured SIP trunks when the incoming call
; can not be matched with a SIP section.
;
; 05-Jan-2014 WardMundy : Added override line below s1
; 08-Jan-2014 Trimeline : Added line to log Peer IP and Source IP
; 08-Jan-2014 Trimeline : s1 moved and altered stmt for inbound Callcentric (or any other provider) check. You may add as
; many CC (provider) DIDs as needed by duplicating the 1777 line as exampled below.
;
[from-sip-external]
exten => _.,1,NoOp(Received incoming SIP connection from unknown peer to ${EXTEN})
exten => _.,n,Set(DID=${IF($["${EXTEN:1:2}"=""]?s:${EXTEN})})
exten => _.,n,NoOp(Peer IP: ${SIPCHANINFO(peerip)} Source IP: ${SIPCHANINFO(recvip)})
exten => _.,n,Goto(s,1)
exten => s,1,GotoIf($[${DID}=17775551212]?from-trunk,${DID},1)
exten => s,n,GotoIf($[${DID}=17775551212101]?from-trunk,${DID},1)
exten => s,n,GotoIf($["${ALLOW_SIP_ANON}"="yes"]?checklang:noanonymous)
exten => s,n(checklang),GotoIf($["${SIPLANG}"!=""]?setlanguage:from-trunk,${DID},1)
exten => s,n(setlanguage),Set(CHANNEL(language)=${SIPLANG})
exten => s,n,Goto(from-trunk,${DID},1)
exten => s,n(noanonymous),Set(TIMEOUT(absolute)=15)
exten => s,n,Log(WARNING,"Rejecting unknown SIP connection from ${CHANNEL(recvip)}")
exten => s,n,Answer
exten => s,n,Wait(2)
exten => s,n,Playback(ss-noservice)
exten => s,n,Playtones(congestion)
exten => s,n,Congestion(5)
exten => h,1,Hangup
exten => i,1,Hangup
exten => t,1,Hangup
;-------------------------------------------------------------------------------
Testing
Asterisk 11.6
FreePBX 2.11.x
Testing was completed by using a Callcentric DID, assigned as a 1777XXX1234 DID and a 1777XXX1234EXT. All calls with the aforementioned inbound route completed succesfully. The trunk definition used was as follows during testing:
trunk name: callcentric
context=from-trunk
fromdomain=callcentric.com
fromuser=1777XXXXXXX
host=callcentric.com
insecure=port,invite
secret=YOUR PASSWORD
type=peer
defaultuser=1777XXXXXXX
disallow=all
allow=g722,ulaw <===USE WHAT YOU SEEM FIT.
Registration:
1777XXXXXXX:[email protected]/1777XXXXXXX
Installation:
If you are using the above PIAF, simply copy/paste your changes to extensions_override_freepbx.conf via Config Edit, then press update, and then Re-Read Configs option.
.