Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
piphone-sip
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
La Quadrature du Net
piphone
piphone-sip
Commits
fff062ff
Commit
fff062ff
authored
Feb 06, 2017
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let's remove a channel from the moh-bridge when switching to something else
parent
13e61270
Pipeline
#839
passed with stage
in 2 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
ari.py
ari.py
+9
-2
piphone.py
piphone.py
+6
-1
No files found.
ari.py
View file @
fff062ff
...
...
@@ -19,8 +19,6 @@ def ari_call(config, verbs, method, payload):
payload
[
'app'
]
=
config
[
'app'
]
payload
[
'api_key'
]
=
config
[
'key'
]
+
':'
+
config
[
'password'
]
result
=
call
(
full_url
,
data
=
payload
)
print
(
full_url
)
print
(
payload
)
result
.
raise_for_status
()
if
method
.
lower
()
==
'post'
:
# We need to test if we have something in the object, to eventually return it
...
...
@@ -80,6 +78,15 @@ class Bridge(object):
except
:
raise
def
removeChannel
(
self
,
channel
):
'''
We want to remove a channel from the bridge
'''
try
:
return
ari_call
(
self
.
config
,
[
'bridges'
,
self
.
name
,
'removeChannel'
],
'POST'
,
{
'channel'
:
channel
})
except
:
raise
def
delete
(
self
):
'''
Let's delete the bridge
...
...
piphone.py
View file @
fff062ff
...
...
@@ -345,7 +345,11 @@ class Call(object):
bridge
.
create
()
except
Exception
as
e
:
raise
e
# Step 2, moving channels
# Step 2, removing callee channel from hold
moh_bridge
=
ari
.
Bridge
(
config
[
'asterisk'
],
config
[
'moh'
][
'name'
])
channel
=
self
.
id
+
'-'
+
sanitize_phonenumber
(
self
.
callee
)
phone_logger
.
debug
(
"Remove callee channel from moh"
)
moh_bridge
.
removeChannel
(
channel
)
channels
=
","
.
join
([
self
.
id
+
'-'
+
sanitize_phonenumber
(
self
.
caller
),
self
.
id
...
...
@@ -360,6 +364,7 @@ class Call(object):
# Moving the channel to the MOH Bridge
phone_logger
.
debug
(
'Moving call {} to the garage'
.
format
(
event
[
'channel'
][
'id'
]))
moh_bridge
=
ari
.
Bridge
(
config
[
'asterisk'
],
config
[
'moh'
][
'name'
])
result
=
moh_bridge
.
status
()
moh_bridge
.
addChannel
(
event
[
'channel'
][
'id'
])
moh_bridge
.
startMoh
(
config
[
'moh'
][
'class'
])
except
Exception
as
e
:
...
...
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