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
8ec64e4c
Commit
8ec64e4c
authored
Feb 18, 2015
by
sergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add all functions
parent
d37f0f76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
2 deletions
+134
-2
context.js
lib/context.js
+48
-0
package.json
package.json
+2
-2
index.js
test/index.js
+84
-0
No files found.
lib/context.js
View file @
8ec64e4c
...
@@ -103,6 +103,54 @@ Context.prototype.dial = function (num, timeout, params, cb) {
...
@@ -103,6 +103,54 @@ Context.prototype.dial = function (num, timeout, params, cb) {
this
.
exec
(
'
Dial
'
,
num
+
'
,
'
+
timeout
+
'
,
'
+
params
,
cb
);
this
.
exec
(
'
Dial
'
,
num
+
'
,
'
+
timeout
+
'
,
'
+
params
,
cb
);
};
};
Context
.
prototype
.
databaseDel
=
function
(
family
,
key
,
cb
)
{
this
.
send
(
'
DATABASE DEL
'
+
family
+
'
'
+
key
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
databaseDelTree
=
function
(
family
,
keytree
,
cb
)
{
this
.
send
(
'
DATABASE DELTREE
'
+
family
+
'
'
+
keytree
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
databaseGet
=
function
(
family
,
key
,
cb
)
{
this
.
send
(
'
DATABASE GET
'
+
family
+
'
'
+
key
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
databasePut
=
function
(
family
,
key
,
value
,
cb
)
{
this
.
send
(
'
DATABASE PUT
'
+
family
+
'
'
+
key
+
'
'
+
value
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechCreate
=
function
(
engine
,
cb
)
{
this
.
send
(
'
SPEECH CREATE
'
+
engine
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechDestroy
=
function
(
cb
)
{
this
.
send
(
'
SPEECH DESTROY
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechActivateGrammar
=
function
(
name
,
cb
)
{
this
.
send
(
'
SPEECH ACTIVATE GRAMMAR
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechDeactivateGrammar
=
function
(
name
,
cb
)
{
this
.
send
(
'
SPEECH DEACTIVATE GRAMMAR
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechLoadGrammar
=
function
(
name
,
path
,
cb
)
{
this
.
send
(
'
SPEECH LOAD GRAMMAR
'
+
name
+
'
'
+
path
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechUnloadGrammar
=
function
(
name
,
cb
)
{
this
.
send
(
'
SPEECH UNLOAD GRAMMAR
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechSet
=
function
(
name
,
value
,
cb
)
{
this
.
send
(
'
SPEECH SET
'
+
name
+
'
'
+
value
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
speechRecognize
=
function
(
prompt
,
timeout
,
offset
,
cb
)
{
this
.
send
(
'
SPEECH RECOGNIZE
'
+
prompt
+
'
'
+
timeout
+
'
'
+
offset
+
'
\n
'
,
cb
||
function
()
{
});
};
Context
.
prototype
.
getVariable
=
function
(
name
,
cb
)
{
Context
.
prototype
.
getVariable
=
function
(
name
,
cb
)
{
this
.
send
(
'
GET VARIABLE
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
this
.
send
(
'
GET VARIABLE
'
+
name
+
'
\n
'
,
cb
||
function
()
{
});
};
};
...
...
package.json
View file @
8ec64e4c
{
{
"author"
:
"Sergey Dmitriev <serge.dmitriev@gmail.com>"
,
"author"
:
"Sergey Dmitriev <serge.dmitriev@gmail.com>"
,
"name"
:
"ding-dong"
,
"name"
:
"ding-dong"
,
"description"
:
"
AGI (Asterisk Gateway Interface) for writing dialplan scripts
"
,
"description"
:
"
Write AGI-server quickly! (AGI - Asterisk Gateway Interface)
"
,
"version"
:
"0.0.
7
"
,
"version"
:
"0.0.
8
"
,
"repository"
:
{
"repository"
:
{
"type"
:
"git"
,
"type"
:
"git"
,
"url"
:
"git://github.com/antirek/ding-dong.git"
"url"
:
"git://github.com/antirek/ding-dong.git"
...
...
test/index.js
View file @
8ec64e4c
...
@@ -146,6 +146,90 @@ describe('Context', function() {
...
@@ -146,6 +146,90 @@ describe('Context', function() {
});
});
});
});
describe
(
'
databaseDel
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
databaseDel
(
'
family
'
,
'
test
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
DATABASE DEL family test
\n
'
);
});
});
describe
(
'
databaseDelTree
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
databaseDelTree
(
'
family
'
,
'
test
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
DATABASE DELTREE family test
\n
'
);
});
});
describe
(
'
databaseGet
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
databaseGet
(
'
family
'
,
'
test
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
DATABASE GET family test
\n
'
);
});
});
describe
(
'
databasePut
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
databasePut
(
'
family
'
,
'
test
'
,
'
value
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
DATABASE PUT family test value
\n
'
);
});
});
describe
(
'
speechCreate
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechCreate
(
'
engine
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH CREATE engine
\n
'
);
});
});
describe
(
'
speechDestroy
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechDestroy
();
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH DESTROY
\n
'
);
});
});
describe
(
'
speechActivateGrammar
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechActivateGrammar
(
'
name
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH ACTIVATE GRAMMAR name
\n
'
);
});
});
describe
(
'
speechDeactivateGrammar
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechDeactivateGrammar
(
'
name
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH DEACTIVATE GRAMMAR name
\n
'
);
});
});
describe
(
'
speechLoadGrammar
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechLoadGrammar
(
'
name
'
,
'
path
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH LOAD GRAMMAR name path
\n
'
);
});
});
describe
(
'
speechUnloadGrammar
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechUnloadGrammar
(
'
name
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH UNLOAD GRAMMAR name
\n
'
);
});
});
describe
(
'
speechSet
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechSet
(
'
name
'
,
'
value
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH SET name value
\n
'
);
});
});
describe
(
'
speechRecognize
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
speechRecognize
(
'
prompt
'
,
'
timeout
'
,
'
offset
'
);
expect
(
this
.
context
.
sent
.
join
(
''
)).
to
.
eql
(
'
SPEECH RECOGNIZE prompt timeout offset
\n
'
);
});
});
describe
(
'
setVariable
'
,
function
()
{
describe
(
'
setVariable
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
it
(
'
sends correct command
'
,
function
()
{
this
.
context
.
setVariable
(
'
test
'
,
'
test
'
);
this
.
context
.
setVariable
(
'
test
'
,
'
test
'
);
...
...
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