Open Source Telephony
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: ofono@ofono.org
Subject: Re: [PATCH_v3 3/3] test: Add hangup-call script for GCF testing
Date: Thu, 02 Aug 2012 12:21:16 -0700	[thread overview]
Message-ID: <1343935276.2083.6.camel@aeonflux> (raw)
In-Reply-To: <1343900463-24917-4-git-send-email-guillaume.zajac@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2059 bytes --]

Hi Guillaume,

>  Makefile.am      |    3 ++-
>  test/hangup-call |   39 +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 41 insertions(+), 1 deletions(-)
>  create mode 100755 test/hangup-call
> 
> diff --git a/Makefile.am b/Makefile.am
> index a689483..534245e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -624,7 +624,8 @@ test_scripts = test/backtrace \
>  		test/swap-calls \
>  		test/release-and-answer \
>  		test/hold-and-answer \
> -		test/hangup-call-state
> +		test/hangup-call-state \
> +		test/hangup-call
>  
>  if TEST
>  testdir = $(pkglibdir)/test
> diff --git a/test/hangup-call b/test/hangup-call
> new file mode 100755
> index 0000000..926efc4
> --- /dev/null
> +++ b/test/hangup-call
> @@ -0,0 +1,39 @@
> +#!/usr/bin/python
> +
> +import sys
> +import dbus
> +
> +bus = dbus.SystemBus()
> +
> +manager = dbus.Interface(bus.get_object('org.ofono', '/'),
> +						'org.ofono.Manager')
> +
> +modems = manager.GetModems()
> +path = modems[0][0]
> +
> +manager = dbus.Interface(bus.get_object('org.ofono', path),
> +						'org.ofono.VoiceCallManager')
> +
> +calls = manager.GetCalls()
> +if (len(calls) == 0):
> +	print "No calls available"
> +	sys.exit(1)
> +
> +if (len(sys.argv) < 2):
> +	i = 0
> +	for path, properties in calls:
> +		multi = properties["Multiparty"]
> +		print "Call ID [ %d ] Multiparty %d" % (i, multi)
> +		print
> +		i += 1
> +
> +	print "Usage: %s [ Call ID ]" % (sys.argv[0])
> +	print
> +	sys.exit(1)
> +
> +path = calls[int(sys.argv[1])][0]
> +
> +call = dbus.Interface(bus.get_object('org.ofono', path),
> +						'org.ofono.VoiceCall')
> +
> +call.Hangup()

why are we not just asking to provide the object path as argument and
then list-calls can be used to determine which call to hang up. That way
also the hangup-call-state hack is not needed.

Using the object path also makes this less racy since we identify the
call by object path and not a random number that might no longer be
valid.

Regards

Marcel



  reply	other threads:[~2012-08-02 19:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <$>
2012-08-02  9:41 ` [PATCH_v3 0/3] Add new scripts for GCF testing Guillaume Zajac
2012-08-02  9:41   ` [PATCH_v3 1/3] test: Add hold-and-answer script " Guillaume Zajac
2012-08-02 19:24     ` Marcel Holtmann
2012-08-02  9:41   ` [PATCH_v3 2/3] test: Add hangup-call-state " Guillaume Zajac
2012-08-02  9:41   ` [PATCH_v3 3/3] test: Add hangup-call " Guillaume Zajac
2012-08-02 19:21     ` Marcel Holtmann [this message]
2012-08-03  8:47       ` Guillaume Zajac
2012-08-03 16:53         ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343935276.2083.6.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox