Discussion:
How to end outgoing voice call in python
Sylvain
2017-03-29 16:29:56 UTC
Permalink
Hi,

I'm trying to make a program in python using gammu 1.37.4 installed on
ubuntu 16.04. The device I use is a Huawei E180 modem.

I'm able to start a voice call with dialVoice, but I can't figure out
how to stop or hang-up the call. I tried with Abort and Terminate but it
doesn't work, my program continues but the voice call is still active.
Almost all call related functions are for incoming calls.

Is it doable in python? Any pointers?

Thanks.
Michal Čihař
2017-03-30 08:35:23 UTC
Permalink
Hi
Post by Sylvain
I'm trying to make a program in python using gammu 1.37.4 installed
on 
ubuntu 16.04. The device I use is a Huawei E180 modem.
I'm able to start a voice call with dialVoice, but I can't figure
out 
how to stop or hang-up the call. I tried with Abort and Terminate but
it 
doesn't work, my program continues but the voice call is still
active. 
Almost all call related functions are for incoming calls.
Is it doable in python? Any pointers?
CancelCall should do that:

https://wammu.eu/docs/manual/python/gammu.html#gammu.StateMachine.Cance
lCall
--
Michal Čihař | https://cihar.com/ | https://weblate.org/
Sylvain
2017-03-30 09:24:05 UTC
Permalink
Post by Michal Čihař
Hi
Post by Sylvain
I'm trying to make a program in python using gammu 1.37.4 installed on
ubuntu 16.04. The device I use is a Huawei E180 modem.
I'm able to start a voice call with dialVoice, but I can't figure out
how to stop or hang-up the call. I tried with Abort and Terminate but it
doesn't work, my program continues but the voice call is still active.
Almost all call related functions are for incoming calls.
Is it doable in python? Any pointers?
https://wammu.eu/docs/manual/python/gammu.html#gammu.StateMachine.Cance
lCall
I tried but it requires the ID of the call as parameter but DialVoice
only returns None. I see a lot of functions that use the ID of the call
as parameter but none that returns it. How can I get the call ID?
Michal Čihař
2017-03-30 09:36:53 UTC
Permalink
Post by Sylvain
Post by Michal Čihař
Hi
Post by Sylvain
I'm trying to make a program in python using gammu 1.37.4
installed
on
ubuntu 16.04. The device I use is a Huawei E180 modem.
I'm able to start a voice call with dialVoice, but I can't figure out
how to stop or hang-up the call. I tried with Abort and Terminate but
it
doesn't work, my program continues but the voice call is still active.
Almost all call related functions are for incoming calls.
Is it doable in python? Any pointers?
https://wammu.eu/docs/manual/python/gammu.html#gammu.StateMachine.C
ance
lCall
I tried but it requires the ID of the call as parameter but
DialVoice 
only returns None. I see a lot of functions that use the ID of the
call 
as parameter but none that returns it. How can I get the call ID?
Use anything as call ID and pass True as second parameter. That should
do it.
--
Michal Čihař | https://cihar.com/ | https://weblate.org/
Michal Čihař
2017-03-30 09:42:50 UTC
Permalink
Hi
Post by Michal Čihař
Use anything as call ID and pass True as second parameter. That should
do it.
... And I've changed the code to make these parameters optional:

https://github.com/gammu/python-gammu/commit/77ca7d417e939a037504d10e7b
37899575ff2f77
--
Michal Čihař | https://cihar.com/ | https://weblate.org/
Sylvain
2017-03-30 11:06:03 UTC
Permalink
Post by Michal Čihař
Post by Sylvain
Post by Michal Čihař
Hi
Post by Sylvain
I'm trying to make a program in python using gammu 1.37.4
installed
on
ubuntu 16.04. The device I use is a Huawei E180 modem.
I'm able to start a voice call with dialVoice, but I can't figure out
how to stop or hang-up the call. I tried with Abort and Terminate but
it
doesn't work, my program continues but the voice call is still active.
Almost all call related functions are for incoming calls.
Is it doable in python? Any pointers?
https://wammu.eu/docs/manual/python/gammu.html#gammu.StateMachine.C
ance
lCall
I tried but it requires the ID of the call as parameter but
DialVoice
only returns None. I see a lot of functions that use the ID of the call
as parameter but none that returns it. How can I get the call ID?
Use anything as call ID and pass True as second parameter. That should
do it.
It takes at least 30 seconds before the call stops and gives the
following error after a few dozens of seconds later:
gammu.ERR_DEVICEWRITEERROR: {'Text': u"Erreur lors de l'\xe9criture sur
le p\xe9riph\xe9rique.", 'Code': 11, 'Where': 'CancelCall'}

Any attempts to launch it again fails at init() with ERR_DEVICENOTEXIST:
{'Text': u"Erreur \xe0 l'ouverture du p\xe9riph\xe9rique: il n'existe
pas.", 'Code': 4, 'Where': 'Init'}. I have to physically disconnect and
reconnect the USB dongle.

My code so far is:

import time
import gammu
sm = gammu.StateMachine()
sm.ReadConfig()
sm.Init()
sm.DialVoice('+xxxxxxxxxxx')
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
sm.CancelCall(0, True)
sm.Terminate()

Loading...