Hello
is it possible to use external LDAP server with S-series ?
6 comments
-
Larry Neblett Not in the way that you post the question.
It is the phones that use the LDAP function to obtain contacts/directory. The S series has an app that can be enabled such that an LDAP server can reside on the PBX and thereby make it easier in the phone provisioning as well as for those that do not have an LDAP server. Otherwise, should you wish to use a different server, then you need to point the phones to the LDAP server of your choice as this has nothing to do with the S PBX.
A number of folks have requested some form of synchronization between the resident LDAP and other external servers (LDAP, Google, etc.) but as far as I am aware I do not think this has been pursued by Yeastar. At present, I think only a manual import/export CSV file is supported.
-
Artem Krhseminsky thanks, Larry
I'm courius can CDR and Recordings screen show Call From/CallTo column not just numbers but names from LDAP address book / and external address book?
Also same question about Linkus - can it use external LDAP.
Internal LDAP is too simple , my company needed a little more sophisticated address book . With organizations and persons, and more phones.If only it was possible to enter with root .... i 'm very angry at myself that i not read that s series have no root
-
Larry Neblett I certainly think not when using an external directory as the system would not know about it. I also doubt it when using the resident app LDAP. The way that many use the function is similar to that of a cell phone - the system will get a call and send to the destination, the system will use the attributes seen in the INVITE or call as sent from the provider. When the phone receives the INVITE it is usually the one that wil see the CID of the caller and then parse the directories looking for a match as the user may also have a personal directory that is unknown to any LDAP server anywhere. If not mistaken the LDAP in the PBX is limited to 1000 entries.
I am uncertain about Linkus, I know it can use Outlook, Google Contacts and some supported CRM packages, but I do not know about support for an external LDAP. I see nothing in the settings that seem to point to that so I am inclined to answer negatively, but support would provide a more concise answer.
I am of the opinion that there are some 3rd party call accounting packages that can take a CDR output and then marry them up to a LDAP so that you can get what you seek, but I have no direct experience with it, You would need to do a Google search to find any such possibilities.
-
Artem Krhseminsky Way to go:
1. Yeastar S series with no root
2. External LDAP Server in same LAN
I have used Raspberry Pi
apache+php+openldap+phpLDAPadmin3. Modify dialplan
I have couple of trunks, but currently i testes only one one of them : GSM1-53.1 block found in /etc/asterisk/extensions.conf :
[callinbound_trunk_GSM1-5]
exten = _.,1,YsWalkContext(whitelist-inbound,${EXTEN},1,${CALLERID(num)},inbound)
exten = _.,2,NoOp(NODNIS)
exten = _.,3,Set(CDR(extfield1)=${CALLERID(name)})
exten = _.,4,Set(REALCALLERNUM=${CALLERID(num)})
exten = _./_+.,5,Set(CALLERID(num)=${CALLERID(num):1})
exten = _.,5,Noop(do nothing)
exten = _.,6,NoOp(*** i am here: callinbound_trunk_GSM1-5)
exten = _.,7,Macro(inrouter_Routein,1,${EXTEN})
exten = h,1,HangUp()
3.2 created /ysdisk/support/customcfg/extensions_custom.cfg
with lighnly modified callinbound_trunk_GSM1-5 and Macros name_ExtLDAP[callinbound_trunk_GSM1-5]
exten = _.,1,YsWalkContext(whitelist-inbound,${EXTEN},1,${CALLERID(num)},inbound)
exten = _.,2,NoOp(NODNIS)
exten = _.,3,Set(REALCALLERNUM=${CALLERID(num)})
exten = _./_+.,4,Set(CALLERID(num)=${CALLERID(num):1})
exten = _.,5,Macro(name_ExtLDAP,1)
exten = _.,6,Set(CDR(extfield1)=${CALLERID(name)})
exten = _.,7,Noop(do nothing)
exten = _.,8,Macro(inrouter_Routein,1,${EXTEN})
exten = h,1,HangUp()[macro-name_ExtLDAP]
exten = s,1,Set(foo=${SHELL(curl --connect-timeout 1 --max-time 2 http://192.168.33.3/dir/dir.php?n=${CALLERID(num))})
exten = s,2,ExecIf(${LEN(${foo})>0}?Set(CALLERID(name)=${foo}))
So main action is here:
foo=${SHELL(curl --connect-timeout 1 --max-time 2 http://192.168.33.3/dir/dir.php?n=${CALLERID(num))}Curl called (with time limits) pointed to php script on external LDAP machine that get incoming number and make search in ldap server. If entry found, cn field returned, if not - same number. If timeout happened, next string checks return value length.
Don't forget issue command astconfig in shell, and "dialplan reload" in asterisk shell after edititig anything in *_custom.conf.
4. Small php script recieve phone number and returns name from ldap database if found:
<?php
$number = "0";
if( isset($_GET["n"])) $number = $_GET["n"];
else $number = -1;
$number = preg_replace("/[^0-9.]/", '', $number);$ldapserver = "ldap://192.168.33.3";
$ldapuser = "cn=admin,dc=vybor,dc=biz,dc=ua";
$ldappass = "*mypassword*";
$ldaptree = "ou=addressbook,dc=vybor,dc=biz,dc=ua";
$filter="mobile=".$number;$bFound = false;
$name = $number;$ldapconn = ldap_connect($ldapserver);
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if($ldapconn) {
$ldapbind = ldap_bind($ldapconn, $ldapuser, $ldappass);
if($ldapbind) {
$result = ldap_search($ldapconn, $ldaptree, $filter, array("cn"));
$data = ldap_get_entries($ldapconn, $result);
//echo "<br\r\n><pre>"; print_r($data); echo "</pre>";
if($data["count"] > 0 )
foreach($data as $entry) {
if(is_array($entry)) {
//echo "<br><hr>\r\n";
//var_dump($entry);
$bFound = true;
$name = $entry["cn"][0];
break;
}
}
} else {
//echo "error ldap bind";
}
ldap_close($ldapconn);
} else {
//echo "error ldap_connect";
}
//error_log("dir.php In:".$number.",out:".$name);
echo $name;?>
CONCLUSION
1. All phones, including old Cisco 7911 without direct ldap access, get caller name
2. Yeastar CDR database now store caller name from ldap
3. I have LDAP server that can be configuring for my needs. For example one person can have many mobile phones without restrictions, or i can mix persons and organizations in addressbookProblems:
1. I can't find one place to put my macro working for all trunks. Looks like all trunks blocks must be places in extensions_custom.conf. Will be glad to get help with this
2. I not found a way to access external LDAP directly from dailplan
3. Also i'm interesting is there a way to connect to mysql from dialplan
4. Linkus not show the name of a caller, while Zoiper shows -
Riddhe M It seems good solution and useful.
But I am not have you tired the LDAP build-in the pbx.
Also maybe Yeastar guy could answer your doubt.
-
Artem Krhseminsky Riddhe, built-in LDAP is very limited. I spent 10 minutes to try it and couple hours to google anything about it.
About Yeastar guy i will be glad to hear from him