userdoc:tt_ldap_client

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
userdoc:tt_ldap_client [2013/10/25 13:52]
abelbeck [Phone LDAP Directory CLI Scripts]
userdoc:tt_ldap_client [2013/11/18 08:35]
abelbeck [Phone LDAP Directory CLI Scripts]
Line 90: Line 90:
 In addition to the HTTPS CGI script described above, AstLinux also supports Command-Line-Interface (CLI) scripts to access LDAP directory data.  By default the scripts are configured to access the LDAP server with anonymous access (possibly 'localhost' when the LDAP Server enabled).  If user/pass authentication is required it is suggested to copy the script from ''/usr/bin/'' to ''/mnt/kd/bin/'' and customize the script accordingly. In addition to the HTTPS CGI script described above, AstLinux also supports Command-Line-Interface (CLI) scripts to access LDAP directory data.  By default the scripts are configured to access the LDAP server with anonymous access (possibly 'localhost' when the LDAP Server enabled).  If user/pass authentication is required it is suggested to copy the script from ''/usr/bin/'' to ''/mnt/kd/bin/'' and customize the script accordingly.
  
-If the local LDAP Server is enabled and populated with a directory, the typical LDAP Client setting would be as follows:+!!Note: AstLinux 1.1.4 or later is required!! 
 + 
 +If the local LDAP Server is enabled and populated with a directory, the typical LDAP Client setting to anonymously access via localhost is as follows:
  
 {{:userdoc:ldap-client-system-defaults.jpg?nolink|LDAP Client Defaults}} {{:userdoc:ldap-client-system-defaults.jpg?nolink|LDAP Client Defaults}}
 +\\
 +\\
 +**ldap-phone-num-lookup**
  
-!!NoteAstLinux 1.1.4 or later is required!!+  Usageldap-phone-num-lookup [-ht] [--tls] [-m|--match-num list] [-o|--output-name list] number 
 +   
 +  Options: 
 +      -h, --help             Show help 
 +      -t, --tls              Enable TLS using start_tls 
 +      -m, --match-num list   Comma separated list to match numberDefault: telephonenumber,mobile,cellphone,homephone 
 +      -o, --output-name list Comma separated list to display the nameDefault: displayname,cn,sn,givenname
  
 +By default the 'number' is matched as: ''(|(telephonenumber=$number)(mobile=$number)(cellphone=$number)(homephone=$number))''
 +
 +Standard output returns the first ''displayname/cn/sn/givenname'' that contains a matching number.
 +
 +Use the optional ''-m|--match-num list'' and ''-o|--output-name list'' options to limit and specify the order of the matching and output.
 +\\
 +\\
 **ldap-phone-name-lookup** **ldap-phone-name-lookup**
  
-  Usage: ldap-phone-name-lookup [--tls] name+  Usage: ldap-phone-name-lookup [-ht] [--tls] [-m|--match-name list] [-o|--output-num list] name 
 +   
 +  Options: 
 +      -h, --help             Show help 
 +      -t, --tls              Enable TLS using start_tls 
 +      -m, --match-name list  Comma separated list to match name. Default: cn,displayname 
 +      -o, --output-num list  Comma separated list to display numbers. Default: telephonenumber,mobile,cellphone,homephone
  
-The 'name' is filtered as: ''(|(cn=$name)(displayname=$name))''+The 'name' is matched as: ''(|(cn=$name)(displayname=$name))''
  
 Standard output returns (multiple) phone numbers separated by a tilde (~). Standard output returns (multiple) phone numbers separated by a tilde (~).
  
-**ldap-phone-num-lookup**+Use the optional ''-m|--match-name list'' and ''-o|--output-num list'' options to limit and specify the order of the matching and output.
  
-  Usage: ldap-phone-num-lookup [--tls] number+==== Asterisk Usage Examples ====
  
-The 'numberis filtered as: ''(|(telephonenumber=$number)(mobile=$number)(cellphone=$number)(homephone=$number))''+Examples how the ''ldap-phone-name-lookup'' and ''ldap-phone-num-lookup'' scripts can be used an Asterisk dialplan.
  
-Standard output returns the first ''displayname/cn/sn/givenname'' that contains a matching number.+**CallerID number lookup via LDAP and AstDB**
  
-==== Asterisk Usage Examples ====+<code>[subCID-lookup] 
 +; CallerID(num) lookup, first LDAP then AstDB 
 +exten => s,1,NoOp(CallerID lookup, first LDAP then AstDB ...) 
 + same => n,ExecIf($[ $["${CALLERID(num)}" !""] & $["${CALLERID(name)}" ""] ]?Set(LDAP_Name=${SHELL(ldap-phone-num-lookup '${ARG1}')}) 
 + same => n,ExecIf($["${LDAP_Name}" !""]?Set(CALLERID(name)=${LDAP_Name})) 
 + same => n,ExecIf($[ $["${CALLERID(num)}" != ""] & $["${CALLERID(name)}" = ""] ]?Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})) 
 + same => n,Return()</code>
  
-Examples how the ''ldap-phone-name-lookup'' and ''ldap-phone-num-lookup'' scripts can be used an Asterisk dialplan.+And in your incoming context put this line somewhere: 
 + 
 +  exten => s,n,GoSub(subCID-lookup,s,1(${CALLERID(num)}))
  
  
  • userdoc/tt_ldap_client.txt
  • Last modified: 2013/11/18 08:37
  • by abelbeck