Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pbxm-perl-lib-el7
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
static
pbxm-perl-lib-el7
Commits
1b7b980e
Commit
1b7b980e
authored
Jun 16, 2022
by
Andrey Shevchuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed InboundRoutes maps
parent
c495a28b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
527 additions
and
0 deletions
+527
-0
InboundRoutes.pm
...irdlane/perl_lib/Asterisk/API/Structures/InboundRoutes.pm
+53
-0
SingleInboundRoutes.pm
...e/perl_lib/Asterisk/API/Structures/SingleInboundRoutes.pm
+474
-0
No files found.
opt/thirdlane/perl_lib/Asterisk/API/Structures/InboundRoutes.pm
View file @
1b7b980e
...
...
@@ -81,6 +81,15 @@ our %out_hash_map = (
"sample"
=>
""
,
"transform"
=>
"routetype"
,
"type"
=>
"string"
},
"options"
=>
{
"description"
=>
"Routetype"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[{args:[],action:'tl-check-voicemail',schedule:'day'}]"
,
"transform"
=>
"options"
,
"type"
=>
"inbound_route_option"
}
);
...
...
@@ -157,15 +166,59 @@ my %in_hash_map = (
"sample"
=>
"schedule"
,
"transform"
=>
"routetype"
,
"type"
=>
"string"
},
"options"
=>
{
"description"
=>
"Routetype"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[{args:[],action:'tl-check-voicemail',schedule:'day'}]"
,
"transform"
=>
"options"
,
"type"
=>
"inbound_route_option"
}
);
our
%
out_option_hash_map
=
(
"args"
=>
{
"description"
=>
"Action arguments"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[]"
,
"transform"
=>
"args"
,
"type"
=>
"string"
},
"action"
=>
{
"description"
=>
"Action"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
"tl-check-voicemail"
,
"transform"
=>
"action"
,
"type"
=>
"string"
},
"schedule"
=>
{
"description"
=>
"Schedule"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
"day"
,
"transform"
=>
"schedule"
,
"type"
=>
"string"
},
);
our
%
requests
=
(
types
=>
[
{
"type"
=>
"inbound_route"
,
"structure"
=>
\%
out_hash_map
},
{
"type"
=>
"inbound_route_option"
,
"structure"
=>
\%
out_option_hash_map
}
],
operations
=>
[
{
...
...
opt/thirdlane/perl_lib/Asterisk/API/Structures/SingleInboundRoutes.pm
0 → 100644
View file @
1b7b980e
package
Asterisk::API::Structures::
SingleInboundRoutes
;
use
strict
;
use
warnings
;
use
Asterisk::API::Mapper::
Generic
;
use
Asterisk::API::Documentation::
Generic
;
our
$VERSION
=
"1"
;
our
%
out_hash_map
=
(
"billable"
=>
{
"description"
=>
"Billable"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"billable"
,
"type"
=>
"bool"
},
"channels"
=>
{
"description"
=>
"Channels"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"channels"
,
"type"
=>
"string"
},
"description"
=>
{
"description"
=>
"Description"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"description"
,
"type"
=>
"string"
},
"extension"
=>
{
"description"
=>
"Extension"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"did"
,
"type"
=>
"string"
},
"id"
=>
{
"description"
=>
"Route ID"
,
"format"
=>
"int64"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
1
,
"transform"
=>
"internal_id"
,
"type"
=>
"integer"
},
"prompt_language"
=>
{
"description"
=>
"Prompt language"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"prompt_language"
,
"type"
=>
"string"
},
"tz"
=>
{
"default"
=>
""
,
"description"
=>
"Time zone"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
""
,
"transform"
=>
"tz"
,
"type"
=>
"string"
},
"routetype"
=>
{
"description"
=>
"Routetype"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"routetype"
,
"type"
=>
"string"
},
"options"
=>
{
"description"
=>
"Routetype"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[{args:[],action:'tl-check-voicemail',schedule:'day'}]"
,
"transform"
=>
"options"
,
"type"
=>
"inbound_route_option"
}
);
my
%
in_hash_map
=
(
"billable"
=>
{
"description"
=>
"Billable"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"billable"
,
"type"
=>
"bool"
},
"channels"
=>
{
"description"
=>
"Channels"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"channels"
,
"type"
=>
"string"
},
"description"
=>
{
"description"
=>
"Description"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"description"
,
"type"
=>
"string"
},
"did"
=>
{
"description"
=>
"Did"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"extension"
,
"type"
=>
"string"
},
"internal_id"
=>
{
"description"
=>
"Route ID"
,
"format"
=>
"int64"
,
"hidden"
=>
1
,
"required"
=>
0
,
"transform"
=>
"id"
,
"type"
=>
"integer"
},
"prompt_language"
=>
{
"description"
=>
"Prompt language"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
""
,
"transform"
=>
"prompt_language"
,
"type"
=>
"string"
},
"tz"
=>
{
"default"
=>
""
,
"description"
=>
"Time zone"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
""
,
"transform"
=>
"tz"
,
"type"
=>
"string"
},
"routetype"
=>
{
"default"
=>
"schedule"
,
"description"
=>
"Route type"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
"schedule"
,
"transform"
=>
"routetype"
,
"type"
=>
"string"
},
"options"
=>
{
"description"
=>
"Routetype"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[{args:[],action:'tl-check-voicemail',schedule:'day'}]"
,
"transform"
=>
"options"
,
"type"
=>
"inbound_route_option"
}
);
our
%
out_option_hash_map
=
(
"args"
=>
{
"description"
=>
"Action arguments"
,
"format"
=>
"array"
,
"hidden"
=>
0
,
"required"
=>
0
,
"sample"
=>
"[]"
,
"transform"
=>
"args"
,
"type"
=>
"string"
},
"action"
=>
{
"description"
=>
"Action"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
"tl-check-voicemail"
,
"transform"
=>
"action"
,
"type"
=>
"string"
},
"schedule"
=>
{
"description"
=>
"Schedule"
,
"format"
=>
"raw"
,
"hidden"
=>
0
,
"required"
=>
1
,
"sample"
=>
"day"
,
"transform"
=>
"schedule"
,
"type"
=>
"string"
},
);
our
%
requests
=
(
types
=>
[
{
"type"
=>
"inbound_route"
,
"structure"
=>
\%
out_hash_map
},
{
"type"
=>
"inbound_route_option"
,
"structure"
=>
\%
out_option_hash_map
}
],
operations
=>
[
{
"path"
=>
"/api/inbound_routes/"
,
"method"
=>
"GET"
,
"summary"
=>
"Get Inbound Routes"
,
"notes"
=>
"Get Inbound Routes for tenant"
,
"consumes"
=>
[
"application/json"
],
"parameters"
=>
[
],
"responses"
=>
[
{
"code"
=>
200
,
"type"
=>
"inbound_route"
}
]
},
{
"path"
=>
"/api/inbound_routes/{routeId}"
,
"method"
=>
"GET"
,
"summary"
=>
"Get one Inbound Route"
,
"notes"
=>
"Get one Inbound Route"
,
"consumes"
=>
[
"application/json"
],
"parameters"
=>
[
{
"name"
=>
"routeId"
,
"description"
=>
"Route ID"
,
"required"
=>
1
,
"type"
=>
"string"
,
"parameter"
=>
"path"
,
"sample"
=>
"14152223333"
}
],
"responses"
=>
[
{
"code"
=>
200
,
"type"
=>
"inbound_route"
}
]
},
{
"path"
=>
"/api/inbound_routes/{routeId}"
,
"method"
=>
"PUT"
,
"summary"
=>
"Update Inbound Route"
,
"notes"
=>
"Update Inbound Route"
,
"consumes"
=>
[
"application/json"
],
"parameters"
=>
[
{
"name"
=>
"body"
,
"description"
=>
"No description"
,
"required"
=>
1
,
"type"
=>
"inbound_route"
,
"parameter"
=>
"request"
,
"sample"
=>
q({"routetype" : "Time Based 5", "tenant" : "thirdlane"})
},
{
"name"
=>
"routeId"
,
"description"
=>
"Route ID"
,
"required"
=>
1
,
"type"
=>
"string"
,
"parameter"
=>
"path"
,
"sample"
=>
"14152223333"
}
],
"responses"
=>
[
{
"code"
=>
200
,
"type"
=>
"inbound_route"
}
]
},
{
"path"
=>
"/api/inbound_routes/"
,
"method"
=>
"POST"
,
"summary"
=>
"Add Inbound Route"
,
"notes"
=>
"Add Inbound Route"
,
"consumes"
=>
[
"application/json"
],
"parameters"
=>
[
{
"name"
=>
"body"
,
"description"
=>
"No description"
,
"required"
=>
1
,
"type"
=>
"inbound_route"
,
"parameter"
=>
"request"
,
"sample"
=>
q({"did" : "14152223333", "routetype" : "Time Based", "description" : "Route description" })
}
],
"responses"
=>
[
{
"code"
=>
200
,
"type"
=>
"inbound_route"
}
]
},
{
"path"
=>
"/api/inbound_routes/{routeId}"
,
"method"
=>
"DELETE"
,
"summary"
=>
"Delete Inbound Route"
,
"notes"
=>
"Delete Inbound Route"
,
"consumes"
=>
[
"application/json"
],
"parameters"
=>
[
{
"name"
=>
"routeId"
,
"description"
=>
"Route ID"
,
"required"
=>
1
,
"type"
=>
"string"
,
"parameter"
=>
"path"
,
"sample"
=>
"14152223333"
}
],
"responses"
=>
[
{
"code"
=>
200
,
"type"
=>
"inbound_route"
}
]
}
]
);
sub
new
{
my
(
$class
,
$args
)
=
@_
;
my
$self
=
bless
(
{
},
$class
);
$self
->
{
version
}
=
$VERSION
;
$self
->
{
mapper
}
=
new
Asterisk::API::Mapper::
Generic
;
my
$out_mapping
=
$self
->
{
mapper
}
->
prepare
(
\%
out_hash_map
);
$self
->
{
defaults
}
->
{
out
}
=
$out_mapping
->
{
defaults
};
$self
->
{
map
}
->
{
out
}
=
$out_mapping
->
{
map
};
$self
->
{
type
}
->
{
out
}
=
$out_mapping
->
{
type
};
$self
->
{
reverse
}
->
{
out
}
=
$out_mapping
->
{
reverse
};
my
$in_mapping
=
$self
->
{
mapper
}
->
prepare
(
\%
in_hash_map
);
$self
->
{
defaults
}
->
{
in
}
=
$in_mapping
->
{
defaults
};
$self
->
{
map
}
->
{
in
}
=
$in_mapping
->
{
map
};
$self
->
{
type
}
->
{
in
}
=
$in_mapping
->
{
type
};
$self
->
{
reverse
}
->
{
in
}
=
$in_mapping
->
{
reverse
};
return
$self
;
}
sub
info
{
my
(
$self
)
=
@_
;
my
$doc
=
new
Asterisk::API::Documentation::
Generic
;
return
$doc
->
prepare_types
(
\%
requests
);
}
sub
map_out
{
my
(
$self
,
$hash
,
$params
)
=
@_
;
if
(
exists
$params
->
{
direct
}
&&
$params
->
{
direct
}
)
{
return
$hash
;
}
my
$out_hash
=
{
};
if
(
exists
$params
->
{
defaults
}
&&
$params
->
{
defaults
}
)
{
foreach
my
$key
(
keys
%
{
$self
->
{
defaults
}
->
{
out
}
}
)
{
# fill default values
$out_hash
->
{
$self
->
{
map
}
->
{
out
}
->
{
$key
}}
=
$self
->
{
defaults
}
->
{
out
}
->
{
$key
};
}
}
foreach
my
$key
(
keys
%
{
$hash
}
)
{
$out_hash
->
{
$self
->
{
map
}
->
{
out
}
->
{
$key
}}
=
$hash
->
{
$key
}
if
exists
$self
->
{
map
}
->
{
out
}
->
{
$key
}
&&
exists
$hash
->
{
$key
};
}
$out_hash
=
$self
->
{
mapper
}
->
fix_type
(
$out_hash
,
$self
->
{
type
}
->
{
out
},
$self
->
{
reverse
}
->
{
out
});
$out_hash
->
{
options
}
=
[
];
my
$options
=
{
};
foreach
my
$key
(
keys
%
{
$hash
}
)
{
if
(
$key
=~
m/^(.*?)_(\d+)_(\d+)$/
)
{
$options
->
{
$2
}
->
{
args
}
->
{
$3
}
=
$hash
->
{
$key
};
}
elsif
(
$key
=~
m/^(.*?)_(\d+)$/
)
{
if
(
$1
eq
"args"
)
{
my
$i
=
0
;
foreach
my
$arg
(
split
/,/
,
$hash
->
{
$key
}
)
{
$options
->
{
$2
}
->
{
args
}
->
{
$i
++
}
=
$arg
;
}
}
elsif
(
not
grep
{
$1
eq
$_
}
qw(var schedule_name)
)
{
$options
->
{
$2
}
->
{
$1
}
=
$hash
->
{
$key
};
}
}
}
foreach
my
$key
(
keys
%
{
$options
}
)
{
$options
->
{
$key
}
->
{
args
}
=
[
map
{
$options
->
{
$key
}
->
{
args
}
->
{
$_
}
}
sort
{
int
(
$a
)
<=>
int
(
$b
)
}
keys
%
{
$options
->
{
$key
}
->
{
args
}
//
=
{}
}
];
}
$out_hash
->
{
options
}
=
[
map
{
$options
->
{
$_
}
}
sort
{
int
(
$a
)
<=>
int
(
$b
)
}
keys
%
{
$options
}
];
return
$out_hash
;
}
sub
map_in
{
my
(
$self
,
$hash
,
$params
)
=
@_
;
if
(
exists
$params
->
{
direct
}
&&
$params
->
{
direct
}
)
{
return
$hash
;
}
my
$out_hash
=
{
};
if
(
exists
$params
->
{
defaults
}
&&
$params
->
{
defaults
}
)
{
foreach
my
$key
(
keys
%
{
$self
->
{
defaults
}
->
{
in
}
}
)
{
# fill default values
$out_hash
->
{
$self
->
{
map
}
->
{
in
}
->
{
$key
}}
=
$self
->
{
defaults
}
->
{
in
}
->
{
$key
};
}
}
foreach
my
$key
(
keys
%
{
$hash
}
)
{
$out_hash
->
{
$self
->
{
map
}
->
{
in
}
->
{
$key
}}
=
$hash
->
{
$key
}
if
exists
$self
->
{
map
}
->
{
in
}
->
{
$key
}
&&
exists
$hash
->
{
$key
};
}
if
(
exists
$hash
->
{
options
}
)
{
for
(
my
$i
=
0
;
$i
<
scalar
@
{
$hash
->
{
options
}
};
$i
++
)
{
$out_hash
->
{
"schedule_$i"
}
=
$hash
->
{
options
}
->
[
$i
]
->
{
schedule
};
$out_hash
->
{
"action_$i"
}
=
$hash
->
{
options
}
->
[
$i
]
->
{
action
};
if
(
exists
$hash
->
{
options
}
->
[
$i
]
->
{
args
}
)
{
$out_hash
->
{
"args_$i"
}
=
join
","
,
@
{
$hash
->
{
options
}
->
[
$i
]
->
{
args
}
};
for
(
my
$t
=
0
;
$t
<
scalar
@
{
$hash
->
{
options
}
->
[
$i
]
->
{
args
}
};
$t
++
)
{
$out_hash
->
{
$hash
->
{
options
}
->
[
$i
]
->
{
action
}
.
"_"
.
$i
.
"_"
.
$t
}
=
$hash
->
{
options
}
->
[
$i
]
->
{
args
}
->
[
$t
];
}
}
}
}
return
$out_hash
;
}
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment