Please help! Need help with dealing with multiple physical locations and 911

here is a rough sample using the FreePBX trunk predial hook to get the IP.

[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp()
; Check if outbound route marked emergency
exten => s,n,GotoIf($["${EMERGENCYROUTE}"=="YES"]?emergencyrouteused:skipvalidation)
exten => s,n,Hangup()
; The call was an emegerncy dial, do no processing, but note the log.
exten => s,n(emergencyrouteused),NoOp()
exten => s,n,Log(NOTICE, 911 was dialed by extension ${FROMEXTEN})
exten => s,n,Set(remote_addr=${CHANNEL(pjsip,remote_addr)})
exten => s,n,Set(ip_addr=${CUT(remote_addr,:,1)})
;;Add you logic here to set the CID based on IP.
; stuff here!
; Force the CID on the Trunk and then let the call go.
exten => s,n,Set(TRUNKCIDOVERRIDE=${YOUR_CID_TO_SEND})
; debug dump and hangup. obviously remove once all done.
exten => s,n,DumpChan
exten => s,n,Hangup()
; The call was not en emergency, nothing else to do.
exten => s,n(skipvalidation),NoOp()

These are the two variables.

ip_addr=64.53.199.99
remote_addr=64.53.199.99:1025
1 Like