How to create a multitenant users in Asterisk-pbx?

Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers. Each customer is called a tenant.
For creating multitenant we need to create custom extensions in /etc/asterisk/extensions_custom.conf and give relevant context route calls:

[company1]

exten => 1234512345,1,Set(__FROM_DID=${EXTEN})
exten => 1234512345,n,Gosub(app-blacklist-check,s,1)
exten => 1234512345,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 1234512345,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 9498851902,n,Set(CALLERPRES()=allowed_not_screened)
exten => s,1,Dial(SIP/1500)

[company2]

exten => 1234567890,1,Set(__FROM_DID=${EXTEN})
exten => 1234567890,n,Gosub(app-blacklist-check,s,1)
exten => 1234567890,n,ExecIf($[ “${CALLERID(name)}” = “” ] ?Set(CALLERID(name)=${CALLERID(num)}))
exten => 1234567890,n,Set(__CALLINGPRES_SV=${CALLERPRES()})
exten => 1234567890,n,Set(CALLERPRES()=allowed_not_screened)
exten => s,1,Dial(SIP/1701)