Created
October 11, 2012 00:04
-
-
Save mattvv/3869317 to your computer and use it in GitHub Desktop.
Revisions
-
Matt Van revised this gist
Oct 11, 2012 . 3 changed files with 71 additions and 35 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ =item B<check_live> { $username, $domain, \%data } =back =over Checks if a certain subscriber is on a call. Returns true if they are and false if they are not. =back =cut sub check_live { my $self = shift; my $data = shift; $self->_require_userdom($data); $self->_check_subscriber_data($$data{data}); my $dispatcher = Sipwise::Provisioning::XMLDispatcher->new; my @results = $dispatcher->dispatch("proxy-ng", 1, 1, <<EOF); <?xml version="1.0" ?> <methodCall> <methodName>dlg.list</methodName> <params/> </methodCall> EOF my $result = @results[0]->[2]; my $substring = "$$data{username}\@$$data{domain}"; if (index($result, $substring) != -1) { return "true"; } return "false"; } ... later on elsif($function eq 'check_bool' or $function eq 'check_username' or $function eq 'check_ip' or $function eq 'check_ip4' or $function eq 'check_ip6' or $function eq 'check_ip6_brackets' or $function eq 'check_ipnet' or $function eq 'check_domain' or $function eq 'check_sip_uri' or $function eq 'check_sip_uri_pattern' or $function eq 'check_sip_uri_prefix' or $function eq 'check_sip_username' or $function eq 'check_email' or $function eq 'check_cc' or $function eq 'check_ac' or $function eq 'check_sn' or $function eq 'check_E164_number' or $function eq 'check_E164_shell_pattern' or $function eq 'check_sip_username_shell_pattern' or $function eq 'check_vsc_format' or $function eq 'check_date' or $function eq 'check_time' or $function eq 'check_timestamp' or $function eq 'check_sip_transport_protocol' or $function eq 'get_localized_string' or $function eq 'check_selected_enum' or $function eq 'check_regex_syntax' or $function eq 'check_localpart' or $function eq 'check_live' ) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ sub check_live { typed $Voip->handle_request('check_live', pop) } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,35 +0,0 @@ -
Matt Van renamed this gist
Oct 11, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Matt Van created this gist
Oct 11, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ =item B<check_live> { $username, $domain, \%data } =back =over Checks if a certain subscriber is on a call. Returns true if they are and false if they are not. =back =cut sub check_live { my $self = shift; my $data = shift; $self->_require_userdom($data); $self->_check_subscriber_data($$data{data}); my $dispatcher = Sipwise::Provisioning::XMLDispatcher->new; my @results = $dispatcher->dispatch("proxy-ng", 1, 1, <<EOF); <?xml version="1.0" ?> <methodCall> <methodName>dlg.list</methodName> <params/> </methodCall> EOF my $result = @results[0]->[2]; my $substring = "$$data{username}\@$$data{domain}"; if (index($result, $substring) != -1) { return "true"; } return "false"; }