Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alvagi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kulya
alvagi
Commits
a23fb51a
Commit
a23fb51a
authored
Jan 01, 2015
by
sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add recordFile and Answer
parent
2934afa1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
context.js
lib/context.js
+16
-1
package.json
package.json
+1
-1
index.js
test/index.js
+13
-0
No files found.
lib/context.js
View file @
a23fb51a
...
...
@@ -101,10 +101,25 @@ Context.prototype.dial = function (num, timeout, params, cb) {
this
.
exec
(
'
Dial
'
,
num
+
'
,
'
+
timeout
+
'
,
'
+
params
,
cb
);
};
Context
.
prototype
.
getVariable
=
function
(
name
,
cb
)
{
Context
.
prototype
.
getVariable
=
function
(
name
,
cb
)
{
this
.
send
(
'
GET VARIABLE
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
answer
=
function
(
cb
)
{
this
.
send
(
'
ANSWER
'
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
recordFile
=
function
(
filename
,
format
,
escape_digits
,
timeout
,
cb
)
{
var
str
=
[
'
"
'
+
filename
+
'
"
'
,
format
,
escape_digits
,
parseInt
(
timeout
)
*
1000
,
'
0 1 2
'
].
join
(
'
'
);
this
.
send
(
'
RECORD FILE
'
+
str
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
sayNumber
=
function
(
number
,
escape_digits
,
cb
)
{
this
.
send
(
'
SAY NUMBER
'
+
number
+
'
"
'
+
escape_digits
+
'
"
'
+
'
\n
'
,
cb
||
function
()
{
});
};
...
...
package.json
View file @
a23fb51a
...
...
@@ -2,7 +2,7 @@
"author"
:
"Sergey Dmitriev <serge.dmitriev@gmail.com>"
,
"name"
:
"ding-dong"
,
"description"
:
"AGI (Asterisk Gateway Interface) for writing dialplan scripts"
,
"version"
:
"0.0.
2
"
,
"version"
:
"0.0.
3
"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"git://github.com/antirek/ding-dong.git"
...
...
test/index.js
View file @
a23fb51a
...
...
@@ -177,6 +177,19 @@ describe('Context', function() {
});
});
describe
(
'
record file
'
,
function
()
{
it
(
'
record
'
,
function
()
{
this
.
context
.
recordFile
(
'
test
'
,
'
wav
'
,
'
#
'
,
function
()
{});
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
STREAM FILE "test" # "
\n
'
);
});
it
(
'
defaults to all digits
'
,
function
()
{
this
.
context
.
streamFile
(
'
test
'
,
function
()
{});
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
STREAM FILE "test" "1234567890#*"
\n
'
);
});
});
describe
(
'
waitForDigit
'
,
function
()
{
it
(
'
sends with default timeout
'
,
function
()
{
this
.
context
.
waitForDigit
(
function
()
{});
...
...
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