Difference between revisions of "Prelocalization"

From Kolmisoft Wiki
Jump to navigationJump to search
Line 13: Line 13:
  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,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)
If you are using MNP 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)


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

Revision as of 08:38, 3 July 2018

Prelocalization allows to do Localization before any other action in MOR.

How to enable it

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

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 MNP 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)


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