Hi Volker An Example by which I query a profile counter:
curl -X POST http://VoiceSwitch:8080/RPC -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "dlg.profile_get_size", "params" : ["channels-inuse", "Customer-XXXX"], "id": 1}' I think, with jsonrpc 2.0 you could pass an array of named parameters, but I also struggled with that, just passing an array of parameters in the right order did it for me. Perl Snippel I just had at hand while elaborating how to use the output and using the JSON::RPC2::Client and LWP::UserAgent modules. my $ua = LWP::UserAgent->new(); my $h = HTTP::Headers->new( Content_Type => 'application/json' ); my $client = JSON::RPC2::Client->new(); [...] $method = "ul.dump"; @params = (); ($json_request, $call) = $client->call($method, @params); $req = HTTP::Request->new('POST', $reguri . $kamapi, $h, $json_request); $res = $ua->request($req); print "=== KAM RPC: $method ===\n"; #print $res->decoded_content; print "\n"; my $ul = decode_json($res->decoded_content); #print Dumper($ul); #print Dumper($ul->{'result'}->{'Domains'}[0]->{'Domain'}); my @aors = @{$ul->{'result'}->{'Domains'}[0]->{'Domain'}->{'AoRs'}}; foreach my $aor (@aors) { print "======== AOR [$aor->{'Info'}->{'AoR'}] =========\n"; my @contacts = @{$aor->{'Info'}->{'Contacts'}}; foreach my $contact (@contacts) { print "\t == contact ==\n"; print "\tAddress:\t$contact->{'Contact'}->{'Address'}\n"; print "\tExpires:\t$contact->{'Contact'}->{'Expires'}\n"; print "\tUser Agent:\t$contact->{'Contact'}->{'User-Agent'}\n"; } } Mit freundlichen Grüssen -Benoît Panizzon- -- I m p r o W a r e A G - Leiter Commerce Kunden ______________________________________________________ Zurlindenstrasse 29 Tel +41 61 826 93 00 CH-4133 Pratteln Fax +41 61 826 93 01 Schweiz Web http://www.imp.ch ______________________________________________________ __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
