Register active

Revision as of 15:32, 25 August 2021 by Petr.halounek (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to list all active registrations from single IP using the API

following example requires to have managerip and managerport set to 5029 (by default)

example for searching using username

username is abcdefg

echo 'listregisters {"zip":"no","limit":30,"states":"OK","filter":{"digestusername":"abcdefg"},"sort_field":"calldate","sort_dir":"desc"}'|nc 5029

example for searching using callerIP and username

usernamce is abcdefg, ip is

echo 'listregisters {"zip":"no","limit":30,"states":"OK","filter":{"sipcallerip":"","sipcallerdip_type":1,"numFTC_type":0,"domainFTC_type":0,"domainFTC_group_id_type":0,"digestusername":"11"},"sort_field":"calldate","sort_dir":"desc"}'|nc 5029

Usage of listregister manager command without arguments

Following register_active.php script will get detail about all ACTIVE registrations done via managerapi, and then its filtered for records from single IP. example for use:

active_register.php ""

Script active_register.php

if (!array_key_exists ("1",$argv)) exit; #ensure argument passed

exec("echo 'listregisters' | nc 5029",$retstr,$rt);
if (!array_key_exists ("2",$data)) exit; #ensure some active register(s) in list

$reglist=$data; array_shift($reglist); array_shift($reglist); #skip two items at begin

foreach ($reglist as $n=>$item) {
        if ($item[$sipcallerip_key] == $searchVal) var_dump($item);