How can I end a call?

Hi all!

I tried to use the following code to complete a call:

import bb.cascades 1.0
import bb.system 1.0

Page {
    Container {
        layout: DockLayout {
        }
        verticalAlignment: VerticalAlignment.Center
        horizontalAlignment: HorizontalAlignment.Center

        Button {
            id: callButton
            text: "End Call"

            onClicked: {
                phone.endCall("5555555555")
            }

        }

    }
    attachedObjects: [
        Phone {
            id: phone
        }
    ]
}

But it does not work.

What is missing?

I don't know if I need it to put the number of the incoming call.

Thanks for your help!

Kind regards!

Here is a complete application to work for you to play with :-)

hand. QML:

import bb.cascades 1.2

Page {
    Container {
        Label {
            // Localized text with the dynamic translation and locale updates support
            text: qsTr("Phone Test") + Retranslate.onLocaleOrLanguageChanged
            textStyle.base: SystemDefaults.TextStyles.BigText
        }
        Container {
            layout: StackLayout {
                orientation: LayoutOrientation.LeftToRight
            }
            TextField {
                id: txf_phone_number
                inputMode: TextFieldInputMode.PhoneNumber
                input.flags: TextInputFlag.AutoCapitalizationOff | TextInputFlag.AutoCorrectionOff | TextInputFlag.AutoPeriodOff | TextInputFlag.PredictionOff | TextInputFlag.SpellCheckOff
            }
            Button {
                text: "Make Call"
                onClicked: {
                    app.makeCall(txf_phone_number.text);
                }
            }
        }
        Button {
            text: "End Call"
            onClicked: {
                app.endCall();
            }
        }
    }
}

applicationui. HPP:

#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_

#include 
#include 
#include 

namespace bb
{
    namespace cascades
    {
        class Application;
        class LocaleHandler;
    }
}

class QTranslator;

/*!
 * @brief Application object
 *
 *
 */

class ApplicationUI : public QObject
{
    Q_OBJECT
public:
    ApplicationUI(bb::cascades::Application *app);
    virtual ~ApplicationUI() { }

    Q_INVOKABLE void makeCall(QString msisdn);
    Q_INVOKABLE void endCall();

    bb::system::phone::Phone* _phone;
    int _call_id;

private slots:
    void onSystemLanguageChanged();
    void onCallUpdated (const bb::system::phone::Call& call );

private:
    QTranslator* m_pTranslator;
    bb::cascades::LocaleHandler* m_pLocaleHandler;
};

#endif /* ApplicationUI_HPP_ */

applicationui.cpp:

#include "applicationui.hpp"

#include 
#include 
#include 
#include 

using namespace bb::cascades;
using namespace bb::system::phone;

ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        QObject(app)
, _phone(new bb::system::phone::Phone())
{
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);
    if(!QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this, SLOT(onSystemLanguageChanged()))) {
        // This is an abnormal situation! Something went wrong!
        // Add own code to recover here
        qWarning() << "Recovering from a failed connect()";
    }
    // initial load
    onSystemLanguageChanged();

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    qml->setContextProperty("app", this);
    QObject::connect(_phone, SIGNAL(callUpdated(const bb::system::phone::Call&)),
            this, SLOT(onCallUpdated(const bb::system::phone::Call&)));
    // Create root object for the UI
    AbstractPane *root = qml->createRootObject();

    // Set created root object as the application scene
    app->setScene(root);
}

void ApplicationUI::onSystemLanguageChanged()
{
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("PhoneTest_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
    }
}

void ApplicationUI::makeCall(QString msisdn) {
    qDebug() << "XXXX makeCall: " << msisdn;

    // reset call_id
    _call_id = -1;
    _phone->initiateCellularCall(msisdn);

}

void ApplicationUI::endCall() {
    qDebug() << "XXXX endCall";
    if (_call_id != -1) {
        _phone->endCall(_call_id);
    }
}

void ApplicationUI::onCallUpdated(const bb::system::phone::Call& call ) {
    qDebug() << "XXXX onCallUpdated";
    _call_id = call.callId();
    qDebug() << "XXXX onCallUpdated - call_id=" << _call_id;
}

Permissions in bar - descriptor.xml:

    control_phone
    access_phone

PhoneTest.pro:

APP_NAME = PhoneTest

CONFIG += qt warn_on cascades10

LIBS += -lbbsystem

include(config.pri)

Tags: BlackBerry Developers

Similar Questions

  • How can I transfer a call facetime for my macbook

    If I answer an incoming call on my Macbook Pro with FaceTme iPhone I can retrieve the call on my iPhone by selecting the speaker on my phone icon.

    My question is once I have done this how can I send the call to my Macbook Pro?

    OS X El Capitan: use your Mac to make and receive phone calls

  • How can I disable the caller i.d.?

    I downloaded iOS 10 and I can not find how to disable caller ID

    Discussion of the beta to the public forum software is prohibited. You would need to report to the website issues statement provided during registration to the beta beta. However, not all carriers allow you to disable Caller ID, and if yours is one of them, then you won't find something to turn off the power of the ILA.

  • Can't end a call.

    Why my screen goes black and I can't stop a phone?

    There is an app on the market called «Screebl lite»  It is supposed to solve this problem.  I've heard a few people here on the forum rave about it.  Give it a try.  It's free so it won't cost you a bit of time.  How your proximity sensor, this is how mine works.  I don't think it's your problem.  I hope this helps.

  • How can I get wifi calling on my 5 c?

    Hello. Can someone help me find the wifi calling on my 5 c please? This is supposed to be at my disposal, but there is no option under "settings - phone". I am on iOS 9.3.2. Thank you.

    Calls WiFi is a feature of carrier, so contact your carrier and ask them.  If it does not appear on your phone, it's because your carrier doesn't support or you've had it set up on your account.

  • In the user interface, how can I property "Sequence Call Trace Setting" the stage of 'SequenceCall '?

    Hi all!

    I am writing a user interface. I want know step "SequenceCall" is tracingEnable or not. It is said that "use the Step.Module property to get a reference to a SequenceCallModule object. I can't well it. I can get a reference using "TS adapter API. But how he dose associated with the stage of 'SequenceCall '.

    Thank you!

    Hello

    You can do by using the node of given Variant to in LabVIEW.

    Please see the newsletter - get a different for TestStand objects Interface topic in the manual using Labview and LabWindows/CVI with TestStand for more information and an example.

    You can get a copy of this manual from this link - http://digital.ni.com/manuals.nsf/websearch/B8398AF8729D906F862577B4004FF10C if necessary.

    Concerning

    Anand jegou

    National Instruments

  • How can I make a call remote LVRT vi

    I would call a vi on my host of windows since a cRIO vi.  I understand my options here:

    Can I make a remote call with the string name of path, or vi if it is in memory?  What is the format of the name?

    Does include both the name of the project?  So far, I have tried every permutation I can think but cannot get

    a good reference of vi.  Also, is it possible to open a remote reference to a reentrant vi that is currently in memory?

    The name VI string is just the name of the VI. You must apply for it to the correct server VI instance.

    This is the VI that works on my CRIO:

    Notice I had to specify the port instead of the default 3363 3364. Port 3364, that's what I configured VI server on my 'my computer' to listen.

    Nathan

  • How can I capture CCDR call id in a CRS Script?

    I'm typing ID CCDR appeal so that it can be passed along on the CAD Office. In this way the agent can then enter it as part of the call within the app notes of third party clients. This will help the client identify which record CCDR was for what call.

    You may be able to use a step to read the Contact information to retrieve the ID of 'application' that matches the Global Call identifier in CallManager that must be recorded in the CCDRs.

    Please evaluate the useful messages.

  • How can I send a call to voicemail?

    Hello

    I need help on how to send a call to voicemail.

    I've got a list number, and when I recive the call that is in my list then this call should be sent to voicemail.

    PhoneList String = {'8989898989', '7878787878', '5656565656'}

    In the earpiece of the phone...

    public void callIncoming (int callId)

    {

    get this call number

    and if the number of cll incoming is phoneList then send the call to voicemail

    }

    Thank you

    Amol

    It is up to the provider to decide what happens with a rejected call

  • How can I manage incoming calls when my application is running?

    HII all,.

    Is there an API to manage incoming calls or sms while my application is running? I want to put my app in the background & allow user to reach call when an incoming call is reported.

    Kind regards

    Nishant Shah

    BB10 there as the still no API for this, although "flight arrival advice" can give you an idea what is on the horizon.

    I do not think that the logical use case but... the operating system will be incoming calls and notify the user in a way, and it is not your application to get out of the way like that.  Perhaps the user wants to ignore the call. In all cases, it will be a trivial gesture (corner kick?) by the user to answer the call.

    I don't think you should try to deal with quite different that any other application will be, that is to say completely ignore and do nothing.

  • How can I end a session of hotspoted comments in point 1.4 of the ISE?

    Hello

    I installed 1.4 ISE the long WLC 8.0.120 and I wanted to connect our users comments on the internet through comments hotspot portal.

    insofar as everything is ok and comments users can access the page of hollow internet hotspot, I want to know how I can cancel a user loggined ISE session?

    Thanks in advance,

    Did you watch the Sessions Live yet?  If not, go to the operations-> authentication, and then click the Live Sessions button to the top left corner.  Once that page is loaded, find your session and click the menu drop-down stock cost and select stop Session.

    Tim

  • How can I block a caller to 1 iPhone but not another

    I'm trying to block a caller to my son iPhone, but it also block my phone

    Do you use the same AppleID to two iPhones?

  • How can I remove malware called white smoke?

    When I try to access the internet a program called "white smoke" takes up the research I have google as my homepage, but as soon as I type an address in the search to the top box comes this white smoke search engine

    http://www.google.com/search?q=remove+malware+called+white++smoke&sourceid=ie7&rls=com.microsoft: en - us: ContextMenu IE & oe and ie ==.

    UTC/GMT is 12:55 on Tuesday, August 14, 2012
  • How can I make a call?

    Hi all!
    I'm new in the cascades and I have problems with the phone calling code, I tried to use the code in the documentation but Momentics I see a light bulb on 'import bb.system.phone 1.0' and in the simulator when I push the button to see the touchpad, it do nothing.

    Is it normal that?

    If I try to use the application to a physical device, it works perfectly?

    Thanks for your help.

    Kind regards.

    This way works in QML file

    import bb.system 1.0
    
    attachedObjects: [
      Phone {
             id:phone
           }
    ]
    Button{
      onClicked{phone.requestDialpad("12345","Mobile")}
    {
    
  • How can I answer incoming calls by voice command?

    Someone at - it understand this?

    Thank you

    Dan


Maybe you are looking for

  • IOS 10 notes keeps quitting

    Just updated to iOS 10 on my iPhone 6.  Unable to get the notes application wanting to work more.  He launched then closes unexpectedly within 5 seconds.  Tried a reboot and still get the same issue.  Is what someone else is or whether it is a fix or

  • Number of unread messages not displayed against the message icon

    Product name: Iphone 5 Storage capacity: 16 GB iOS 9.3.1 Problem: Number of unread messages not displayed against the message icon. Can someone help me please. Already done troubleshooting: "The application of the badge icon" is running in the center

  • Question of calibration pedometer

    The pedometer is affected by wearing on different positions on the body? For example, if I calibrate on my wrist, and then start to wear on my arm or Cup in my size, the displays will change? Or, more important still, they will change significantly?

  • computer using the TV display

    I'm trying to show my desktop on my sony TV.  Help

  • New drive HARD and the new operating system

    My old Windows XP, HARD disk crashed and I insert a new HARD drive in my old laptop. I want to install Windows 7 on new HARD drive. How to prepare the old laptop XP to accept the new Windows 7?