1. Bicom Systems
  2. Solution home
  3. SERVERware
  4. HOWTOs SERVERware 5

HOWTO :: List extensions with their MAC addresses

This informations can be listed from mysql database.


Procedure is:


use admin_site;

select P. ext, P.name, U.mac from pbxware_users_autoprov as U LEFT JOIN XXX_pbxware as P ON P.id = U.extid WHERE U.server='X';



List this for all tenants,



#!/bin/bash

cd /opt/pbxware

for T in $(find pw/etc/asterisk/ -maxdepth 1 -name '[0-9]*' -type d | sort -n); do

T=$(basename $T)

Q="

SELECT $T AS '#tenant', t1.ext,left(substring(t1.data, instr(t1.data, 'mac')),17) MAC,t2.name AS UAD

from admin_site.${T}_pbxware AS t1 

JOIN admin_site.pbxware_devices AS t2 ON t1.ua = t2.id 

WHERE t1.ref = 'sip:ext' and t2.name IS NOT NULL"

sh/mysql -B -e "$Q" | sed "s/\\t/,/g"

done