Difference between revisions of "Prelocalization"

From Kolmisoft Wiki
Jump to navigationJump to search
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Prelocalization allows to do [http://wiki.kolmisoft.com/index.php/Localization Localization] before any other action in MOR.
Prelocalization allows to do '''additional''' [http://wiki.kolmisoft.com/index.php/Localization Localization] before any other action in MOR. Prelocalization is applied to incoming calls (calls to DID numbers) too.
 
<br><br>
= Purpose =
 
'''<big>Prelocalization allows to greatly reduce the number of Localization rules.</big>'''<br><br>
 
MNP routing and EU/NonEU discrimination need a lot of rules in order to work. <br>
When calls come in from clients that can have one of the following formats (Greek example):
* 210XXXXXXX (national format)
* 30210XXXXXXX(E.164 format)
* +30210XXXXXXX (International format)
* 0030210XXXXXXX (international format)<br>
If prelocalization does not exist, then each rule applied to localization must be repeated for every dialing type, thus increasing the overall amount of rules. <br>
This is why prelocalization is needed, so we will avoid adding same rule multiple times in order to cover all dialing types from clients.<br>
<br>
Example: In MNP environment prefixes are added to the destination numbers. These prefixes have to be removed using localization rules.<br>
If prefix added is 569000 then we will need 4 rules in order to solve this although with prelocalization we would only need one rule<br>
<br>
Without prelocalization rule:
 
[[File:prelocalization_example1.png]]
<br><br>
If prelocalization rules exist, then before MNP prefix is added, or before localization is hit, number would already be localized e.g. 302XXXXXXXXX so we would only need 1 rule instead 4 for one prefix. <br>
Prelocalization greatly reduces amount of rules needed so if it exist we would only need following rule for the same case:<br>
 
[[File:prelocalization_example2.png]]
 
<br><br>


=How to enable it=
=How to enable it=
''' From X17 Core version 27.0.33, this is no longer needed, continue with [[Prelocalization#Configuration]]'''


'''Latest MOR X12 (or higher) version is required for this feature to work'''<br/><br/>
'''Latest MOR X12 (or higher) version is required for this feature to work'''<br/><br/>


Modify '''/etc/asterisk/mor_extensions.conf''' to include MOR prelocalization AGI script (at around 40th line, just above '''exten => _X.,n,mor(${EXTEN})''')
!!! Please note that if your '''extensions_mor.conf''' contains '''_[A-Z0-9]!''' instead of '''_X.''' then all extensions described bellow should also be set to '''_[A-Z0-9]!'''
 
 
Modify '''/etc/asterisk/extensions_mor.conf''' to include MOR prelocalization AGI script (at around 40th line, just above '''exten => _X.,n,mor(${EXTEN})''')


  exten => _X.,1,NoOp(MOR starts)
  exten => _X.,1,NoOp(MOR starts)
Line 13: Line 45:
  exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
  exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
  exten => _X.,n,Set(TIMEOUT(response)=20)
  exten => _X.,n,Set(TIMEOUT(response)=20)
  exten => _X.,n,AGI(mor_prelocalization)  <--------------------------------------- ADD THIS LINE HERE ----------- !!!!
  exten => _X.,n,AGI(mor_prelocalization)  ;<--------------------------------------- ADD THIS LINE HERE ----------- !!!!
exten => _X.,n,mor(${EXTEN})
exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)
 
If you are using [[Mobile Number Portability Addon]], then this line should go BEFORE MNP addon line and should look like this:
 
exten => _X.,1,AGI(mor_prelocalization)  ;<--------------------------------------- ADD THIS LINE HERE ----------- !!!!
exten => _X.,n,AGI(mor_mnp)
exten => _X.,n,GotoIf($["${MOR_DIAL_LOCAL_IVR}" != ""]?mor_dial_local_ivr,s,1)
exten => _X.,n,Gosub(diversion_settings,${EXTEN},1)
exten => _X.,n,Gosub(proxy_settings,${EXTEN},1)
exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
exten => _X.,n,Set(TIMEOUT(response)=20)
exten => _X.,n,Set(TIMEOUT(digit)=10)
exten => _X.,n,mor(${EXTEN})
exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)
 
 
If you are using system with Proxy solution, then this line should go AFTER proxy_settings and BEFORE MNP addon (if it is used):
 
exten => _X.,1,GotoIf($["${MOR_DIAL_LOCAL_IVR}" != ""]?mor_dial_local_ivr,s,1)
exten => _X.,n,Gosub(diversion_settings,${EXTEN},1)
exten => _X.,n,Gosub(proxy_settings,${EXTEN},1)
exten => _X.,n,AGI(mor_prelocalization)  ;<---------Prelocalization line should go after proxy and before mnp (if it is used)---------- !!!!
exten => _X.,n,AGI(mor_mnp)
exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
exten => _X.,n,Set(TIMEOUT(response)=20)
exten => _X.,n,Set(TIMEOUT(digit)=10)
  exten => _X.,n,mor(${EXTEN})
  exten => _X.,n,mor(${EXTEN})
  exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
  exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
  exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
  exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
  exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)
  exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)


Asterisk dialplan should be reloaded each time this file is changed:
Asterisk dialplan should be reloaded each time this file is changed:
Line 29: Line 94:
'''prelocalization_location''' - which Location to use for prelocalization? Value should be Location ID.<br/>
'''prelocalization_location''' - which Location to use for prelocalization? Value should be Location ID.<br/>
'''prelocalization_global_rules''' - should we include global rules? Value is either 1 or 0 (default 0).<br/><br/>
'''prelocalization_global_rules''' - should we include global rules? Value is either 1 or 0 (default 0).<br/><br/>
For example:
  prelocalization_location_id = 17
  prelocalization_global_rules = 1


Note: reload is not required when this file is changed.
Note: reload is not required when this file is changed.
=Location rules=
Prelocalization supports only '''Destination''' and '''Source''' rules. '''Combined''' rules are not supported.<br/>
Only '''Cut''', '''Add''', '''Min Len''' and  '''Max Len''' are applied when doing prelocalization.


=Script output=
=Script output=
Line 43: Line 121:
  mor_prelocalization: Localized src number: 390000000 (cut: +, add: )                                                                                                                                                                         
  mor_prelocalization: Localized src number: 390000000 (cut: +, add: )                                                                                                                                                                         
  mor_prelocalization: MOR prelocalization AGI script stopped
  mor_prelocalization: MOR prelocalization AGI script stopped
<br><br>
=See also=
* [[Localization]]
* [[Location Groups]]

Latest revision as of 11:39, 26 January 2023

Prelocalization allows to do additional Localization before any other action in MOR. Prelocalization is applied to incoming calls (calls to DID numbers) too.



Purpose

Prelocalization allows to greatly reduce the number of Localization rules.

MNP routing and EU/NonEU discrimination need a lot of rules in order to work.
When calls come in from clients that can have one of the following formats (Greek example):

  • 210XXXXXXX (national format)
  • 30210XXXXXXX(E.164 format)
  • +30210XXXXXXX (International format)
  • 0030210XXXXXXX (international format)

If prelocalization does not exist, then each rule applied to localization must be repeated for every dialing type, thus increasing the overall amount of rules.
This is why prelocalization is needed, so we will avoid adding same rule multiple times in order to cover all dialing types from clients.

Example: In MNP environment prefixes are added to the destination numbers. These prefixes have to be removed using localization rules.
If prefix added is 569000 then we will need 4 rules in order to solve this although with prelocalization we would only need one rule

Without prelocalization rule:

Prelocalization example1.png

If prelocalization rules exist, then before MNP prefix is added, or before localization is hit, number would already be localized e.g. 302XXXXXXXXX so we would only need 1 rule instead 4 for one prefix.
Prelocalization greatly reduces amount of rules needed so if it exist we would only need following rule for the same case:

Prelocalization example2.png



How to enable it

From X17 Core version 27.0.33, this is no longer needed, continue with Prelocalization#Configuration

Latest MOR X12 (or higher) version is required for this feature to work

!!! Please note that if your extensions_mor.conf contains _[A-Z0-9]! instead of _X. then all extensions described bellow should also be set to _[A-Z0-9]!


Modify /etc/asterisk/extensions_mor.conf to include MOR prelocalization AGI script (at around 40th line, just above exten => _X.,n,mor(${EXTEN}))

exten => _X.,1,NoOp(MOR starts)
exten => _X.,n,GotoIf($["${MOR_DIAL_LOCAL_IVR}" != ""]?mor_dial_local_ivr,s,1)
exten => _X.,n,Gosub(diversion_settings,${EXTEN},1)
exten => _X.,n,Gosub(proxy_settings,${EXTEN},1)
exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
exten => _X.,n,Set(TIMEOUT(response)=20)
exten => _X.,n,AGI(mor_prelocalization)  ;<--------------------------------------- ADD THIS LINE HERE ----------- !!!!
exten => _X.,n,mor(${EXTEN})
exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)

If you are using Mobile Number Portability Addon, then this line should go BEFORE MNP addon line and should look like this:

exten => _X.,1,AGI(mor_prelocalization)   ;<--------------------------------------- ADD THIS LINE HERE ----------- !!!!
exten => _X.,n,AGI(mor_mnp)
exten => _X.,n,GotoIf($["${MOR_DIAL_LOCAL_IVR}" != ""]?mor_dial_local_ivr,s,1)
exten => _X.,n,Gosub(diversion_settings,${EXTEN},1)
exten => _X.,n,Gosub(proxy_settings,${EXTEN},1)
exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
exten => _X.,n,Set(TIMEOUT(response)=20)
exten => _X.,n,Set(TIMEOUT(digit)=10)
exten => _X.,n,mor(${EXTEN})
exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)


If you are using system with Proxy solution, then this line should go AFTER proxy_settings and BEFORE MNP addon (if it is used):

exten => _X.,1,GotoIf($["${MOR_DIAL_LOCAL_IVR}" != ""]?mor_dial_local_ivr,s,1)
exten => _X.,n,Gosub(diversion_settings,${EXTEN},1)
exten => _X.,n,Gosub(proxy_settings,${EXTEN},1)
exten => _X.,n,AGI(mor_prelocalization)   ;<---------Prelocalization line should go after proxy and before mnp (if it is used)---------- !!!!
exten => _X.,n,AGI(mor_mnp)
exten => _X.,n,Set(__MOR_SIP_TO=${SIP_HEADER(To)})
exten => _X.,n,Set(TIMEOUT(response)=20)
exten => _X.,n,Set(TIMEOUT(digit)=10)
exten => _X.,n,mor(${EXTEN})
exten => _X.,n,GotoIf($["${MOR_CARD_USED}" != ""]?mor_callingcard,s,1)
exten => _X.,n,GotoIf($["${MOR_ANIPIN_USED}" != ""]?mor_anipin,s,1)
exten => _X.,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?BUSY,1:HANGUP,1)


Asterisk dialplan should be reloaded each time this file is changed:

asterisk -rx "dialplan reload"

Configuration

Configuration file /etc/mor/system.conf

prelocalization_location - which Location to use for prelocalization? Value should be Location ID.
prelocalization_global_rules - should we include global rules? Value is either 1 or 0 (default 0).

For example:

 prelocalization_location_id = 17
 prelocalization_global_rules = 1


Note: reload is not required when this file is changed.

Location rules

Prelocalization supports only Destination and Source rules. Combined rules are not supported.

Only Cut, Add, Min Len and Max Len are applied when doing prelocalization.

Script output

Prelocalization output is written to Asterisk verbose log at the beginning of the call:

mor_prelocalization: MOR prelocalization AGI script started                                                                                                                                                                                  
mor_prelocalization: Original destination number: 00370123456                                                                                                                                                                                
mor_prelocalization: Original source number: +390000000
mor_prelocalization: Original source name: test
mor_prelocalization: Localized dst number: 370123456 (cut: 00, add: )
mor_prelocalization: Localized src number: 390000000 (cut: +, add: )                                                                                                                                                                         
mor_prelocalization: MOR prelocalization AGI script stopped



See also