Esempio n. 1
0
void cmd_cancel(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
    uint8_t *error_str;

    if (argc != 0) {
        error_str = "Invalid syntax!";
        goto on_error;
    }

    if ( !ASettins.av ) {
        error_str = "Audio not supported!";
        goto on_error;
    }

    ToxAvError error = toxav_cancel(ASettins.av, self->call_idx, self->num,
                                    "Only those who appreciate small things know the beauty that is life");

    if ( error != ErrorNone ) {
        if ( error == ErrorNoCall ) error_str = "No call!";
        else if ( error == ErrorInvalidState ) error_str = "Cannot cancel in invalid state!";
        else error_str = "Internal error!";

        goto on_error;
    }

    /* Callback will print status... */

    return;
on_error:
    print_err (self, error_str);
}
Esempio n. 2
0
void Cyanide::av_call_cancel(int fid)
{
    qDebug() << "cancelling call";
    Friend *f = &friends[fid];
    Q_ASSERT(f->callstate == -1);
    toxav_cancel(toxav, f->call_index, fid, "Call cancelled by friend");
    emit signal_friend_callstate(fid, (f->callstate = 0));
}
Esempio n. 3
0
void stop_current_call(ToxWindow* self)
{    
    ToxAvCallState callstate;
    if ( ASettins.av != NULL && self->call_idx != -1 && 
       ( callstate = toxav_get_call_state(ASettins.av, self->call_idx) ) != av_CallNonExistant) {
        switch (callstate)
        {
        case av_CallActive:
        case av_CallHold:
            toxav_hangup(ASettins.av, self->call_idx);
            break;
        case av_CallInviting:
            toxav_cancel(ASettins.av, self->call_idx, 0, "Not interested anymore");
            break;
        case av_CallStarting:
            toxav_reject(ASettins.av, self->call_idx, "Not interested");
            break;
        default:
            break;
        }
    }
}
Esempio n. 4
0
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
    const char *error_str;

    if (argc != 0) {
        error_str = "Unknown arguments.";
        goto on_error;
    }

    if ( !ASettins.av ) {
        error_str = "Audio not supported!";
        goto on_error;
    }

    ToxAvError error;

    if (toxav_get_call_state(ASettins.av, self->call_idx) == av_CallInviting) {
        error = toxav_cancel(ASettins.av, self->call_idx, self->num,
                                        "Only those who appreciate small things know the beauty that is life");
#ifdef SOUND_NOTIFY
        stop_sound(self->ringing_sound);
#endif
        line_info_add(self, NULL, NULL, NULL, SYS_MSG, 0, 0, "Call canceled!");
    } else {
        error = toxav_hangup(ASettins.av, self->call_idx);
    }

    if ( error != ErrorNone ) {
        if ( error == ErrorInvalidState ) error_str = "Cannot hangup in invalid state!";
        else if ( error == ErrorNoCall ) error_str = "No call!";
        else error_str = "Internal error!";

        goto on_error;
    }

    return;
on_error:
    print_err (self, error_str);
}
Esempio n. 5
0
void Core::cancelCall(int32_t callId, uint32_t friendId)
{
    qDebug() << QString("Core: Cancelling call with %1").arg(friendId);
    calls[callId].active = false;
    toxav_cancel(toxav, callId, friendId, nullptr);
}