====== Extract SIP: address from MAD LDAP for Pidgin ====== ===== Using Pidgin with Lync ===== Pidgin can talk to a MS Lync/Office Communicator server using the SIPE plugin. However, buddies are not populated. I have written a script which authenticates using LDAP to MAD and queries a Global Catalogue server for the SIP: attributes for all users in a specified OU. A GC server is found from DNS SRV records, this will probably return several servers, the first one is used and if this fails, the next one in the list will be queried. [andrew@fedora16 scripts]$ cat getsipforpidgin.sh #!/bin/bash #gets ldap server from dns, uses ldapsearch to find sip:user@domain for pidgin buddy list #turn on debug, -x starts, +x stops. set +x #DOMAIN=is.ad.zzz.com DOMAIN=`dnsdomainname` CN='cn=Your.Name,OU=CDG,OU=Users,OU=_Global,DC=is,DC=mad,DC=zzz,DC=com' SEARCHBASE='OU=CDG,OU=Users,OU=_Global,dc=is,dc=mad,dc=zzz,dc=com' echo "dnsdomain is >${DOMAIN}<" #save IFS for later OLDIFS="$IFS" IFS=$'\n' # newlines are the only separator #Get server names from DNS using srv records GLOBALCATALOG=( $(dig -t SRV +short _gc._tcp.mad.zzz.com | grep is.mad | cut -d' ' -f4) ) #reset IFS IFS="$OLDIFS" echo -n "Global Catalogue servers, " # get length of an array GCLENGTH=${#GLOBALCATALOG[@]} echo "${GCLENGTH} Global catalogue servers found." echo " " # use for loop read all GC servers for (( gc=0; gc<${GCLENGTH}; gc++ )); do echo "Using >${GLOBALCATALOG[$gc]}<" echo "===============================" echo "" ldapsearch -x -L -h ${GLOBALCATALOG[$gc]} -D "${CN}" -W -b "${SEARCHBASE=}" -s sub proxyAddresses | grep sip | cut -d: -f2- | cut -d' ' -f2- | sort LDAPSEARCHRESULT=$? if [ ${LDAPSEARCHRESULT} = 0 ] then break fi done exit 0 #ldapsearch -x -L -h dc01.is.mad.zzz.com -D "cn=Your.Name,OU=CDG,OU=Users,OU=_Global,DC=is,DC=mad,DC=zzz,DC=com" -W -b \ #OU=CDG,OU=Users,OU=_Global,dc=is,dc=mad,dc=zzz,dc=com -s sub proxyAddresses | grep sip | cut -d: -f2- | cut -d' ' -f2- | sort [andrew@fedora16 scripts]$ This produces a list in the following format:- [andrew@fedora16 scripts]$ ./getsipforpidgin.sh dnsdomain is >is.mad.zzz.com< Global Catalogue servers, 16 Global catalogue servers found. Using >dcis01.is.mad.zzz.com.< =============================== Enter LDAP Password: sip:name.one@zzz.com sip:name.two@zzz.com Next, how to import this list into Pidgin. FIXME